@@ -174,7 +174,7 @@ declare_clippy_lint! {
174
174
175
175
declare_clippy_lint ! {
176
176
/// ### What it does
177
- /// Checks for `.unwrap()` calls on `Option `s and on `Result `s.
177
+ /// Checks for `.unwrap()` or `.unwrap_err()` calls on `Result `s and `.unwrap()` call on `Option `s.
178
178
///
179
179
/// ### Why is this bad?
180
180
/// It is better to handle the `None` or `Err` case,
@@ -224,7 +224,7 @@ declare_clippy_lint! {
224
224
225
225
declare_clippy_lint ! {
226
226
/// ### What it does
227
- /// Checks for `.expect()` calls on `Option `s and `Result `s.
227
+ /// Checks for `.expect()` or `.expect_err()` calls on `Result `s and `.expect()` call on `Option `s.
228
228
///
229
229
/// ### Why is this bad?
230
230
/// Usually it is better to handle the `None` or `Err` case.
@@ -2740,8 +2740,9 @@ impl Methods {
2740
2740
( "expect" , [ _] ) => match method_call ( recv) {
2741
2741
Some ( ( "ok" , [ recv] , _) ) => ok_expect:: check ( cx, expr, recv) ,
2742
2742
Some ( ( "err" , [ recv] , err_span) ) => err_expect:: check ( cx, expr, recv, self . msrv , span, err_span) ,
2743
- _ => expect_used:: check ( cx, expr, recv, self . allow_expect_in_tests ) ,
2743
+ _ => expect_used:: check ( cx, expr, recv, false , self . allow_expect_in_tests ) ,
2744
2744
} ,
2745
+ ( "expect_err" , [ _] ) => expect_used:: check ( cx, expr, recv, true , self . allow_expect_in_tests ) ,
2745
2746
( "extend" , [ arg] ) => {
2746
2747
string_extend_chars:: check ( cx, expr, recv, arg) ;
2747
2748
extend_with_drain:: check ( cx, expr, recv, arg) ;
@@ -2874,8 +2875,9 @@ impl Methods {
2874
2875
} ,
2875
2876
_ => { } ,
2876
2877
}
2877
- unwrap_used:: check ( cx, expr, recv, self . allow_unwrap_in_tests ) ;
2878
+ unwrap_used:: check ( cx, expr, recv, false , self . allow_unwrap_in_tests ) ;
2878
2879
} ,
2880
+ ( "unwrap_err" , [ ] ) => unwrap_used:: check ( cx, expr, recv, true , self . allow_unwrap_in_tests ) ,
2879
2881
( "unwrap_or" , [ u_arg] ) => match method_call ( recv) {
2880
2882
Some ( ( arith @ ( "checked_add" | "checked_sub" | "checked_mul" ) , [ lhs, rhs] , _) ) => {
2881
2883
manual_saturating_arithmetic:: check ( cx, expr, lhs, rhs, u_arg, & arith[ "checked_" . len ( ) ..] ) ;
0 commit comments