Skip to content

Commit

Permalink
Ensure removal of cfg_if is compatible with MSRV
Browse files Browse the repository at this point in the history
  • Loading branch information
EriKWDev committed Nov 26, 2022
1 parent 2cf7354 commit ca43a2a
Showing 1 changed file with 36 additions and 23 deletions.
59 changes: 36 additions & 23 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1506,29 +1506,42 @@ pub const STATIC_MAX_LEVEL: LevelFilter = MAX_LEVEL_INNER;

#[rustfmt::skip]
const MAX_LEVEL_INNER: LevelFilter = {
if cfg!(all(not(debug_assertions), feature = "release_max_level_off")) {
LevelFilter::Off
} else if cfg!(all(not(debug_assertions), feature = "release_max_level_error")) {
LevelFilter::Error
} else if cfg!(all(not(debug_assertions), feature = "release_max_level_warn")) {
LevelFilter::Warn
} else if cfg!(all(not(debug_assertions), feature = "release_max_level_info")) {
LevelFilter::Info
} else if cfg!(all(not(debug_assertions), feature = "release_max_level_debug")) {
LevelFilter::Debug
} else if cfg!(all(not(debug_assertions), feature = "release_max_level_trace")) {
LevelFilter::Trace
} else if cfg!(feature = "max_level_off") {
LevelFilter::Off
} else if cfg!(feature = "max_level_error") {
LevelFilter::Error
} else if cfg!(feature = "max_level_warn") {
LevelFilter::Warn
} else if cfg!(feature = "max_level_info") {
LevelFilter::Info
} else if cfg!(feature = "max_level_debug") {
LevelFilter::Debug
} else {
#[allow(unreachable_code)]
{
#[cfg(all(not(debug_assertions), feature = "release_max_level_off"))] {
return LevelFilter::Off;
}
#[cfg(all(not(debug_assertions), feature = "release_max_level_error"))] {
return LevelFilter::Error;
}
#[cfg(all(not(debug_assertions), feature = "release_max_level_warn"))] {
return LevelFilter::Warn;
}
#[cfg(all(not(debug_assertions), feature = "release_max_level_info"))] {
return LevelFilter::Info;
}
#[cfg(all(not(debug_assertions), feature = "release_max_level_debug"))] {
return LevelFilter::Debug;
}
#[cfg(all(not(debug_assertions), feature = "release_max_level_trace"))] {
return LevelFilter::Trace;
}
#[cfg(feature = "max_level_off")] {
return LevelFilter::Off;
}
#[cfg(feature = "max_level_error")] {
return LevelFilter::Error;
}
#[cfg(feature = "max_level_warn")] {
return LevelFilter::Warn;
}
#[cfg(feature = "max_level_info")] {
return LevelFilter::Info;
}
#[cfg(feature = "max_level_debug")] {
return LevelFilter::Debug;
}

LevelFilter::Trace
}
};
Expand Down

0 comments on commit ca43a2a

Please sign in to comment.