File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -45,15 +45,16 @@ fn check_closure(cx: &LateContext, expr: &Expr) {
45
45
// || {foo(); bar()}; can't be reduced here
46
46
return ;
47
47
}
48
+
48
49
if let Some ( ref ex) = blk. expr {
49
50
if let ExprCall ( ref caller, ref args) = ex. node {
50
51
if args. len ( ) != decl. inputs . len ( ) {
51
52
// Not the same number of arguments, there
52
53
// is no way the closure is the same as the function
53
54
return ;
54
55
}
55
- if args. iter ( ) . any ( |arg| is_adjusted ( cx, arg) ) {
56
- // Are the arguments type-adjusted? Then we need the closure
56
+ if is_adjusted ( cx , ex ) || args. iter ( ) . any ( |arg| is_adjusted ( cx, arg) ) {
57
+ // Are the expression or the arguments type-adjusted? Then we need the closure
57
58
return ;
58
59
}
59
60
let fn_ty = cx. tcx . expr_ty ( caller) ;
Original file line number Diff line number Diff line change @@ -21,6 +21,10 @@ fn main() {
21
21
unsafe {
22
22
Some ( 1u8 ) . map ( |a| unsafe_fn ( a) ) ; // unsafe fn
23
23
}
24
+
25
+ // See #515
26
+ let a: Option < Box < :: std:: ops:: Deref < Target = [ i32 ] > > > =
27
+ Some ( vec ! [ 1i32 , 2 ] ) . map ( |v| -> Box < :: std:: ops:: Deref < Target = [ i32 ] > > { Box :: new ( v) } ) ;
24
28
}
25
29
26
30
fn meta < F > ( f : F ) where F : Fn ( u8 ) {
You can’t perform that action at this time.
0 commit comments