Skip to content

Clean up lints around unused macros #2797

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
improper_ctypes,
// This lint is renamed but we run CI for old stable rustc so should be here.
redundant_semicolon,
redundant_semicolons
redundant_semicolons,
unused_macros,
unused_macro_rules,
)]
#![cfg_attr(libc_deny_warnings, deny(warnings))]
// Attributes needed when building as part of the standard library
Expand Down
16 changes: 0 additions & 16 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
///
/// This allows you to conveniently provide a long list #[cfg]'d blocks of code
/// without having to rewrite each clause multiple times.
#[allow(unused_macros)]
macro_rules! cfg_if {
// match if/else chains with a final `else`
($(
Expand Down Expand Up @@ -62,7 +61,6 @@ macro_rules! cfg_if {
};
}

#[allow(unused_macros, unused_macro_rules)]
macro_rules! s {
($($(#[$attr:meta])* pub $t:ident $i:ident { $($field:tt)* })*) => ($(
s!(it: $(#[$attr])* pub $t $i { $($field)* });
Expand All @@ -87,7 +85,6 @@ macro_rules! s {
);
}

#[allow(unused_macros)]
macro_rules! s_no_extra_traits {
($($(#[$attr:meta])* pub $t:ident $i:ident { $($field:tt)* })*) => ($(
s_no_extra_traits!(it: $(#[$attr])* pub $t $i { $($field)* });
Expand Down Expand Up @@ -123,7 +120,6 @@ macro_rules! s_no_extra_traits {
);
}

#[allow(unused_macros)]
macro_rules! e {
($($(#[$attr:meta])* pub enum $i:ident { $($field:tt)* })*) => ($(
__item! {
Expand All @@ -138,7 +134,6 @@ macro_rules! e {
)*);
}

#[allow(unused_macros)]
macro_rules! s_paren {
($($(#[$attr:meta])* pub struct $i:ident ( $($field:tt)* ); )* ) => ($(
__item! {
Expand Down Expand Up @@ -182,7 +177,6 @@ macro_rules! s_paren {
// 'f!' block
cfg_if! {
if #[cfg(libc_const_extern_fn)] {
#[allow(unused_macros)]
macro_rules! f {
($($(#[$attr:meta])* pub $({$constness:ident})* fn $i:ident(
$($arg:ident: $argty:ty),*
Expand All @@ -198,7 +192,6 @@ cfg_if! {
)*)
}

#[allow(unused_macros)]
macro_rules! safe_f {
($($(#[$attr:meta])* pub $({$constness:ident})* fn $i:ident(
$($arg:ident: $argty:ty),*
Expand All @@ -214,7 +207,6 @@ cfg_if! {
)*)
}

#[allow(unused_macros)]
macro_rules! const_fn {
($($(#[$attr:meta])* $({$constness:ident})* fn $i:ident(
$($arg:ident: $argty:ty),*
Expand All @@ -231,7 +223,6 @@ cfg_if! {
}

} else {
#[allow(unused_macros)]
macro_rules! f {
($($(#[$attr:meta])* pub $({$constness:ident})* fn $i:ident(
$($arg:ident: $argty:ty),*
Expand All @@ -247,7 +238,6 @@ cfg_if! {
)*)
}

#[allow(unused_macros)]
macro_rules! safe_f {
($($(#[$attr:meta])* pub $({$constness:ident})* fn $i:ident(
$($arg:ident: $argty:ty),*
Expand All @@ -263,7 +253,6 @@ cfg_if! {
)*)
}

#[allow(unused_macros)]
macro_rules! const_fn {
($($(#[$attr:meta])* $({$constness:ident})* fn $i:ident(
$($arg:ident: $argty:ty),*
Expand All @@ -281,14 +270,12 @@ cfg_if! {
}
}

#[allow(unused_macros)]
macro_rules! __item {
($i:item) => {
$i
};
}

#[allow(unused_macros)]
macro_rules! align_const {
($($(#[$attr:meta])*
pub const $name:ident : $t1:ty
Expand All @@ -308,7 +295,6 @@ macro_rules! align_const {
}

// This macro is used to deprecate items that should be accessed via the mach2 crate
#[allow(unused_macros)]
macro_rules! deprecated_mach {
(pub const $id:ident: $ty:ty = $expr:expr;) => {
#[deprecated(
Expand Down Expand Up @@ -342,15 +328,13 @@ macro_rules! deprecated_mach {
}
}

#[allow(unused_macros)]
#[cfg(not(libc_ptr_addr_of))]
macro_rules! ptr_addr_of {
($place:expr) => {
&$place
};
}

#[allow(unused_macros)]
#[cfg(libc_ptr_addr_of)]
macro_rules! ptr_addr_of {
($place:expr) => {
Expand Down