Skip to content

Commit e90104e

Browse files
committed
test: add nonstandard_style lint test
Adds a test to make sure that no excess warnings are emitted when dealing with non-standard field names in `init!`. Signed-off-by: Mirko Adzic <adzicmirko97@gmail.com>
1 parent 4e8592e commit e90104e

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tests/nonstandard_style.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//! Test that no extra warnings are emitted for non-standard style fields when using `init!`.
2+
//!
3+
//! See: https://github.com/Rust-for-Linux/pin-init/issues/125
4+
5+
#![cfg_attr(USE_RUSTC_FEATURES, feature(lint_reasons))]
6+
// Should be implied by crate lint settings, but just to be sure:
7+
#![deny(nonstandard_style)]
8+
9+
use pin_init::*;
10+
11+
#[allow(nonstandard_style)]
12+
struct Foo {
13+
NON_STANDARD_A: usize,
14+
nonStandardB: Bar,
15+
}
16+
17+
#[allow(non_snake_case)]
18+
struct Bar {
19+
Non_Standard_C: usize,
20+
}
21+
22+
impl Foo {
23+
fn new() -> impl Init<Self> {
24+
init!(Self {
25+
NON_STANDARD_A: 42,
26+
nonStandardB <- init!(Bar { Non_Standard_C: 42 }),
27+
})
28+
}
29+
}
30+
31+
fn main() {
32+
let _foo = Foo::new();
33+
}

0 commit comments

Comments
 (0)