correct lint case
This commit is contained in:
parent
57dd25e2ff
commit
f58950de86
@ -104,3 +104,21 @@ fn issue11982() {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn issue11982_no_conversion() {
|
||||
mod bar {
|
||||
pub struct Error;
|
||||
pub fn foo(_: bool) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn foo(ok: bool) -> Result<(), bar::Error> {
|
||||
if !ok {
|
||||
bar::foo(ok).map(|_| Ok::<(), bar::Error>(()))?;
|
||||
//~^ ERROR: unneeded `return` statement with `?` operator
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -104,3 +104,20 @@ fn issue11982() {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn issue11982_no_conversion() {
|
||||
mod bar {
|
||||
pub struct Error;
|
||||
pub fn foo(_: bool) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn foo(ok: bool) -> Result<(), bar::Error> {
|
||||
if !ok {
|
||||
return bar::foo(ok).map(|_| Ok::<(), bar::Error>(()))?;
|
||||
//~^ ERROR: unneeded `return` statement with `?` operator
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -13,5 +13,11 @@ error: unneeded `return` statement with `?` operator
|
||||
LL | return Err(())?;
|
||||
| ^^^^^^^ help: remove it
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: unneeded `return` statement with `?` operator
|
||||
--> $DIR/needless_return_with_question_mark.rs:118:13
|
||||
|
|
||||
LL | return bar::foo(ok).map(|_| Ok::<(), bar::Error>(()))?;
|
||||
| ^^^^^^^ help: remove it
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user