Rollup merge of #134181 - estebank:trim-render, r=oli-obk
Tweak multispan rendering to reduce output length Consider comments and bare delimiters the same as an "empty line" for purposes of hiding rendered code output of long multispans. This results in more aggressive shortening of rendered output without losing too much context, specially in `*.stderr` tests that have "hidden" comments. We do that check not only on the first 4 lines of the multispan, but now also on the previous to last line as well.
This commit is contained in:
commit
503f2bc3aa
46 changed files with 32 additions and 155 deletions
|
|
@ -20,7 +20,6 @@ LL | | fn clone_self(&self) -> Self {
|
|||
LL | | Self {
|
||||
LL | | a: true,
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
|
|
@ -32,7 +31,6 @@ LL | | fn default() -> Self {
|
|||
LL | | Self {
|
||||
LL | | a: true,
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_^
|
||||
|
||||
|
|
|
|||
|
|
@ -66,8 +66,7 @@ error: this block is too nested
|
|||
LL | if true {
|
||||
| _________________________^
|
||||
LL | | if true {
|
||||
LL | |
|
||||
LL | | }
|
||||
... |
|
||||
LL | | }
|
||||
| |_________________^
|
||||
|
|
||||
|
|
|
|||
|
|
@ -286,7 +286,6 @@ LL | | if unsafe { true } {
|
|||
LL | | todo!();
|
||||
LL | | } else {
|
||||
... |
|
||||
LL | | }
|
||||
LL | | };
|
||||
| |______^
|
||||
|
|
||||
|
|
|
|||
|
|
@ -294,7 +294,6 @@ LL | | if unsafe { true } {
|
|||
LL | | todo!();
|
||||
LL | | } else {
|
||||
... |
|
||||
LL | | }
|
||||
LL | | };
|
||||
| |______^
|
||||
|
|
||||
|
|
|
|||
|
|
@ -80,7 +80,6 @@ error: an async construct yields a type which is itself awaitable
|
|||
LL | let _m = async || {
|
||||
| _______________________-
|
||||
LL | | println!("I'm bored");
|
||||
LL | | // Some more stuff
|
||||
... |
|
||||
LL | | CustomFutureType
|
||||
| | ^^^^^^^^^^^^^^^^
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ LL | | if {
|
|||
LL | | if s == "43" {
|
||||
LL | | return Some(43);
|
||||
... |
|
||||
LL | | }
|
||||
LL | | });
|
||||
| |______^
|
||||
|
|
||||
|
|
|
|||
|
|
@ -115,8 +115,7 @@ error: all if blocks contain the same code at the end
|
|||
--> tests/ui/branches_sharing_code/shared_at_bottom.rs:183:5
|
||||
|
|
||||
LL | / x << 2
|
||||
LL | |
|
||||
LL | |
|
||||
... |
|
||||
LL | | };
|
||||
| |_____^
|
||||
|
|
||||
|
|
@ -131,8 +130,7 @@ error: all if blocks contain the same code at the end
|
|||
--> tests/ui/branches_sharing_code/shared_at_bottom.rs:192:5
|
||||
|
|
||||
LL | / x * 4
|
||||
LL | |
|
||||
LL | |
|
||||
... |
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
|
|
|
|||
|
|
@ -43,9 +43,7 @@ LL | } else {
|
|||
| ____________^
|
||||
LL | | if y == "world" {
|
||||
LL | | println!("world")
|
||||
LL | | }
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
|
|
@ -66,9 +64,7 @@ LL | } else {
|
|||
| ____________^
|
||||
LL | | if let Some(42) = Some(42) {
|
||||
LL | | println!("world")
|
||||
LL | | }
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
|
|
@ -89,9 +85,7 @@ LL | } else {
|
|||
| ____________^
|
||||
LL | | if let Some(42) = Some(42) {
|
||||
LL | | println!("world")
|
||||
LL | | }
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
|
|
@ -112,9 +106,7 @@ LL | } else {
|
|||
| ____________^
|
||||
LL | | if x == "hello" {
|
||||
LL | | println!("world")
|
||||
LL | | }
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
|
|
@ -135,9 +127,7 @@ LL | } else {
|
|||
| ____________^
|
||||
LL | | if let Some(42) = Some(42) {
|
||||
LL | | println!("world")
|
||||
LL | | }
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ LL | |
|
|||
LL | |
|
||||
LL | | type Item = u8;
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@ error: this loop never actually loops
|
|||
--> tests/ui/crashes/ice-360.rs:5:5
|
||||
|
|
||||
LL | / loop {
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
... |
|
||||
LL | |
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
|
|
@ -16,11 +12,7 @@ error: this loop could be written as a `while let` loop
|
|||
--> tests/ui/crashes/ice-360.rs:5:5
|
||||
|
|
||||
LL | / loop {
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
... |
|
||||
LL | |
|
||||
LL | | }
|
||||
| |_____^ help: try: `while let Some(ele) = iter.next() { .. }`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@ error: this looks like you are trying to swap `a` and `b`
|
|||
--> tests/ui/crate_level_checks/no_std_swap.rs:12:5
|
||||
|
|
||||
LL | / a = b;
|
||||
LL | |
|
||||
LL | |
|
||||
... |
|
||||
LL | | b = a;
|
||||
| |_________^ help: try: `core::mem::swap(&mut a, &mut b)`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ LL | | fn default() -> Self {
|
|||
LL | | Self {
|
||||
LL | | a: false,
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
|
|
|
|||
|
|
@ -99,8 +99,7 @@ LL | / /// for OldA
|
|||
LL | | // struct OldA;
|
||||
LL | |
|
||||
LL | | /// Docs
|
||||
LL | | /// for OldB
|
||||
LL | | // struct OldB;
|
||||
... |
|
||||
LL | |
|
||||
| |_^
|
||||
...
|
||||
|
|
|
|||
|
|
@ -103,8 +103,7 @@ error: empty lines after outer attribute
|
|||
--> tests/ui/empty_line_after/outer_attribute.rs:64:1
|
||||
|
|
||||
LL | / #[allow(unused)]
|
||||
LL | |
|
||||
LL | | // This comment is isolated
|
||||
... |
|
||||
LL | |
|
||||
| |_^
|
||||
LL | pub fn isolated_comment() {}
|
||||
|
|
|
|||
|
|
@ -16,8 +16,7 @@ LL | / if !m.contains_key(&k) {
|
|||
LL | | if true {
|
||||
LL | | m.insert(k, v);
|
||||
LL | | } else {
|
||||
LL | | m.insert(k, v2);
|
||||
LL | | }
|
||||
... |
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
|
|
@ -63,7 +62,6 @@ LL | | if true {
|
|||
LL | | m.insert(k, v);
|
||||
LL | | } else {
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
|
|
@ -154,7 +152,6 @@ LL | | foo();
|
|||
LL | | match 0 {
|
||||
LL | | 0 if false => {
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ error: all variants have the same prefix: `c`
|
|||
LL | / enum Foo {
|
||||
LL | |
|
||||
LL | | cFoo,
|
||||
LL | |
|
||||
... |
|
||||
LL | | cBaz,
|
||||
LL | | }
|
||||
|
|
@ -45,9 +44,7 @@ error: all variants have the same prefix: `Food`
|
|||
LL | / enum Food {
|
||||
LL | |
|
||||
LL | | FoodGood,
|
||||
LL | |
|
||||
... |
|
||||
LL | |
|
||||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ LL | |
|
|||
LL | | fn from(i: usize) -> Invalid {
|
||||
LL | | if i != 42 {
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
|
|
@ -49,7 +48,6 @@ LL | |
|
|||
LL | | fn from(s: Option<String>) -> Invalid {
|
||||
LL | | let s = s.unwrap();
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
|
|
@ -76,7 +74,6 @@ LL | |
|
|||
LL | | fn from(s: &'a mut <Box<u32> as ProjStrTrait>::ProjString) -> Invalid {
|
||||
LL | | if s.parse::<u32>().ok().unwrap() != 42 {
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ LL | | for _ in &[42] {
|
|||
LL | | let foo: &Option<_> = &Some::<u8>(42);
|
||||
LL | | if foo.is_some() {
|
||||
... |
|
||||
LL | | }
|
||||
LL | | } else {
|
||||
| |_____^
|
||||
|
|
||||
|
|
@ -20,7 +19,6 @@ LL | | for _ in &[42] {
|
|||
LL | | let bar: &Option<_> = &Some::<u8>(42);
|
||||
LL | | if bar.is_some() {
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_____^
|
||||
= note: `-D clippy::if-same-then-else` implied by `-D warnings`
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ error: infinite loop detected
|
|||
LL | / loop {
|
||||
LL | |
|
||||
LL | | loop {
|
||||
LL | |
|
||||
... |
|
||||
LL | | do_something();
|
||||
LL | | }
|
||||
|
|
@ -37,9 +36,7 @@ error: infinite loop detected
|
|||
LL | / loop {
|
||||
LL | |
|
||||
LL | | loop {
|
||||
LL | |
|
||||
LL | | do_something();
|
||||
LL | | }
|
||||
... |
|
||||
LL | | }
|
||||
| |_________^
|
||||
|
|
||||
|
|
@ -79,8 +76,7 @@ error: infinite loop detected
|
|||
LL | / loop {
|
||||
LL | | fn inner_fn() -> ! {
|
||||
LL | | std::process::exit(0);
|
||||
LL | | }
|
||||
LL | | do_something();
|
||||
... |
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
|
|
@ -97,7 +93,6 @@ LL | |
|
|||
LL | | loop {
|
||||
LL | | if cond {
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
|
|
@ -114,7 +109,6 @@ LL | |
|
|||
LL | | 'inner: loop {
|
||||
LL | | loop {
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
|
|
@ -145,7 +139,6 @@ LL | |
|
|||
LL | | 'inner: loop {
|
||||
LL | | loop {
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_________^
|
||||
|
|
||||
|
|
@ -162,7 +155,6 @@ LL | |
|
|||
LL | | match opt {
|
||||
LL | | Some(v) => {
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
|
|
@ -279,7 +271,6 @@ LL | |
|
|||
LL | | 'inner: loop {
|
||||
LL | | loop {
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ LL | |
|
|||
LL | | type IntoIter = std::slice::Iter<'a, u8>;
|
||||
LL | | type Item = &'a u8;
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
|
|
@ -30,7 +29,6 @@ LL | |
|
|||
LL | | type IntoIter = std::slice::IterMut<'a, u8>;
|
||||
LL | | type Item = &'a mut u8;
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
|
|
@ -52,7 +50,6 @@ LL | |
|
|||
LL | | type IntoIter = std::slice::Iter<'a, T>;
|
||||
LL | | type Item = &'a T;
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
|
|
@ -74,7 +71,6 @@ LL | |
|
|||
LL | | type IntoIter = std::slice::IterMut<'a, T>;
|
||||
LL | | type Item = &'a mut T;
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
|
|
@ -96,7 +92,6 @@ LL | |
|
|||
LL | | type IntoIter = std::slice::IterMut<'a, T>;
|
||||
LL | | type Item = &'a mut T;
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
|
|
@ -117,8 +112,7 @@ LL | / impl<'a> IntoIterator for &'a Issue12037 {
|
|||
LL | | type IntoIter = std::slice::Iter<'a, u8>;
|
||||
LL | | type Item = &'a u8;
|
||||
LL | | fn into_iter(self) -> Self::IntoIter {
|
||||
LL | | todo!()
|
||||
LL | | }
|
||||
... |
|
||||
LL | | }
|
||||
| |_________^
|
||||
...
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ LL | |
|
|||
LL | |
|
||||
LL | | if s == String::new() {
|
||||
... |
|
||||
LL | | }
|
||||
LL | | None
|
||||
| |________^ help: replace with an iterator: `strings.into_iter().find(|s| s == String::new())`
|
||||
|
|
||||
|
|
@ -22,7 +21,6 @@ LL | |
|
|||
LL | |
|
||||
LL | | if s == String::new() {
|
||||
... |
|
||||
LL | | }
|
||||
LL | | None
|
||||
| |________^ help: replace with an iterator: `arr.into_iter().map(|(s, _)| s).find(|s| s == String::new())`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@ error: manual implementation of `Iterator::find`
|
|||
LL | / for &v in ARRAY {
|
||||
LL | | if v == n {
|
||||
LL | | return Some(v);
|
||||
LL | | }
|
||||
LL | | }
|
||||
... |
|
||||
LL | | None
|
||||
| |________^ help: replace with an iterator: `ARRAY.iter().find(|&&v| v == n).copied()`
|
||||
|
|
||||
|
|
@ -18,8 +17,7 @@ error: manual implementation of `Iterator::find`
|
|||
LL | / for (a, _) in arr {
|
||||
LL | | if a % 2 == 0 {
|
||||
LL | | return Some(a);
|
||||
LL | | }
|
||||
LL | | }
|
||||
... |
|
||||
LL | | None
|
||||
| |________^ help: replace with an iterator: `arr.into_iter().map(|(a, _)| a).find(|&a| a % 2 == 0)`
|
||||
|
||||
|
|
@ -29,8 +27,7 @@ error: manual implementation of `Iterator::find`
|
|||
LL | / for el in arr {
|
||||
LL | | if el.name.len() == 10 {
|
||||
LL | | return Some(el);
|
||||
LL | | }
|
||||
LL | | }
|
||||
... |
|
||||
LL | | None
|
||||
| |________^ help: replace with an iterator: `arr.into_iter().find(|el| el.name.len() == 10)`
|
||||
|
|
||||
|
|
@ -42,8 +39,7 @@ error: manual implementation of `Iterator::find`
|
|||
LL | / for Tuple(a, _) in arr {
|
||||
LL | | if a >= 3 {
|
||||
LL | | return Some(a);
|
||||
LL | | }
|
||||
LL | | }
|
||||
... |
|
||||
LL | | None
|
||||
| |________^ help: replace with an iterator: `arr.into_iter().map(|Tuple(a, _)| a).find(|&a| a >= 3)`
|
||||
|
||||
|
|
@ -53,8 +49,7 @@ error: manual implementation of `Iterator::find`
|
|||
LL | / for el in arr {
|
||||
LL | | if el.should_keep() {
|
||||
LL | | return Some(el);
|
||||
LL | | }
|
||||
LL | | }
|
||||
... |
|
||||
LL | | None
|
||||
| |________^ help: replace with an iterator: `arr.into_iter().find(|el| el.should_keep())`
|
||||
|
|
||||
|
|
@ -66,8 +61,7 @@ error: manual implementation of `Iterator::find`
|
|||
LL | / for el in arr {
|
||||
LL | | if f(el) == 20 {
|
||||
LL | | return Some(el);
|
||||
LL | | }
|
||||
LL | | }
|
||||
... |
|
||||
LL | | None
|
||||
| |________^ help: replace with an iterator: `arr.into_iter().find(|&el| f(el) == 20)`
|
||||
|
||||
|
|
@ -77,8 +71,7 @@ error: manual implementation of `Iterator::find`
|
|||
LL | / for &el in arr.values() {
|
||||
LL | | if f(el) {
|
||||
LL | | return Some(el);
|
||||
LL | | }
|
||||
LL | | }
|
||||
... |
|
||||
LL | | None
|
||||
| |________^ help: replace with an iterator: `arr.values().find(|&&el| f(el)).copied()`
|
||||
|
||||
|
|
@ -88,8 +81,7 @@ error: manual implementation of `Iterator::find`
|
|||
LL | / for el in arr {
|
||||
LL | | if el.is_true {
|
||||
LL | | return Some(el);
|
||||
LL | | }
|
||||
LL | | }
|
||||
... |
|
||||
LL | | None
|
||||
| |________^ help: replace with an iterator: `arr.into_iter().find(|el| el.is_true)`
|
||||
|
|
||||
|
|
@ -101,8 +93,7 @@ error: manual implementation of `Iterator::find`
|
|||
LL | / for (_, &x) in v {
|
||||
LL | | if x > 10 {
|
||||
LL | | return Some(x);
|
||||
LL | | }
|
||||
LL | | }
|
||||
... |
|
||||
LL | | None
|
||||
| |________^ help: replace with an iterator: `v.into_iter().map(|(_, &x)| x).find(|&x| x > 10)`
|
||||
|
||||
|
|
@ -112,8 +103,7 @@ error: manual implementation of `Iterator::find`
|
|||
LL | / for &(_, &x) in v {
|
||||
LL | | if x > 10 {
|
||||
LL | | return Some(x);
|
||||
LL | | }
|
||||
LL | | }
|
||||
... |
|
||||
LL | | None
|
||||
| |________^ help: replace with an iterator: `v.iter().map(|&(_, &x)| x).find(|&x| x > 10)`
|
||||
|
||||
|
|
@ -123,8 +113,7 @@ error: manual implementation of `Iterator::find`
|
|||
LL | / for x in arr {
|
||||
LL | | if x >= 5 {
|
||||
LL | | return Some(x);
|
||||
LL | | }
|
||||
LL | | }
|
||||
... |
|
||||
LL | | return None;
|
||||
| |________________^ help: replace with an iterator: `arr.into_iter().find(|&x| x >= 5)`
|
||||
|
||||
|
|
@ -134,8 +123,7 @@ error: manual implementation of `Iterator::find`
|
|||
LL | / for x in arr {
|
||||
LL | | if x < 1 {
|
||||
LL | | return Some(x);
|
||||
LL | | }
|
||||
LL | | }
|
||||
... |
|
||||
LL | | None
|
||||
| |____________^ help: replace with an iterator: `arr.into_iter().find(|&x| x < 1)`
|
||||
|
||||
|
|
|
|||
|
|
@ -184,7 +184,6 @@ LL | |
|
|||
LL | | Some(1),
|
||||
LL | | Some(2),
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
|
|
|
|||
|
|
@ -148,7 +148,6 @@ LL | |
|
|||
LL | | v_some
|
||||
LL | | } else {
|
||||
... |
|
||||
LL | | }
|
||||
LL | | };
|
||||
| |______^
|
||||
|
|
||||
|
|
@ -175,7 +174,6 @@ LL | |
|
|||
LL | | v_some
|
||||
LL | | } else {
|
||||
... |
|
||||
LL | | }
|
||||
LL | | };
|
||||
| |______^
|
||||
|
|
||||
|
|
@ -197,7 +195,6 @@ LL | |
|
|||
LL | | v_some
|
||||
LL | | } else {
|
||||
... |
|
||||
LL | | }
|
||||
LL | | };
|
||||
| |______^
|
||||
|
|
||||
|
|
@ -306,7 +303,6 @@ LL | |
|
|||
LL | | v_some
|
||||
LL | | } else {
|
||||
... |
|
||||
LL | | }
|
||||
LL | | };
|
||||
| |______^
|
||||
|
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ LL | | Some(i) => i,
|
|||
LL | | None => {
|
||||
LL | | 42 + 42
|
||||
... |
|
||||
LL | | }
|
||||
LL | | };
|
||||
| |_____^
|
||||
|
|
||||
|
|
@ -130,7 +129,6 @@ LL | | Ok(i) => i,
|
|||
LL | | Err(_) => {
|
||||
LL | | 42 + 42
|
||||
... |
|
||||
LL | | }
|
||||
LL | | };
|
||||
| |_____^
|
||||
|
|
||||
|
|
|
|||
|
|
@ -77,9 +77,6 @@ error: called `map(..).flatten()` on `Option`
|
|||
|
|
||||
LL | .map(|_| {
|
||||
| __________^
|
||||
LL | | // we need some newlines
|
||||
LL | | // so that the span is big enough
|
||||
LL | | // for a split output of the diagnostic
|
||||
... |
|
||||
LL | | })
|
||||
LL | | .flatten();
|
||||
|
|
|
|||
|
|
@ -75,9 +75,6 @@ error: you seem to be trying to match on a boolean expression
|
|||
--> tests/ui/match_bool.rs:36:5
|
||||
|
|
||||
LL | / match test && test {
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
... |
|
||||
LL | | _ => (),
|
||||
LL | | };
|
||||
|
|
|
|||
|
|
@ -68,8 +68,7 @@ LL | let _ans = match x {
|
|||
| ____________________^
|
||||
LL | | E::A(_) => {
|
||||
LL | | true
|
||||
LL | | }
|
||||
LL | | E::B(_) => true,
|
||||
... |
|
||||
LL | | _ => false,
|
||||
LL | | };
|
||||
| |_________^ help: try: `matches!(x, E::A(_) | E::B(_))`
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ LL | | /// dox
|
|||
LL | | pub fn documented() {}
|
||||
LL | | pub fn undocumented1() {}
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_^
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@ error: missing documentation for the crate
|
|||
--> tests/ui/missing_doc_crate_missing.rs:1:1
|
||||
|
|
||||
LL | / #![warn(clippy::missing_docs_in_private_items)]
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
... |
|
||||
LL | | fn main() {}
|
||||
| |____________^
|
||||
|
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ LL | |
|
|||
LL | | // unused field: hidden
|
||||
LL | | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
|
|
@ -28,7 +27,6 @@ LL | |
|
|||
LL | | // unused fields: hidden, hidden2, hidden4
|
||||
LL | | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
|
|
@ -58,7 +56,6 @@ LL | |
|
|||
LL | | fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
LL | | let mut f = formatter.debug_struct("MultiExprDebugImpl");
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ LL | |
|
|||
LL | |
|
||||
LL | | if *v == 10 {
|
||||
... |
|
||||
LL | | }
|
||||
LL | | });
|
||||
| |_______^
|
||||
|
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ error: this `if` branch is empty
|
|||
LL | / if {
|
||||
LL | | if let true = true
|
||||
LL | | && true
|
||||
LL | | {
|
||||
... |
|
||||
LL | | } && true
|
||||
LL | | {}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,6 @@ error: this loop never actually loops
|
|||
--> tests/ui/never_loop.rs:12:5
|
||||
|
|
||||
LL | / loop {
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | // clippy::never_loop
|
||||
... |
|
||||
LL | | break;
|
||||
LL | | }
|
||||
|
|
@ -75,7 +72,6 @@ LL | |
|
|||
LL | | // never loops
|
||||
LL | | match x {
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
|
|
@ -126,7 +122,6 @@ LL | |
|
|||
LL | | 'b: {
|
||||
LL | | break 'b 'c: {
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
||||
|
|
|
|||
|
|
@ -115,8 +115,7 @@ LL | let _ = if let Some(x) = arg {
|
|||
| _____________^
|
||||
LL | | x
|
||||
LL | | } else {
|
||||
LL | | // map_or_else must be suggested
|
||||
LL | | side_effect()
|
||||
... |
|
||||
LL | | };
|
||||
| |_____^ help: try: `arg.map_or_else(side_effect, |x| x)`
|
||||
|
||||
|
|
|
|||
|
|
@ -183,8 +183,7 @@ error: this block may be rewritten with the `?` operator
|
|||
|
|
||||
LL | / if a.is_none() {
|
||||
LL | | return None;
|
||||
LL | | // do lint here, the outer `try` is not relevant here
|
||||
LL | | // https://github.com/rust-lang/rust-clippy/pull/11001#issuecomment-1610636867
|
||||
... |
|
||||
LL | | }
|
||||
| |_____________^ help: replace it with: `a?;`
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@ LL | pub fn complex_return_triggers_the_lint() -> i32 {
|
|||
| __________________________________________________-
|
||||
LL | | fn foo() -> i32 {
|
||||
LL | | 1
|
||||
LL | | }
|
||||
LL | | let mutex = Mutex::new(1);
|
||||
... |
|
||||
LL | | let lock = mutex.lock().unwrap();
|
||||
| | ^^^^
|
||||
... |
|
||||
|
|
|
|||
|
|
@ -22,10 +22,7 @@ error: you seem to be trying to use `match` for destructuring a single pattern.
|
|||
--> tests/ui/single_match.rs:23:5
|
||||
|
|
||||
LL | / match x {
|
||||
LL | | // Note the missing block braces.
|
||||
LL | | // We suggest `if let Some(y) = x { .. }` because the macro
|
||||
LL | | // is expanded before we can do anything.
|
||||
LL | | Some(y) => println!("{:?}", y),
|
||||
... |
|
||||
LL | | _ => (),
|
||||
LL | | }
|
||||
| |_____^ help: try: `if let Some(y) = x { println!("{:?}", y) }`
|
||||
|
|
|
|||
|
|
@ -68,8 +68,7 @@ LL | / match Result::<i32, &Infallible>::Ok(1) {
|
|||
LL | | Ok(a) => println!("${:?}", a),
|
||||
LL | | Err(_) => {
|
||||
LL | | println!("else block");
|
||||
LL | | return;
|
||||
LL | | }
|
||||
... |
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
|
|
@ -88,8 +87,7 @@ LL | / match Cow::from("moo") {
|
|||
LL | | Cow::Owned(a) => println!("${:?}", a),
|
||||
LL | | Cow::Borrowed(_) => {
|
||||
LL | | println!("else block");
|
||||
LL | | return;
|
||||
LL | | }
|
||||
... |
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
|
|
|
|||
|
|
@ -13,8 +13,7 @@ error: assignment to temporary
|
|||
LL | / MultiStruct {
|
||||
LL | |
|
||||
LL | | structure: Struct { field: 0 },
|
||||
LL | | }
|
||||
LL | | .structure
|
||||
... |
|
||||
LL | | .field = 1;
|
||||
| |______________^
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ LL | |
|
|||
LL | | {
|
||||
LL | | true;
|
||||
... |
|
||||
LL | | }
|
||||
LL | | );
|
||||
| |_____^
|
||||
|
||||
|
|
@ -46,7 +45,6 @@ LL | |
|
|||
LL | | {
|
||||
LL | | true;
|
||||
... |
|
||||
LL | | }
|
||||
LL | | );
|
||||
| |_____^
|
||||
|
||||
|
|
@ -58,7 +56,6 @@ LL | |
|
|||
LL | | {
|
||||
LL | | true;
|
||||
... |
|
||||
LL | | }
|
||||
LL | | );
|
||||
| |_____^
|
||||
|
||||
|
|
@ -70,7 +67,6 @@ LL | |
|
|||
LL | | {
|
||||
LL | | true;
|
||||
... |
|
||||
LL | | }
|
||||
LL | | );
|
||||
| |_____^
|
||||
|
||||
|
|
|
|||
|
|
@ -434,11 +434,7 @@ error: unnecessary closure used to substitute value for `Result::Err`
|
|||
|
|
||||
LL | let _: Result<usize, usize> = res.
|
||||
| ___________________________________^
|
||||
LL | | // some lines
|
||||
LL | | // some lines
|
||||
LL | | // some lines
|
||||
... |
|
||||
LL | | // some lines
|
||||
LL | | or_else(|_| Ok(ext_str.some_field));
|
||||
| |_______________________________________^
|
||||
|
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ LL | |
|
|||
LL | |
|
||||
LL | | if a && b {
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
|
|
@ -112,7 +111,6 @@ LL | |
|
|||
LL | | if a && b {
|
||||
LL | | return Some(());
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
|
|
@ -139,7 +137,6 @@ LL | |
|
|||
LL | | if a && b {
|
||||
LL | | return Ok(());
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ LL | |
|
|||
LL | | // checks whether a string represents a number divisible by 3
|
||||
LL | | let i = i_str.parse::<i32>().unwrap();
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@ error: calls to `push` immediately after creation
|
|||
--> tests/ui/vec_init_then_push.rs:5:5
|
||||
|
|
||||
LL | / let mut def_err: Vec<u32> = Default::default();
|
||||
LL | |
|
||||
LL | |
|
||||
... |
|
||||
LL | | def_err.push(0);
|
||||
| |____________________^ help: consider using the `vec![]` macro: `let def_err: Vec<u32> = vec![..];`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ LL | |
|
|||
LL | |
|
||||
LL | | if let Some(_x) = y {
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_____^ help: try: `while let Some(_x) = y { .. }`
|
||||
|
|
||||
|
|
@ -45,7 +44,6 @@ LL | |
|
|||
LL | | let x = match y {
|
||||
LL | | Some(x) => x,
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }
|
||||
| |_____^ help: try: `while let Some(x) = y { .. }`
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue