Skip to content

Commit 917ad03

Browse files
committed
Fixes in various places
1 parent 7591ec4 commit 917ad03

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

clippy_utils/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2931,6 +2931,7 @@ pub fn expr_use_ctxt<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'tcx>) -> ExprU
29312931
moved_before_use,
29322932
same_ctxt,
29332933
},
2934+
#[allow(unreachable_patterns)]
29342935
Some(ControlFlow::Break(_)) => unreachable!("type of node is ControlFlow<!>"),
29352936
None => ExprUseCtxt {
29362937
node: Node::Crate(cx.tcx.hir().root_module()),

tests/ui/single_match_else.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ fn main() {
8989

9090
// lint here
9191
use std::convert::Infallible;
92-
if let Ok(a) = Result::<i32, Infallible>::Ok(1) { println!("${:?}", a) } else {
92+
if let Ok(a) = Result::<i32, &Infallible>::Ok(1) { println!("${:?}", a) } else {
9393
println!("else block");
9494
return;
9595
}

tests/ui/single_match_else.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ fn main() {
9898

9999
// lint here
100100
use std::convert::Infallible;
101-
match Result::<i32, Infallible>::Ok(1) {
101+
match Result::<i32, &Infallible>::Ok(1) {
102102
Ok(a) => println!("${:?}", a),
103103
Err(_) => {
104104
println!("else block");

tests/ui/single_match_else.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ LL + }
6464
error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
6565
--> tests/ui/single_match_else.rs:101:5
6666
|
67-
LL | / match Result::<i32, Infallible>::Ok(1) {
67+
LL | / match Result::<i32, &Infallible>::Ok(1) {
6868
LL | | Ok(a) => println!("${:?}", a),
6969
LL | | Err(_) => {
7070
LL | | println!("else block");
@@ -75,7 +75,7 @@ LL | | }
7575
|
7676
help: try
7777
|
78-
LL ~ if let Ok(a) = Result::<i32, Infallible>::Ok(1) { println!("${:?}", a) } else {
78+
LL ~ if let Ok(a) = Result::<i32, &Infallible>::Ok(1) { println!("${:?}", a) } else {
7979
LL + println!("else block");
8080
LL + return;
8181
LL + }

0 commit comments

Comments
 (0)