mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-03 18:09:42 +00:00
Auto merge of #115696 - RalfJung:closure-ty-print, r=oli-obk
adjust how closure/generator types are printed I saw `&[closure@$DIR/issue-20862.rs:2:5]` and I thought it is a slice type, because that's usually what `&[_]` is... it took me a while to realize that this is just a confusing printer and actually there's no slice. Let's use something that cannot be mistaken for a regular type.
This commit is contained in:
commit
835d7d923b
3 changed files with 3 additions and 3 deletions
|
@ -36,7 +36,7 @@ fn main() {
|
|||
issue_10381();
|
||||
|
||||
// `Box::<Option<_>>::default()` would be valid here, but not `Box::default()` or
|
||||
// `Box::<Option<[closure@...]>::default()`
|
||||
// `Box::<Option<{closure@...}>::default()`
|
||||
//
|
||||
// Would have a suggestion after https://github.com/rust-lang/rust/blob/fdd030127cc68afec44a8d3f6341525dd34e50ae/compiler/rustc_middle/src/ty/diagnostics.rs#L554-L563
|
||||
let mut unnameable = Box::new(Option::default());
|
||||
|
|
|
@ -36,7 +36,7 @@ fn main() {
|
|||
issue_10381();
|
||||
|
||||
// `Box::<Option<_>>::default()` would be valid here, but not `Box::default()` or
|
||||
// `Box::<Option<[closure@...]>::default()`
|
||||
// `Box::<Option<{closure@...}>::default()`
|
||||
//
|
||||
// Would have a suggestion after https://github.com/rust-lang/rust/blob/fdd030127cc68afec44a8d3f6341525dd34e50ae/compiler/rustc_middle/src/ty/diagnostics.rs#L554-L563
|
||||
let mut unnameable = Box::new(Option::default());
|
||||
|
|
|
@ -27,7 +27,7 @@ LL | fn bug<T>() -> impl Iterator<Item = [(); { |x: [u8]| x }]> {
|
|||
| ^^^^^^^^^^^ expected `usize`, found closure
|
||||
|
|
||||
= note: expected type `usize`
|
||||
found closure `[closure@$DIR/ice-6251.rs:4:44: 4:53]`
|
||||
found closure `{closure@$DIR/ice-6251.rs:4:44: 4:53}`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
Loading…
Reference in a new issue