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