Fix ... in multline code-skips in suggestions

When we have long code skips, we write `...` in the line number gutter.

For suggestions, we were "centering" the `...` with the line, but that was consistent with what we do in every other case.
This commit is contained in:
Esteban Küber 2024-06-20 04:25:17 +00:00
parent 3d5d7a24f7
commit 9fd7784b97
18 changed files with 21 additions and 21 deletions

View file

@ -1905,7 +1905,7 @@ impl HumanEmitter {
// //
// LL | this line was highlighted // LL | this line was highlighted
// LL | this line is just for context // LL | this line is just for context
// ... // ...
// LL | this line is just for context // LL | this line is just for context
// LL | this line was highlighted // LL | this line was highlighted
_ => { _ => {
@ -1926,7 +1926,7 @@ impl HumanEmitter {
) )
} }
buffer.puts(row_num, max_line_num_len - 1, "...", Style::LineNumber); buffer.puts(row_num, 0, "...", Style::LineNumber);
row_num += 1; row_num += 1;
if let Some((p, l)) = last_line { if let Some((p, l)) = last_line {

View file

@ -62,7 +62,7 @@ LL | }
LL | match s.len() { LL | match s.len() {
LL ~ 10 => 2, LL ~ 10 => 2,
LL | 20 => { LL | 20 => {
... ...
LL | if foo() { LL | if foo() {
LL ~ return 20; LL ~ return 20;
LL | } LL | }

View file

@ -212,7 +212,7 @@ help: check if the original Iterator contains an element instead of collecting t
| |
LL ~ LL ~
LL | LL |
... ...
LL | // Do lint LL | // Do lint
LL ~ vec.iter().map(|k| k * k).any(|x| x == n); LL ~ vec.iter().map(|k| k * k).any(|x| x == n);
| |

View file

@ -215,7 +215,7 @@ help: move the declaration `x` here
| |
LL ~ LL ~
LL | // types that should be considered insignificant LL | // types that should be considered insignificant
... ...
LL | let y = Box::new(4); LL | let y = Box::new(4);
LL ~ let x = SignificantDrop; LL ~ let x = SignificantDrop;
| |

View file

@ -518,7 +518,7 @@ help: remove `return`
| |
LL ~ 10 LL ~ 10
LL | }, LL | },
... ...
LL | }, LL | },
LL ~ } LL ~ }
| |

View file

@ -17,7 +17,7 @@ help: add a dummy let to cause `fptr` to be fully captured
| |
LL ~ thread::spawn(move || { let _ = &fptr; unsafe { LL ~ thread::spawn(move || { let _ = &fptr; unsafe {
LL | LL |
... ...
LL | LL |
LL ~ } }).join().unwrap(); LL ~ } }).join().unwrap();
| |
@ -39,7 +39,7 @@ help: add a dummy let to cause `fptr` to be fully captured
| |
LL ~ thread::spawn(move || { let _ = &fptr; unsafe { LL ~ thread::spawn(move || { let _ = &fptr; unsafe {
LL | LL |
... ...
LL | LL |
LL ~ } }).join().unwrap(); LL ~ } }).join().unwrap();
| |

View file

@ -109,7 +109,7 @@ help: add a dummy let to cause `fptr1`, `fptr2` to be fully captured
| |
LL ~ thread::spawn(move || { let _ = (&fptr1, &fptr2); unsafe { LL ~ thread::spawn(move || { let _ = (&fptr1, &fptr2); unsafe {
LL | LL |
... ...
LL | LL |
LL ~ } }).join().unwrap(); LL ~ } }).join().unwrap();
| |

View file

