2019-05-12 05:10:23 -05:00
|
|
|
#![allow(dead_code)]
|
|
|
|
|
2019-09-18 01:37:41 -05:00
|
|
|
//! Used to test that certain lints don't trigger in imported external macros
|
|
|
|
|
2019-05-12 05:10:23 -05:00
|
|
|
#[macro_export]
|
|
|
|
macro_rules! foofoo {
|
|
|
|
() => {
|
|
|
|
loop {}
|
|
|
|
};
|
|
|
|
}
|
2019-09-18 01:37:41 -05:00
|
|
|
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! must_use_unit {
|
|
|
|
() => {
|
|
|
|
#[must_use]
|
|
|
|
fn foo() {}
|
|
|
|
};
|
|
|
|
}
|
2019-10-24 00:52:01 -05:00
|
|
|
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! try_err {
|
|
|
|
() => {
|
|
|
|
pub fn try_err_fn() -> Result<i32, i32> {
|
|
|
|
let err: i32 = 1;
|
|
|
|
// To avoid warnings during rustfix
|
|
|
|
if true {
|
|
|
|
Err(err)?
|
|
|
|
} else {
|
|
|
|
Ok(2)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2019-12-05 04:06:13 -06:00
|
|
|
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! string_add {
|
|
|
|
() => {
|
|
|
|
let y = "".to_owned();
|
|
|
|
let z = y + "...";
|
|
|
|
};
|
|
|
|
}
|
2019-12-08 13:46:21 -06:00
|
|
|
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! take_external {
|
|
|
|
($s:expr) => {
|
|
|
|
std::mem::replace($s, Default::default())
|
|
|
|
};
|
|
|
|
}
|
2020-02-09 12:58:08 -06:00
|
|
|
|
|
|
|
#[macro_export]
|
|
|
|
macro_rules! option_env_unwrap_external {
|
|
|
|
($env: expr) => {
|
|
|
|
option_env!($env).unwrap()
|
|
|
|
};
|
|
|
|
($env: expr, $message: expr) => {
|
|
|
|
option_env!($env).expect($message)
|
|
|
|
};
|
|
|
|
}
|