diff options
Diffstat (limited to 'tests/ui/lint/expr-field.rs')
-rw-r--r-- | tests/ui/lint/expr-field.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/lint/expr-field.rs b/tests/ui/lint/expr-field.rs new file mode 100644 index 000000000..638fbf521 --- /dev/null +++ b/tests/ui/lint/expr-field.rs @@ -0,0 +1,15 @@ +// check-pass + +pub struct A { + pub x: u32, +} + +#[deny(unused_comparisons)] +pub fn foo(y: u32) -> A { + A { + #[allow(unused_comparisons)] + x: if y < 0 { 1 } else { 2 }, + } +} + +fn main() {} |