Skip to content

Commit 2d194be

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 2d194be

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/nonstandard_style.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//! Tests 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+
// Should be implied by crate lint settings, but just to be sure:
6+
#![deny(nonstandard_style)]
7+
#![allow(dead_code)]
8+
#![cfg_attr(USE_RUSTC_FEATURES, feature(lint_reasons))]
9+
10+
use pin_init::*;
11+
12+
#[allow(nonstandard_style)]
13+
struct Foo {
14+
NON_STANDARD_A: usize,
15+
nonStandardB: Bar,
16+
}
17+
18+
#[allow(non_snake_case)]
19+
struct Bar {
20+
Non_Standard_C: usize,
21+
}
22+
23+
impl Foo {
24+
fn new() -> impl Init<Self> {
25+
init!(Self {
26+
NON_STANDARD_A: 42,
27+
nonStandardB <- init!(Bar { Non_Standard_C: 42 }),
28+
})
29+
}
30+
}

0 commit comments

Comments
 (0)