Lint explicit_auto_deref in implicit return positions for closures
This commit is contained in:
@@ -257,13 +257,13 @@ fn main() {
|
||||
let x = S7([0]);
|
||||
let _: &[u32] = &*x;
|
||||
|
||||
let c1 = |x: &Vec<&u32>| {};
|
||||
let c1 = |_: &Vec<&u32>| {};
|
||||
let x = &&vec![&1u32];
|
||||
c1(x);
|
||||
let _ = for<'a, 'b> |x: &'a &'a Vec<&'b u32>, b: bool| -> &'a Vec<&'b u32> {
|
||||
if b {
|
||||
return x;
|
||||
}
|
||||
*x
|
||||
x
|
||||
};
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ fn main() {
|
||||
let x = S7([0]);
|
||||
let _: &[u32] = &*x;
|
||||
|
||||
let c1 = |x: &Vec<&u32>| {};
|
||||
let c1 = |_: &Vec<&u32>| {};
|
||||
let x = &&vec![&1u32];
|
||||
c1(*x);
|
||||
let _ = for<'a, 'b> |x: &'a &'a Vec<&'b u32>, b: bool| -> &'a Vec<&'b u32> {
|
||||
|
||||
@@ -228,5 +228,11 @@ error: deref which would be done by auto-deref
|
||||
LL | return *x;
|
||||
| ^^ help: try this: `x`
|
||||
|
||||
error: aborting due to 38 previous errors
|
||||
error: deref which would be done by auto-deref
|
||||
--> $DIR/explicit_auto_deref.rs:267:9
|
||||
|
|
||||
LL | *x
|
||||
| ^^ help: try this: `x`
|
||||
|
||||
error: aborting due to 39 previous errors
|
||||
|
||||
|
||||
Reference in New Issue
Block a user