]> git.lizzy.rs Git - rust.git/commitdiff
don't lint on comparing `*const f32`s
authorOliver 'ker' Schneider <git-spam-no-reply9815368754983@oli-obk.de>
Sat, 25 Jun 2016 16:59:37 +0000 (18:59 +0200)
committerOliver 'ker' Schneider <git-spam-no-reply9815368754983@oli-obk.de>
Sat, 25 Jun 2016 16:59:37 +0000 (18:59 +0200)
clippy_lints/src/utils/mod.rs
tests/compile-fail/float_cmp.rs

index a2b2ecfbcc00d691516942ca553ae6e37fbfbaaf..e35b1bbac6b865d3e172aeaab57a3e80ea1d1b87 100644 (file)
@@ -523,8 +523,7 @@ pub fn span_lint_and_then<'a, T: LintContext, F>(cx: &'a T, lint: &'static Lint,
 /// Return the base type for references and raw pointers.
 pub fn walk_ptrs_ty(ty: ty::Ty) -> ty::Ty {
     match ty.sty {
-        ty::TyRef(_, ref tm) |
-        ty::TyRawPtr(ref tm) => walk_ptrs_ty(tm.ty),
+        ty::TyRef(_, ref tm) => walk_ptrs_ty(tm.ty),
         _ => ty,
     }
 }
@@ -533,8 +532,7 @@ pub fn walk_ptrs_ty(ty: ty::Ty) -> ty::Ty {
 pub fn walk_ptrs_ty_depth(ty: ty::Ty) -> (ty::Ty, usize) {
     fn inner(ty: ty::Ty, depth: usize) -> (ty::Ty, usize) {
         match ty.sty {
-            ty::TyRef(_, ref tm) |
-            ty::TyRawPtr(ref tm) => inner(tm.ty, depth + 1),
+            ty::TyRef(_, ref tm) => inner(tm.ty, depth + 1),
             _ => (ty, depth),
         }
     }
index 85df1ded5ace7b7f35272b54825b676265821cdc..9f611dd3fd917c54b0b2db7068dbe2f3ccdd9c28 100644 (file)
@@ -63,4 +63,10 @@ fn main() {
     x > 0.0;
     x <= 0.0;
     x >= 0.0;
+
+    let xs : [f32; 1] = [0.0];
+    let a: *const f32 = xs.as_ptr();
+    let b: *const f32 = xs.as_ptr();
+
+    assert!(a == b); // no errors
 }