Skip to content

Commit

Permalink
Fixes in various places
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadrieril committed Mar 20, 2024
1 parent 3a7fd6c commit ca10919
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 4 deletions.
Expand Up @@ -578,6 +578,7 @@ pub enum E2<X> {
V4,
}

#[allow(unreachable_patterns)]
fn check_niche_behavior() {
if let E1::V2 { .. } = (E1::V1 { f: true }) {
intrinsics::abort();
Expand Down
Expand Up @@ -432,6 +432,7 @@ pub enum E2<X> {
V4,
}

#[allow(unreachable_patterns)]
fn check_niche_behavior () {
if let E1::V2 { .. } = (E1::V1 { f: true }) {
intrinsics::abort();
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/tests/ui/single_match_else.fixed
Expand Up @@ -90,7 +90,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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/tests/ui/single_match_else.rs
Expand Up @@ -99,7 +99,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");
Expand Down
4 changes: 2 additions & 2 deletions src/tools/clippy/tests/ui/single_match_else.stderr
Expand Up @@ -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:102: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");
Expand All @@ -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 + }
Expand Down
1 change: 1 addition & 0 deletions src/tools/miri/src/eval.rs
Expand Up @@ -441,6 +441,7 @@ pub fn eval_entry<'tcx>(
let res = match res {
Err(res) => res,
// `Ok` can never happen
#[cfg(bootstrap)]
Ok(never) => match never {},
};

Expand Down
1 change: 1 addition & 0 deletions src/tools/miri/tests/pass/enums.rs
Expand Up @@ -43,6 +43,7 @@ fn discriminant_overflow() {
}
}

#[allow(unreachable_patterns)]
fn more_discriminant_overflow() {
pub enum Infallible {}

Expand Down

0 comments on commit ca10919

Please sign in to comment.