about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJason Olson <jolson88@outlook.com>2019-09-12 17:30:58 -0700
committerJason Olson <jolson88@outlook.com>2019-09-15 10:32:45 -0700
commit6f1f41371789e938e0f1fe1e3dfc879835351989 (patch)
tree44ba747f3a1f3614218be43c880b66f3be6b669b
parent535bc1d7046ed640dd013aacfce7426e16e7459d (diff)
downloadrust-6f1f41371789e938e0f1fe1e3dfc879835351989.tar.gz
rust-6f1f41371789e938e0f1fe1e3dfc879835351989.zip
Changes cast-lossless to a pedantic lint
Fixes #4528
-rw-r--r--clippy_lints/src/lib.rs3
-rw-r--r--clippy_lints/src/types.rs2
-rw-r--r--src/lintlist/mod.rs2
-rw-r--r--tests/ui/types.fixed1
-rw-r--r--tests/ui/types.rs1
-rw-r--r--tests/ui/types.stderr2
6 files changed, 6 insertions, 5 deletions
diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs
index 9d0a91c5318..719b414c56f 100644
--- a/clippy_lints/src/lib.rs
+++ b/clippy_lints/src/lib.rs
@@ -667,6 +667,7 @@ pub fn register_plugins(reg: &mut rustc_driver::plugin::Registry<'_>, conf: &Con
         shadow::SHADOW_UNRELATED,
         strings::STRING_ADD_ASSIGN,
         trait_bounds::TYPE_REPETITION_IN_BOUNDS,
+        types::CAST_LOSSLESS,
         types::CAST_POSSIBLE_TRUNCATION,
         types::CAST_POSSIBLE_WRAP,
         types::CAST_PRECISION_LOSS,
@@ -890,7 +891,6 @@ pub fn register_plugins(reg: &mut rustc_driver::plugin::Registry<'_>, conf: &Con
         types::ABSURD_EXTREME_COMPARISONS,
         types::BORROWED_BOX,
         types::BOX_VEC,
-        types::CAST_LOSSLESS,
         types::CAST_PTR_ALIGNMENT,
         types::CAST_REF_TO_MUT,
         types::CHAR_LIT_AS_U8,
@@ -1072,7 +1072,6 @@ pub fn register_plugins(reg: &mut rustc_driver::plugin::Registry<'_>, conf: &Con
         transmute::TRANSMUTE_PTR_TO_REF,
         transmute::USELESS_TRANSMUTE,
         types::BORROWED_BOX,
-        types::CAST_LOSSLESS,
         types::CHAR_LIT_AS_U8,
         types::OPTION_OPTION,
         types::TYPE_COMPLEXITY,
diff --git a/clippy_lints/src/types.rs b/clippy_lints/src/types.rs
index 2e4128ccca6..a1d54ff3f0e 100644
--- a/clippy_lints/src/types.rs
+++ b/clippy_lints/src/types.rs
@@ -765,7 +765,7 @@ declare_clippy_lint! {
     /// }
     /// ```
     pub CAST_LOSSLESS,
-    complexity,
+    pedantic,
     "casts using `as` that are known to be lossless, e.g., `x as u64` where `x: u8`"
 }
 
diff --git a/src/lintlist/mod.rs b/src/lintlist/mod.rs
index 223e6aa9acd..d0be8c1d341 100644
--- a/src/lintlist/mod.rs
+++ b/src/lintlist/mod.rs
@@ -121,7 +121,7 @@ pub const ALL_LINTS: [Lint; 313] = [
     },
     Lint {
         name: "cast_lossless",
-        group: "complexity",
+        group: "pedantic",
         desc: "casts using `as` that are known to be lossless, e.g., `x as u64` where `x: u8`",
         deprecation: None,
         module: "types",
diff --git a/tests/ui/types.fixed b/tests/ui/types.fixed
index a71a9ec8124..b1622e45f3b 100644
--- a/tests/ui/types.fixed
+++ b/tests/ui/types.fixed
@@ -1,6 +1,7 @@
 // run-rustfix
 
 #![allow(dead_code, unused_variables)]
+#![warn(clippy::all, clippy::pedantic)]
 
 // should not warn on lossy casting in constant types
 // because not supported yet
diff --git a/tests/ui/types.rs b/tests/ui/types.rs
index 6f48080cedd..30463f9e2a1 100644
--- a/tests/ui/types.rs
+++ b/tests/ui/types.rs
@@ -1,6 +1,7 @@
 // run-rustfix
 
 #![allow(dead_code, unused_variables)]
+#![warn(clippy::all, clippy::pedantic)]
 
 // should not warn on lossy casting in constant types
 // because not supported yet
diff --git a/tests/ui/types.stderr b/tests/ui/types.stderr
index 3b4f57a7a43..daba766856d 100644
--- a/tests/ui/types.stderr
+++ b/tests/ui/types.stderr
@@ -1,5 +1,5 @@
 error: casting i32 to i64 may become silently lossy if you later change the type
-  --> $DIR/types.rs:13:22
+  --> $DIR/types.rs:14:22
    |
 LL |     let c_i64: i64 = c as i64;
    |                      ^^^^^^^^ help: try: `i64::from(c)`