Skip to content

Commit

Permalink
chore(macros): remove some macro_rules indirection
Browse files Browse the repository at this point in the history
It makes rust-analyzer choke completely and not see
either cfg_http1 etc.
  • Loading branch information
nox committed Mar 19, 2021
1 parent 526e709 commit d735240
Showing 1 changed file with 39 additions and 25 deletions.
64 changes: 39 additions & 25 deletions src/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,40 +23,54 @@ macro_rules! cfg_proto {
}
}

cfg_proto! {
macro_rules! cfg_http1 {
($($item:item)*) => {
cfg_feature! {
#![feature = "http1"]
$($item)*
}
#[cfg(all(
any(feature = "http1", feature = "http2"),
any(feature = "client", feature = "server"),
))]
macro_rules! cfg_http1 {
($($item:item)*) => {
cfg_feature! {
#![feature = "http1"]
$($item)*
}
}
}

macro_rules! cfg_http2 {
($($item:item)*) => {
cfg_feature! {
#![feature = "http2"]
$($item)*
}
#[cfg(all(
any(feature = "http1", feature = "http2"),
any(feature = "client", feature = "server"),
))]
macro_rules! cfg_http2 {
($($item:item)*) => {
cfg_feature! {
#![feature = "http2"]
$($item)*
}
}
}

macro_rules! cfg_client {
($($item:item)*) => {
cfg_feature! {
#![feature = "client"]
$($item)*
}
#[cfg(all(
any(feature = "http1", feature = "http2"),
any(feature = "client", feature = "server"),
))]
macro_rules! cfg_client {
($($item:item)*) => {
cfg_feature! {
#![feature = "client"]
$($item)*
}
}
}

macro_rules! cfg_server {
($($item:item)*) => {
cfg_feature! {
#![feature = "server"]
$($item)*
}
#[cfg(all(
any(feature = "http1", feature = "http2"),
any(feature = "client", feature = "server"),
))]
macro_rules! cfg_server {
($($item:item)*) => {
cfg_feature! {
#![feature = "server"]
$($item)*
}
}
}

0 comments on commit d735240

Please sign in to comment.