Categorize the unwrap lints correctly.
This commit is contained in:
parent
0c6730d851
commit
8682858e2c
@ -926,6 +926,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
|
|||||||
mutex_atomic::MUTEX_INTEGER,
|
mutex_atomic::MUTEX_INTEGER,
|
||||||
needless_borrow::NEEDLESS_BORROW,
|
needless_borrow::NEEDLESS_BORROW,
|
||||||
ranges::RANGE_PLUS_ONE,
|
ranges::RANGE_PLUS_ONE,
|
||||||
|
unwrap::PANICKING_UNWRAP,
|
||||||
unwrap::UNNECESSARY_UNWRAP,
|
unwrap::UNNECESSARY_UNWRAP,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ fn visit_expr(&mut self, expr: &'tcx Expr) {
|
|||||||
} else {
|
} else {
|
||||||
span_lint_and_then(
|
span_lint_and_then(
|
||||||
self.cx,
|
self.cx,
|
||||||
UNNECESSARY_UNWRAP,
|
PANICKING_UNWRAP,
|
||||||
expr.span,
|
expr.span,
|
||||||
&format!("This call to `{}()` will always panic.",
|
&format!("This call to `{}()` will always panic.",
|
||||||
method_name.name),
|
method_name.name),
|
||||||
@ -181,7 +181,7 @@ fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
|
|||||||
|
|
||||||
impl<'a> LintPass for Pass {
|
impl<'a> LintPass for Pass {
|
||||||
fn get_lints(&self) -> LintArray {
|
fn get_lints(&self) -> LintArray {
|
||||||
lint_array!(UNNECESSARY_UNWRAP)
|
lint_array!(PANICKING_UNWRAP, UNNECESSARY_UNWRAP)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#![deny(unnecessary_unwrap)]
|
#![deny(panicking_unwrap, unnecessary_unwrap)]
|
||||||
#![allow(if_same_then_else)]
|
#![allow(if_same_then_else)]
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -7,10 +7,10 @@ error: You checked before that `unwrap()` cannot fail. Instead of checking and u
|
|||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: lint level defined here
|
note: lint level defined here
|
||||||
--> $DIR/checked_unwrap.rs:1:9
|
--> $DIR/checked_unwrap.rs:1:27
|
||||||
|
|
|
|
||||||
1 | #![deny(unnecessary_unwrap)]
|
1 | #![deny(panicking_unwrap, unnecessary_unwrap)]
|
||||||
| ^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: This call to `unwrap()` will always panic.
|
error: This call to `unwrap()` will always panic.
|
||||||
--> $DIR/checked_unwrap.rs:9:9
|
--> $DIR/checked_unwrap.rs:9:9
|
||||||
@ -20,6 +20,12 @@ error: This call to `unwrap()` will always panic.
|
|||||||
...
|
...
|
||||||
9 | x.unwrap(); // will panic
|
9 | x.unwrap(); // will panic
|
||||||
| ^^^^^^^^^^
|
| ^^^^^^^^^^
|
||||||
|
|
|
||||||
|
note: lint level defined here
|
||||||
|
--> $DIR/checked_unwrap.rs:1:9
|
||||||
|
|
|
||||||
|
1 | #![deny(panicking_unwrap, unnecessary_unwrap)]
|
||||||
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: This call to `unwrap()` will always panic.
|
error: This call to `unwrap()` will always panic.
|
||||||
--> $DIR/checked_unwrap.rs:12:9
|
--> $DIR/checked_unwrap.rs:12:9
|
||||||
|
Loading…
Reference in New Issue
Block a user