Optout rustfix test
This commit is contained in:
parent
ebdd4e2c72
commit
6a62390c86
@ -1,73 +0,0 @@
|
||||
// run-rustfix
|
||||
|
||||
#![warn(clippy::unnecessary_wrap)]
|
||||
#![allow(clippy::no_effect)]
|
||||
#![allow(clippy::needless_return)]
|
||||
#![allow(clippy::if_same_then_else)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
// should be linted
|
||||
fn func1(a: bool, b: bool) -> Option<i32> {
|
||||
if a && b {
|
||||
return Some(42);
|
||||
}
|
||||
if a {
|
||||
Some(-1);
|
||||
Some(2)
|
||||
} else {
|
||||
return Some(1337);
|
||||
}
|
||||
}
|
||||
|
||||
// public fns should not be linted
|
||||
pub fn func2(a: bool) -> Option<i32> {
|
||||
if a {
|
||||
Some(1)
|
||||
} else {
|
||||
Some(1)
|
||||
}
|
||||
}
|
||||
|
||||
// should not be linted
|
||||
fn func3(a: bool) -> Option<i32> {
|
||||
if a {
|
||||
Some(1)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
// should be linted
|
||||
fn func4() -> Option<i32> {
|
||||
Some(1)
|
||||
}
|
||||
|
||||
// should not be linted
|
||||
fn func5() -> Option<i32> {
|
||||
None
|
||||
}
|
||||
|
||||
// should be linted
|
||||
fn func6() -> Result<i32, ()> {
|
||||
Ok(1)
|
||||
}
|
||||
|
||||
// should not be linted
|
||||
fn func7(a: bool) -> Result<i32, ()> {
|
||||
if a {
|
||||
Ok(1)
|
||||
} else {
|
||||
Err(())
|
||||
}
|
||||
}
|
||||
|
||||
// should not be linted
|
||||
fn func8(a: bool) -> Result<i32, ()> {
|
||||
Err(())
|
||||
}
|
||||
|
||||
fn main() {
|
||||
// method calls are not linted
|
||||
func1(true, true);
|
||||
func2(true);
|
||||
}
|
@ -1,5 +1,3 @@
|
||||
// run-rustfix
|
||||
|
||||
#![warn(clippy::unnecessary_wrap)]
|
||||
#![allow(clippy::no_effect)]
|
||||
#![allow(clippy::needless_return)]
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: this function returns unnecessarily wrapping data
|
||||
--> $DIR/unnecessary_wrap.rs:10:1
|
||||
--> $DIR/unnecessary_wrap.rs:8:1
|
||||
|
|
||||
LL | / fn func1(a: bool, b: bool) -> Option<i32> {
|
||||
LL | | if a && b {
|
||||
@ -22,7 +22,7 @@ LL | Some(-1);
|
||||
...
|
||||
|
||||
error: this function returns unnecessarily wrapping data
|
||||
--> $DIR/unnecessary_wrap.rs:41:1
|
||||
--> $DIR/unnecessary_wrap.rs:39:1
|
||||
|
|
||||
LL | / fn func4() -> Option<i32> {
|
||||
LL | | Some(1)
|
||||
@ -36,7 +36,7 @@ LL | 1
|
||||
|
|
||||
|
||||
error: this function returns unnecessarily wrapping data
|
||||
--> $DIR/unnecessary_wrap.rs:51:1
|
||||
--> $DIR/unnecessary_wrap.rs:49:1
|
||||
|
|
||||
LL | / fn func6() -> Result<i32, ()> {
|
||||
LL | | Ok(1)
|
||||
|
Loading…
Reference in New Issue
Block a user