@ -209,7 +209,7 @@ help: a macro with this name exists at the root of the crate
| |
LL ~ issue_59764::{makro as foobar, LL ~ issue_59764::{makro as foobar,
LL | LL |
... ...
LL | LL |
LL ~ foo::{baz} LL ~ foo::{baz}
| |

View file

@ -64,7 +64,7 @@ help: try comparing the cast value
| |
LL ~ println!("{}", (a LL ~ println!("{}", (a
LL | LL |
... ...
LL | LL |
LL ~ usize) LL ~ usize)
| |

View file

@ -17,7 +17,7 @@ help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
| |
LL ~ Array(Box<TypeSignature>), LL ~ Array(Box<TypeSignature>),
LL | TypeVariable(()), LL | TypeVariable(()),
... ...
LL | Base(BaseType), LL | Base(BaseType),
LL ~ Object(Box<ObjectType>), LL ~ Object(Box<ObjectType>),
| |

View file

@ -8,7 +8,7 @@ help: try placing this code inside a block
| |
LL ~ let Some(_) = Some(()) else { if true { LL ~ let Some(_) = Some(()) else { if true {
LL | LL |
... ...
LL | return; LL | return;
LL ~ } }; LL ~ } };
| |

View file

@ -27,7 +27,7 @@ help: you might want to use `if let` to ignore the variant that isn't matched
| |
LL ~ if let Some(1) = loop { LL ~ if let Some(1) = loop {
LL | LL |
... ...
LL | return; LL | return;
LL ~ } { todo!() }; LL ~ } { todo!() };
| |

View file

@ -26,7 +26,7 @@ help: consider moving the expression out of the loop so it is only moved once
LL ~ for foo in foos { let mut value = baz.push(foo); LL ~ for foo in foos { let mut value = baz.push(foo);
LL ~ for bar in &bars { if foo == *bar { LL ~ for bar in &bars { if foo == *bar {
LL | LL |
... ...
LL | LL |
LL ~ value; LL ~ value;
| |
@ -69,7 +69,7 @@ help: consider moving the expression out of the loop so it is only moved once
LL ~ let mut value = baz.push(foo); LL ~ let mut value = baz.push(foo);
LL ~ for bar in &bars { LL ~ for bar in &bars {
LL | LL |
... ...
LL | if foo == *bar { LL | if foo == *bar {
LL ~ value; LL ~ value;
| |

View file

@ -54,7 +54,7 @@ help: consider enclosing expression in a block
| |
LL ~ let _i = 'label: { match x { LL ~ let _i = 'label: { match x {
LL | 0 => 42, LL | 0 => 42,
... ...
LL | _ => 1, LL | _ => 1,
LL ~ } }; LL ~ } };
| |

View file

@ -17,7 +17,7 @@ help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
| |
LL ~ bar: Box<Bar<'a>>, LL ~ bar: Box<Bar<'a>>,
LL | b: Rc<Bar<'a>>, LL | b: Rc<Bar<'a>>,
... ...
LL | struct Bar<'a> { LL | struct Bar<'a> {
LL ~ y: (Box<Foo<'a>>, Box<Foo<'a>>), LL ~ y: (Box<Foo<'a>>, Box<Foo<'a>>),
| |

View file

@ -19,7 +19,7 @@ help: consider changing this to be a mutable reference in the `impl` method and
| |
LL ~ fn example(&mut self, input: &i32); LL ~ fn example(&mut self, input: &i32);
LL | } LL | }
... ...
LL | impl Hello for Test2 { LL | impl Hello for Test2 {
LL ~ fn example(&mut self, input: &i32) { LL ~ fn example(&mut self, input: &i32) {
| |

View file

@ -12,7 +12,7 @@ help: consider adding return type
| |
LL ~ fn main() -> Result<(), Box<dyn std::error::Error>> { LL ~ fn main() -> Result<(), Box<dyn std::error::Error>> {
LL | // error for a `Try` type on a non-`Try` fn LL | // error for a `Try` type on a non-`Try` fn
... ...
LL | try_trait_generic::<()>(); LL | try_trait_generic::<()>();
LL + LL +
LL + Ok(()) LL + Ok(())

View file

@ -14,7 +14,7 @@ help: consider introducing a named lifetime parameter
| |
LL ~ fn main<'a>() { LL ~ fn main<'a>() {
LL | eq::< dyn for<'a> Foo<(&'a isize,), Output=&'a isize>, LL | eq::< dyn for<'a> Foo<(&'a isize,), Output=&'a isize>,
... ...
LL | LL |
LL ~ let _: dyn Foo(&'a isize, &'a usize) -> &'a usize; LL ~ let _: dyn Foo(&'a isize, &'a usize) -> &'a usize;
| |