@@ -174,7 +174,7 @@ declare_clippy_lint! {
174174
175175declare_clippy_lint ! {
176176 /// ### 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.
178178 ///
179179 /// ### Why is this bad?
180180 /// It is better to handle the `None` or `Err` case,
@@ -224,7 +224,7 @@ declare_clippy_lint! {
224224
225225declare_clippy_lint ! {
226226 /// ### 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.
228228 ///
229229 /// ### Why is this bad?
230230 /// Usually it is better to handle the `None` or `Err` case.
@@ -2740,8 +2740,9 @@ impl Methods {
27402740 ( "expect" , [ _] ) => match method_call ( recv) {
27412741 Some ( ( "ok" , [ recv] , _) ) => ok_expect:: check ( cx, expr, recv) ,
27422742 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 ) ,
27442744 } ,
2745+ ( "expect_err" , [ _] ) => expect_used:: check ( cx, expr, recv, true , self . allow_expect_in_tests ) ,
27452746 ( "extend" , [ arg] ) => {
27462747 string_extend_chars:: check ( cx, expr, recv, arg) ;
27472748 extend_with_drain:: check ( cx, expr, recv, arg) ;
@@ -2874,8 +2875,9 @@ impl Methods {
28742875 } ,
28752876 _ => { } ,
28762877 }
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 ) ;
28782879 } ,
2880+ ( "unwrap_err" , [ ] ) => unwrap_used:: check ( cx, expr, recv, true , self . allow_unwrap_in_tests ) ,
28792881 ( "unwrap_or" , [ u_arg] ) => match method_call ( recv) {
28802882 Some ( ( arith @ ( "checked_add" | "checked_sub" | "checked_mul" ) , [ lhs, rhs] , _) ) => {
28812883 manual_saturating_arithmetic:: check ( cx, expr, lhs, rhs, u_arg, & arith[ "checked_" . len ( ) ..] ) ;
0 commit comments