@@ -44,7 +44,7 @@ use std::{i8, i16, i32, i64, u8, u16, u32, u64, f32, f64};
4444use syntax:: { abi, ast, ast_map} ;
4545use syntax:: ast_util:: is_shift_binop;
4646use syntax:: attr:: { self , AttrMetaMethods } ;
47- use syntax:: codemap:: { Span , DUMMY_SP } ;
47+ use syntax:: codemap:: { self , Span , DUMMY_SP } ;
4848use syntax:: parse:: token;
4949use syntax:: ast:: { TyIs , TyUs , TyI8 , TyU8 , TyI16 , TyU16 , TyI32 , TyU32 , TyI64 , TyU64 } ;
5050use syntax:: ast_util;
@@ -185,7 +185,7 @@ impl LintPass for TypeLimits {
185185 "comparison is useless due to type limits" ) ;
186186 }
187187
188- if is_shift_binop ( binop) {
188+ if is_shift_binop ( binop. node ) {
189189 let opt_ty_bits = match ty:: expr_ty ( cx. tcx , & * * l) . sty {
190190 ty:: ty_int( t) => Some ( int_ty_bits ( t, cx. sess ( ) . target . int_type ) ) ,
191191 ty:: ty_uint( t) => Some ( uint_ty_bits ( t, cx. sess ( ) . target . uint_type ) ) ,
@@ -272,7 +272,7 @@ impl LintPass for TypeLimits {
272272
273273 fn is_valid < T : cmp:: PartialOrd > ( binop : ast:: BinOp , v : T ,
274274 min : T , max : T ) -> bool {
275- match binop {
275+ match binop. node {
276276 ast:: BiLt => v > min && v <= max,
277277 ast:: BiLe => v >= min && v < max,
278278 ast:: BiGt => v >= min && v < max,
@@ -283,13 +283,13 @@ impl LintPass for TypeLimits {
283283 }
284284
285285 fn rev_binop ( binop : ast:: BinOp ) -> ast:: BinOp {
286- match binop {
286+ codemap :: respan ( binop . span , match binop. node {
287287 ast:: BiLt => ast:: BiGt ,
288288 ast:: BiLe => ast:: BiGe ,
289289 ast:: BiGt => ast:: BiLt ,
290290 ast:: BiGe => ast:: BiLe ,
291- _ => binop
292- }
291+ _ => return binop
292+ } )
293293 }
294294
295295 // for int & uint, be conservative with the warnings, so that the
@@ -382,7 +382,7 @@ impl LintPass for TypeLimits {
382382 }
383383
384384 fn is_comparison ( binop : ast:: BinOp ) -> bool {
385- match binop {
385+ match binop. node {
386386 ast:: BiEq | ast:: BiLt | ast:: BiLe |
387387 ast:: BiNe | ast:: BiGe | ast:: BiGt => true ,
388388 _ => false
0 commit comments