Fixes in various places

This commit is contained in:
Nadrieril 2024-03-20 22:51:29 +01:00
parent 7591ec4e88
commit 917ad034cc
4 changed files with 5 additions and 4 deletions

View file

@ -2931,6 +2931,7 @@ pub fn expr_use_ctxt<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'tcx>) -> ExprU
moved_before_use,
same_ctxt,
},
#[allow(unreachable_patterns)]
Some(ControlFlow::Break(_)) => unreachable!("type of node is ControlFlow<!>"),
None => ExprUseCtxt {
node: Node::Crate(cx.tcx.hir().root_module()),

View file

@ -89,7 +89,7 @@ fn main() {
// lint here
use std::convert::Infallible;
if let Ok(a) = Result::<i32, Infallible>::Ok(1) { println!("${:?}", a) } else {
if let Ok(a) = Result::<i32, &Infallible>::Ok(1) { println!("${:?}", a) } else {
println!("else block");
return;
}

View file

@ -98,7 +98,7 @@ fn main() {
// lint here
use std::convert::Infallible;
match Result::<i32, Infallible>::Ok(1) {
match Result::<i32, &Infallible>::Ok(1) {
Ok(a) => println!("${:?}", a),
Err(_) => {
println!("else block");

View file

@ -64,7 +64,7 @@ LL + }
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> tests/ui/single_match_else.rs:101:5
|
LL | / match Result::<i32, Infallible>::Ok(1) {
LL | / match Result::<i32, &Infallible>::Ok(1) {
LL | | Ok(a) => println!("${:?}", a),
LL | | Err(_) => {
LL | | println!("else block");
@ -75,7 +75,7 @@ LL | | }
|
help: try
|
LL ~ if let Ok(a) = Result::<i32, Infallible>::Ok(1) { println!("${:?}", a) } else {
LL ~ if let Ok(a) = Result::<i32, &Infallible>::Ok(1) { println!("${:?}", a) } else {
LL + println!("else block");
LL + return;
LL + }