ruma-api: Force client and server Cargo features to always be on
This commit is contained in:
parent
ad608c0013
commit
e843ccdb90
@ -32,8 +32,9 @@ thiserror = "1.0.23"
|
||||
ruma-events = { version = "=0.22.0-alpha.2", path = "../ruma-events" }
|
||||
trybuild = "1.0.38"
|
||||
|
||||
# These feature gates exist as a workaround to pass tests.
|
||||
# Any crate that invokes the `ruma-api!` macro should include these features.
|
||||
# These feature gates exist only for the tests. Disabling them results in a
|
||||
# compile error.
|
||||
[features]
|
||||
default = ["client", "server"]
|
||||
client = []
|
||||
server = []
|
||||
|
@ -14,6 +14,9 @@
|
||||
#![warn(rust_2018_idioms)]
|
||||
#![deny(missing_copy_implementations, missing_debug_implementations, missing_docs)]
|
||||
|
||||
#[cfg(not(all(feature = "client", feature = "server")))]
|
||||
compile_error!("ruma_api's Cargo features only exist as a workaround are not meant to be disabled");
|
||||
|
||||
use std::{
|
||||
convert::{TryFrom, TryInto},
|
||||
error::Error as StdError,
|
||||
|
@ -34,7 +34,6 @@ ruma_api! {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "client", feature = "server"))]
|
||||
#[test]
|
||||
fn request_serde() -> Result<(), Box<dyn std::error::Error + 'static>> {
|
||||
let req = Request {
|
||||
|
@ -27,7 +27,6 @@ ruma_api! {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "client", feature = "server"))]
|
||||
#[test]
|
||||
fn response_content_type_override() {
|
||||
let res = Response { stuff: "magic".into() };
|
||||
@ -45,7 +44,6 @@ fn response_content_type_override() {
|
||||
assert_eq!(http_res.headers().get("content-type").unwrap(), "magic");
|
||||
}
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
#[test]
|
||||
fn request_content_type_override() {
|
||||
let req = Request { location: None, stuff: "magic".into() };
|
||||
|
@ -16,7 +16,6 @@ ruma_api! {
|
||||
response: {}
|
||||
}
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
#[test]
|
||||
fn empty_request_http_repr() {
|
||||
let req = Request {};
|
||||
@ -25,7 +24,6 @@ fn empty_request_http_repr() {
|
||||
assert!(http_req.body().is_empty());
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
#[test]
|
||||
fn empty_response_http_repr() {
|
||||
let res = Response {};
|
||||
|
Loading…
x
Reference in New Issue
Block a user