Skip to content

Commit 132d9d3

Browse files
committed
Merge pull request #934 from Manishearth/allow-upcast
Allow invalid upcast comparisons
2 parents 4c4b1af + f2f5fef commit 132d9d3

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ name
7575
[inline_always](https://github.com/Manishearth/rust-clippy/wiki#inline_always) | warn | `#[inline(always)]` is a bad idea in most cases
7676
[integer_arithmetic](https://github.com/Manishearth/rust-clippy/wiki#integer_arithmetic) | allow | Any integer arithmetic statement
7777
[invalid_regex](https://github.com/Manishearth/rust-clippy/wiki#invalid_regex) | deny | finds invalid regular expressions in `Regex::new(_)` invocations
78-
[invalid_upcast_comparisons](https://github.com/Manishearth/rust-clippy/wiki#invalid_upcast_comparisons) | warn | a comparison involving an upcast which is always true or false
78+
[invalid_upcast_comparisons](https://github.com/Manishearth/rust-clippy/wiki#invalid_upcast_comparisons) | allow | a comparison involving an upcast which is always true or false
7979
[items_after_statements](https://github.com/Manishearth/rust-clippy/wiki#items_after_statements) | allow | finds blocks where an item comes after a statement
8080
[iter_next_loop](https://github.com/Manishearth/rust-clippy/wiki#iter_next_loop) | warn | for-looping over `_.next()` which is probably not intended
8181
[len_without_is_empty](https://github.com/Manishearth/rust-clippy/wiki#len_without_is_empty) | warn | traits and impls that have `.len()` but not `.is_empty()`

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ pub fn plugin_registrar(reg: &mut Registry) {
427427
types::CAST_POSSIBLE_WRAP,
428428
types::CAST_PRECISION_LOSS,
429429
types::CAST_SIGN_LOSS,
430+
types::INVALID_UPCAST_COMPARISONS,
430431
unicode::NON_ASCII_LITERAL,
431432
unicode::UNICODE_NOT_NFC,
432433
]);
@@ -543,7 +544,6 @@ pub fn plugin_registrar(reg: &mut Registry) {
543544
types::ABSURD_EXTREME_COMPARISONS,
544545
types::BOX_VEC,
545546
types::CHAR_LIT_AS_U8,
546-
types::INVALID_UPCAST_COMPARISONS,
547547
types::LET_UNIT_VALUE,
548548
types::LINKEDLIST,
549549
types::TYPE_COMPLEXITY,

src/types.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -777,11 +777,11 @@ impl LateLintPass for AbsurdExtremeComparisons {
777777
///
778778
/// **Why is this bad?** An expression like `let x : u8 = ...; (x as u32) > 300` will mistakenly imply that it is possible for `x` to be outside the range of `u8`.
779779
///
780-
/// **Known problems:** None
780+
/// **Known problems:** https://github.com/Manishearth/rust-clippy/issues/886
781781
///
782782
/// **Example:** `let x : u8 = ...; (x as u32) > 300`
783783
declare_lint! {
784-
pub INVALID_UPCAST_COMPARISONS, Warn,
784+
pub INVALID_UPCAST_COMPARISONS, Allow,
785785
"a comparison involving an upcast which is always true or false"
786786
}
787787

0 commit comments

Comments
 (0)