Skip to content

Commit

Permalink
Added examples to lint descriptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Robzz committed Aug 20, 2015
1 parent 993239d commit 1846581
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -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() }`
Expand Down
6 changes: 3 additions & 3 deletions src/types.rs
Expand Up @@ -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 {
Expand Down

0 comments on commit 1846581

Please sign in to comment.