mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-26 14:40:32 +00:00
Merge pull request #1999 from sunfishcode/master
Enable the cast_lossless warning by default.
This commit is contained in:
commit
c99b67c619
6 changed files with 7 additions and 7 deletions
|
@ -198,7 +198,7 @@ name
|
|||
[box_vec](https://github.com/rust-lang-nursery/rust-clippy/wiki#box_vec) | warn | usage of `Box<Vec<T>>`, vector elements are already on the heap
|
||||
[boxed_local](https://github.com/rust-lang-nursery/rust-clippy/wiki#boxed_local) | warn | using `Box<T>` where unnecessary
|
||||
[builtin_type_shadow](https://github.com/rust-lang-nursery/rust-clippy/wiki#builtin_type_shadow) | warn | shadowing a builtin type
|
||||
[cast_lossless](https://github.com/rust-lang-nursery/rust-clippy/wiki#cast_lossless) | allow | casts using `as` that are known to be lossless, e.g. `x as u64` where `x: u8`
|
||||
[cast_lossless](https://github.com/rust-lang-nursery/rust-clippy/wiki#cast_lossless) | warn | casts using `as` that are known to be lossless, e.g. `x as u64` where `x: u8`
|
||||
[cast_possible_truncation](https://github.com/rust-lang-nursery/rust-clippy/wiki#cast_possible_truncation) | allow | casts that may cause truncation of the value, e.g. `x as u8` where `x: u32`, or `x as i32` where `x: f32`
|
||||
[cast_possible_wrap](https://github.com/rust-lang-nursery/rust-clippy/wiki#cast_possible_wrap) | allow | casts that may cause wrapping around the value, e.g. `x as i32` where `x: u32` and `x > i32::MAX`
|
||||
[cast_precision_loss](https://github.com/rust-lang-nursery/rust-clippy/wiki#cast_precision_loss) | allow | casts that cause loss of precision, e.g. `x as f32` where `x: u64`
|
||||
|
|
|
@ -358,7 +358,6 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
|
|||
shadow::SHADOW_UNRELATED,
|
||||
strings::STRING_ADD,
|
||||
strings::STRING_ADD_ASSIGN,
|
||||
types::CAST_LOSSLESS,
|
||||
types::CAST_POSSIBLE_TRUNCATION,
|
||||
types::CAST_POSSIBLE_WRAP,
|
||||
types::CAST_PRECISION_LOSS,
|
||||
|
@ -530,6 +529,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
|
|||
types::ABSURD_EXTREME_COMPARISONS,
|
||||
types::BORROWED_BOX,
|
||||
types::BOX_VEC,
|
||||
types::CAST_LOSSLESS,
|
||||
types::CHAR_LIT_AS_U8,
|
||||
types::LET_UNIT_VALUE,
|
||||
types::LINKEDLIST,
|
||||
|
|
|
@ -499,7 +499,7 @@ declare_lint! {
|
|||
/// ```
|
||||
declare_lint! {
|
||||
pub CAST_LOSSLESS,
|
||||
Allow,
|
||||
Warn,
|
||||
"casts using `as` that are known to be lossless, e.g. `x as u64` where `x: u8`"
|
||||
}
|
||||
|
||||
|
|
|
@ -38,12 +38,12 @@ pub struct U(u64);
|
|||
|
||||
impl PartialEq<u32> for U {
|
||||
fn eq(&self, other: &u32) -> bool {
|
||||
self.eq(&U(*other as u64))
|
||||
self.eq(&U(u64::from(*other)))
|
||||
}
|
||||
}
|
||||
impl PartialOrd<u32> for U {
|
||||
fn partial_cmp(&self, other: &u32) -> Option<Ordering> {
|
||||
self.partial_cmp(&U(*other as u64))
|
||||
self.partial_cmp(&U(u64::from(*other)))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#![plugin(clippy)]
|
||||
|
||||
#![warn(float_cmp)]
|
||||
#![allow(unused, no_effect, unnecessary_operation)]
|
||||
#![allow(unused, no_effect, unnecessary_operation, cast_lossless)]
|
||||
|
||||
use std::ops::Add;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#![plugin(clippy)]
|
||||
|
||||
#![warn(invalid_upcast_comparisons)]
|
||||
#![allow(unused, eq_op, no_effect, unnecessary_operation)]
|
||||
#![allow(unused, eq_op, no_effect, unnecessary_operation, cast_lossless)]
|
||||
|
||||
fn mk_value<T>() -> T { unimplemented!() }
|
||||
|
||||
|
|
Loading…
Reference in a new issue