Added examples to lint descriptions.
This commit is contained in:
parent
993239d33a
commit
1846581baa
@ -11,9 +11,9 @@ name | default | meaning
|
||||
approx_constant | warn | the approximate of a known float constant (in `std::f64::consts` or `std::f32::consts`) is found; suggests to use the constant
|
||||
bad_bit_mask | deny | expressions of the form `_ & mask == select` that will only ever return `true` or `false` (because in the example `select` containing bits that `mask` doesn't have)
|
||||
box_vec | warn | usage of `Box<Vec<T>>`, vector elements are already on the heap
|
||||
cast_possible_overflow | allow | casts that may cause overflow
|
||||
cast_precision_loss | allow | casts that cause loss of precision
|
||||
cast_sign_loss | allow | casts from signed types to unsigned types
|
||||
cast_possible_overflow | allow | casts that may cause overflow, e.g `x as u8` where `x: u32`, or `x as i32` where `x: f32`
|
||||
cast_precision_loss | allow | casts that cause loss of precision, e.g `x as f32` where `x: u64`
|
||||
cast_sign_loss | allow | casts from signed types to unsigned types, e.g `x as u32` where `x: i32`
|
||||
cmp_nan | deny | comparisons to NAN (which will always return false, which is probably not intended)
|
||||
cmp_owned | warn | creating owned instances for comparing with others, e.g. `x == "foo".to_string()`
|
||||
collapsible_if | warn | two nested `if`-expressions can be collapsed into one, e.g. `if x { if y { foo() } }` can be written as `if x && y { foo() }`
|
||||
|
@ -140,11 +140,11 @@ impl LintPass for UnitCmp {
|
||||
pub struct CastPass;
|
||||
|
||||
declare_lint!(pub CAST_PRECISION_LOSS, Allow,
|
||||
"casts that cause loss of precision");
|
||||
"casts that cause loss of precision, e.g `x as f32` where `x: u64`");
|
||||
declare_lint!(pub CAST_SIGN_LOSS, Allow,
|
||||
"casts from signed types to unsigned types");
|
||||
"casts from signed types to unsigned types, e.g `x as u32` where `x: i32`");
|
||||
declare_lint!(pub CAST_POSSIBLE_OVERFLOW, Allow,
|
||||
"casts that may cause overflow");
|
||||
"casts that may cause overflow, e.g `x as u8` where `x: u32`, or `x as i32` where `x: f32`");
|
||||
|
||||
impl LintPass for CastPass {
|
||||
fn get_lints(&self) -> LintArray {
|
||||
|
Loading…
Reference in New Issue
Block a user