-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #57852 - davidtwco:issue-57819, r=estebank
Suggest removing leading left angle brackets. Fixes #57819. This PR adds errors and accompanying suggestions as below: ``` bar::<<<<<T as Foo>::Output>(); ^^^ help: remove extra angle brackets ``` r? @estebank
- Loading branch information
Showing
4 changed files
with
328 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// 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>>(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// 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>>(); | ||
} |
Oops, something went wrong.