diff options
| author | bors <bors@rust-lang.org> | 2022-12-01 22:49:40 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-12-01 22:49:40 +0000 |
| commit | fec00573a5c1ca233b4aeeaa087168c6cafa3d44 (patch) | |
| tree | 0552fe1119e7018627853f17d458b40bc4cc272b /tests | |
| parent | e16a8b93ba08b93a8d4b835f4842b77d70451bf2 (diff) | |
| parent | 47fb67fa086d88a878c11d7edc38f322f3b98fb9 (diff) | |
| download | rust-fec00573a5c1ca233b4aeeaa087168c6cafa3d44.tar.gz rust-fec00573a5c1ca233b4aeeaa087168c6cafa3d44.zip | |
Auto merge of #10013 - Jarcho:issue_9886, r=Manishearth
Don't lint `manual_assert` in `else if` fixes #9886 changelog: `manual_assert`: Don't lint in `else if`
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/manual_assert.edition2018.fixed | 5 | ||||
| -rw-r--r-- | tests/ui/manual_assert.edition2021.fixed | 5 | ||||
| -rw-r--r-- | tests/ui/manual_assert.edition2021.stderr | 2 | ||||
| -rw-r--r-- | tests/ui/manual_assert.rs | 5 |
4 files changed, 16 insertions, 1 deletions
diff --git a/tests/ui/manual_assert.edition2018.fixed b/tests/ui/manual_assert.edition2018.fixed index c9a819ba535..638320dd6ee 100644 --- a/tests/ui/manual_assert.edition2018.fixed +++ b/tests/ui/manual_assert.edition2018.fixed @@ -62,6 +62,11 @@ fn main() { panic!("panic5"); } assert!(!a.is_empty(), "with expansion {}", one!()); + if a.is_empty() { + let _ = 0; + } else if a.len() == 1 { + panic!("panic6"); + } } fn issue7730(a: u8) { diff --git a/tests/ui/manual_assert.edition2021.fixed b/tests/ui/manual_assert.edition2021.fixed index 2f62de51cad..8c7e919bf62 100644 --- a/tests/ui/manual_assert.edition2021.fixed +++ b/tests/ui/manual_assert.edition2021.fixed @@ -50,6 +50,11 @@ fn main() { assert!(!(b.is_empty() || a.is_empty()), "panic4"); assert!(!(a.is_empty() || !b.is_empty()), "panic5"); assert!(!a.is_empty(), "with expansion {}", one!()); + if a.is_empty() { + let _ = 0; + } else if a.len() == 1 { + panic!("panic6"); + } } fn issue7730(a: u8) { diff --git a/tests/ui/manual_assert.edition2021.stderr b/tests/ui/manual_assert.edition2021.stderr index 237638ee134..3555ac29243 100644 --- a/tests/ui/manual_assert.edition2021.stderr +++ b/tests/ui/manual_assert.edition2021.stderr @@ -65,7 +65,7 @@ LL | | } | |_____^ help: try instead: `assert!(!a.is_empty(), "with expansion {}", one!());` error: only a `panic!` in `if`-then statement - --> $DIR/manual_assert.rs:73:5 + --> $DIR/manual_assert.rs:78:5 | LL | / if a > 2 { LL | | // comment diff --git a/tests/ui/manual_assert.rs b/tests/ui/manual_assert.rs index 6a4cc2468d4..f037c5b8405 100644 --- a/tests/ui/manual_assert.rs +++ b/tests/ui/manual_assert.rs @@ -66,6 +66,11 @@ fn main() { 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) { |
