rust/src/test/ui/issues/issue-57819.rs
David Wood 22f794b00f
Suggest removing leading left angle brackets.
This commit adds errors and accompanying suggestions as below:

```
bar::<<<<<T as Foo>::Output>();
     ^^^ help: remove extra angle brackets
```
2019-01-23 11:25:45 +01:00

48 lines
1.2 KiB
Rust

// run-rustfix
#![allow(warnings)]
// This test checks that the following error is emitted and the suggestion works:
//
// ```
// let _ = vec![1, 2, 3].into_iter().collect::<<<Vec<usize>>();
// ^^ help: remove extra angle brackets
// ```
trait Foo {
type Output;
}
fn foo<T: Foo>() {
// More complex cases with more than one correct leading `<` character:
bar::<<<<<T as Foo>::Output>();
//~^ ERROR unmatched angle bracket
bar::<<<<T as Foo>::Output>();
//~^ ERROR unmatched angle bracket
bar::<<<T as Foo>::Output>();
//~^ ERROR unmatched angle bracket
bar::<<T as Foo>::Output>();
}
fn bar<T>() {}
fn main() {
let _ = vec![1, 2, 3].into_iter().collect::<<<<<Vec<usize>>();
//~^ ERROR unmatched angle bracket
let _ = vec![1, 2, 3].into_iter().collect::<<<<Vec<usize>>();
//~^ ERROR unmatched angle bracket
let _ = vec![1, 2, 3].into_iter().collect::<<<Vec<usize>>();
//~^ ERROR unmatched angle bracket
let _ = vec![1, 2, 3].into_iter().collect::<<Vec<usize>>();
//~^ ERROR unmatched angle bracket
let _ = vec![1, 2, 3].into_iter().collect::<Vec<usize>>();
}