@@ -12,9 +12,9 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, recv: &hir::Expr
1212 let obj_ty = cx. typeck_results ( ) . expr_ty ( recv) . peel_refs ( ) ;
1313
1414 let mess = if is_type_diagnostic_item ( cx, obj_ty, sym:: Option ) {
15- Some ( ( EXPECT_USED , "an Option" , "None" ) )
15+ Some ( ( EXPECT_USED , "an Option" , "None" , "" ) )
1616 } else if is_type_diagnostic_item ( cx, obj_ty, sym:: Result ) {
17- Some ( ( EXPECT_USED , "a Result" , "Err" ) )
17+ Some ( ( EXPECT_USED , "a Result" , "Err" , "an " ) )
1818 } else {
1919 None
2020 } ;
@@ -23,14 +23,14 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, recv: &hir::Expr
2323 return ;
2424 }
2525
26- if let Some ( ( lint, kind, none_value) ) = mess {
26+ if let Some ( ( lint, kind, none_value, none_prefix ) ) = mess {
2727 span_lint_and_help (
2828 cx,
2929 lint,
3030 expr. span ,
31- & format ! ( "used `expect()` on `{}` value" , kind , ) ,
31+ & format ! ( "used `expect()` on `{kind }` value" ) ,
3232 None ,
33- & format ! ( "if this value is an `{ }`, it will panic" , none_value , ) ,
33+ & format ! ( "if this value is {none_prefix}`{none_value }`, it will panic" ) ,
3434 ) ;
3535 }
3636}
0 commit comments