@@ -187,38 +187,36 @@ fn check_ty(cx: &LateContext, ast_ty: &hir::Ty, is_local: bool) {
187
187
match ty. node {
188
188
TyPath ( ref qpath) => {
189
189
let def = cx. tables . qpath_def ( qpath, ast_ty. id ) ;
190
- if let Some ( def_id) = opt_def_id ( def) {
191
- if Some ( def_id) == cx. tcx . lang_items . owned_box ( ) {
192
- if_let_chain ! { [
193
- let QPath :: Resolved ( None , ref path) = * qpath,
194
- let [ ref bx] = * path. segments,
195
- let PathParameters :: AngleBracketedParameters ( ref ab_data) = bx. parameters,
196
- let [ ref inner] = * ab_data. types
197
- ] , {
198
- let ltopt = if lt. is_elided( ) {
199
- "" . to_owned( )
200
- } else {
201
- format!( "{} " , lt. name. as_str( ) )
202
- } ;
203
- let mutopt = if * mutbl == Mutability :: MutMutable {
204
- "mut "
205
- } else {
206
- ""
207
- } ;
208
- span_lint_and_then( cx,
209
- BORROWED_BOX ,
210
- ast_ty. span,
211
- "you seem to be trying to use `&Box<T>`. Consider using just `&T`" ,
212
- |db| {
213
- db. span_suggestion( ast_ty. span,
214
- "try" ,
215
- format!( "&{}{}{}" , ltopt, mutopt, & snippet( cx, inner. span, ".." ) ) ) ;
216
- }
217
- ) ;
218
- return ; // don't recurse into the type
219
- } } ;
220
- }
221
- }
190
+ if_let_chain ! { [
191
+ let Some ( def_id) = opt_def_id( def) ,
192
+ Some ( def_id) == cx. tcx. lang_items. owned_box( ) ,
193
+ let QPath :: Resolved ( None , ref path) = * qpath,
194
+ let [ ref bx] = * path. segments,
195
+ let PathParameters :: AngleBracketedParameters ( ref ab_data) = bx. parameters,
196
+ let [ ref inner] = * ab_data. types
197
+ ] , {
198
+ let ltopt = if lt. is_elided( ) {
199
+ "" . to_owned( )
200
+ } else {
201
+ format!( "{} " , lt. name. as_str( ) )
202
+ } ;
203
+ let mutopt = if * mutbl == Mutability :: MutMutable {
204
+ "mut "
205
+ } else {
206
+ ""
207
+ } ;
208
+ span_lint_and_then( cx,
209
+ BORROWED_BOX ,
210
+ ast_ty. span,
211
+ "you seem to be trying to use `&Box<T>`. Consider using just `&T`" ,
212
+ |db| {
213
+ db. span_suggestion( ast_ty. span,
214
+ "try" ,
215
+ format!( "&{}{}{}" , ltopt, mutopt, & snippet( cx, inner. span, ".." ) ) ) ;
216
+ }
217
+ ) ;
218
+ return ; // don't recurse into the type
219
+ } } ;
222
220
check_ty ( cx, ty, is_local) ;
223
221
} ,
224
222
_ => check_ty ( cx, ty, is_local) ,
0 commit comments