summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/manual_assert.edition2018.fixed
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/tests/ui/manual_assert.edition2018.fixed')
-rw-r--r--src/tools/clippy/tests/ui/manual_assert.edition2018.fixed43
1 files changed, 34 insertions, 9 deletions
diff --git a/src/tools/clippy/tests/ui/manual_assert.edition2018.fixed b/src/tools/clippy/tests/ui/manual_assert.edition2018.fixed
index 65598f1ea..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 {
() => {
@@ -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!`
+ }
+}