X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=tests%2Fui%2Fmanual_assert.rs;h=f037c5b8405c721cc6755b1874cf5d47f229206b;hb=d7b9e195c2df9e576abd2eba54f3fe6516619054;hp=d3e0897488f0c1ce8f315c4f8e4cf367e2f6ee76;hpb=14d54f0f6eb3b03cb5d719949a25404a8fe563d9;p=rust.git diff --git a/tests/ui/manual_assert.rs b/tests/ui/manual_assert.rs index d3e0897488f..f037c5b8405 100644 --- a/tests/ui/manual_assert.rs +++ b/tests/ui/manual_assert.rs @@ -1,17 +1,24 @@ // revisions: edition2018 edition2021 -// [edition2018] edition:2018 -// [edition2021] edition:2021 +//[edition2018] edition:2018 +//[edition2021] edition:2021 // run-rustfix #![warn(clippy::manual_assert)] -#![allow(clippy::nonminimal_bool)] +#![allow(dead_code, unused_doc_comments)] +#![allow(clippy::nonminimal_bool, clippy::uninlined_format_args)] + +macro_rules! one { + () => { + 1 + }; +} fn main() { let a = vec![1, 2, 3]; let c = Some(2); if !a.is_empty() && a.len() == 3 - && c != None + && c.is_some() && !a.is_empty() && a.len() == 3 && !a.is_empty() @@ -56,4 +63,24 @@ fn main() { if a.is_empty() || !b.is_empty() { panic!("panic5"); } + if a.is_empty() { + panic!("with expansion {}", one!()) + } + if a.is_empty() { + let _ = 0; + } else if a.len() == 1 { + panic!("panic6"); + } +} + +fn issue7730(a: u8) { + // Suggestion should preserve comment + if a > 2 { + // comment + /* this is a + multiline + comment */ + /// Doc comment + panic!("panic with comment") // comment after `panic!` + } }