summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/manual_assert.edition2018.fixed
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/tools/clippy/tests/ui/manual_assert.edition2018.fixed45
1 files changed, 35 insertions, 10 deletions
diff --git a/src/tools/clippy/tests/ui/manual_assert.edition2018.fixed b/src/tools/clippy/tests/ui/manual_assert.edition2018.fixed
index d0bc640db..c9a819ba5 100644
--- a/src/tools/clippy/tests/ui/manual_assert.edition2018.fixed
+++ b/src/tools/clippy/tests/ui/manual_assert.edition2018.fixed
@@ -1,10 +1,11 @@
// 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 {
() => {
@@ -17,7 +18,7 @@ fn main() {
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()
@@ -28,7 +29,9 @@ fn main() {
panic!("qaqaq{:?}", a);
}
assert!(a.is_empty(), "qaqaq{:?}", a);
- assert!(a.is_empty(), "qwqwq");
+ if !a.is_empty() {
+ panic!("qwqwq");
+ }
if a.len() == 3 {
println!("qwq");
println!("qwq");
@@ -43,10 +46,32 @@ fn main() {
println!("qwq");
}
let b = vec![1, 2, 3];
- assert!(!b.is_empty(), "panic1");
- assert!(!(b.is_empty() && a.is_empty()), "panic2");
- assert!(!(a.is_empty() && !b.is_empty()), "panic3");
- assert!(!(b.is_empty() || a.is_empty()), "panic4");
- assert!(!(a.is_empty() || !b.is_empty()), "panic5");
+ if b.is_empty() {
+ panic!("panic1");
+ }
+ if b.is_empty() && a.is_empty() {
+ panic!("panic2");
+ }
+ if a.is_empty() && !b.is_empty() {
+ panic!("panic3");
+ }
+ if b.is_empty() || a.is_empty() {
+ panic!("panic4");
+ }
+ if a.is_empty() || !b.is_empty() {
+ panic!("panic5");
+ }
assert!(!a.is_empty(), "with expansion {}", one!());
}
+
+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!`
+ }
+}