Skip to content

Commit 9826e0c

Browse files
bonziniBennoLossin
authored andcommitted
examples: add #[allow(unused_attributes)] around "mod"
When examples are compiled independently, they need the enable the allocator_api feature. When they are brought in as modules from other examples, the parent crate does it for them. In the latter case, the compiler complains that the module cannot enable the feature and therefore the attribute is unused. Follow the example already present in examples/mutex.rs, and shut up the compiler about cases that are expected. Signed-off-by: Paolo Bonzini <[email protected]>
1 parent de59d80 commit 9826e0c

File tree

6 files changed

+8
-1
lines changed

6 files changed

+8
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ prettyplease = { version = "0.2", features = ["verbatim"] }
3131

3232
[lints.rust]
3333
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(NO_UI_TESTS)', 'cfg(NO_ALLOC_FAIL_TESTS)'] }
34+
unused_attributes = "deny"
3435

3536
[lints.rustdoc]
3637
unescaped_backticks = "deny"

examples/linked_list.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ use core::{
99
};
1010

1111
use pinned_init::*;
12+
13+
#[expect(unused_attributes)]
1214
mod error;
1315
use error::Error;
1416

examples/mutex.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use std::{
1414
};
1515

1616
use pinned_init::*;
17-
#[allow(unused_attributes)]
17+
#[expect(unused_attributes)]
1818
#[path = "./linked_list.rs"]
1919
pub mod linked_list;
2020
use linked_list::*;

examples/static_init.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use std::{
1313
thread::{sleep, Builder},
1414
};
1515

16+
#[expect(unused_attributes)]
1617
mod mutex;
1718
use mutex::*;
1819

tests/alloc_fail.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use core::convert::Infallible;
77
use pinned_init::*;
88
use std::sync::Arc;
99

10+
#[expect(unused_attributes)]
1011
#[path = "./ring_buf.rs"]
1112
mod ring_buf;
1213
use ring_buf::*;

tests/ring_buf.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ use core::{
1010
use pinned_init::*;
1111
use std::sync::Arc;
1212

13+
#[expect(unused_attributes)]
1314
#[path = "../examples/mutex.rs"]
1415
mod mutex;
1516
use mutex::*;
1617

18+
#[expect(unused_attributes)]
1719
#[path = "../examples/error.rs"]
1820
mod error;
1921
use error::Error;

0 commit comments

Comments
 (0)