mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 05:03:21 +00:00
Fixes in various places
This commit is contained in:
parent
7591ec4e88
commit
917ad034cc
4 changed files with 5 additions and 4 deletions
|
@ -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()),
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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 + }
|
||||
|
|
Loading…
Reference in a new issue