229 lines
7.9 KiB
Plaintext
229 lines
7.9 KiB
Plaintext
error: redundant pattern matching, consider using `is_none()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:14:5
|
|
|
|
|
LL | matches!(maybe_some, None if !boolean)
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `maybe_some.is_none() && (!boolean)`
|
|
|
|
|
= note: `-D clippy::redundant-pattern-matching` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::redundant_pattern_matching)]`
|
|
|
|
error: redundant pattern matching, consider using `is_none()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:19:13
|
|
|
|
|
LL | let _ = matches!(maybe_some, None if boolean || boolean2); // guard needs parentheses
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `maybe_some.is_none() && (boolean || boolean2)`
|
|
|
|
error: redundant pattern matching, consider using `is_none()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:35:12
|
|
|
|
|
LL | if let None = None::<()> {}
|
|
| -------^^^^------------- help: try: `if None::<()>.is_none()`
|
|
|
|
error: redundant pattern matching, consider using `is_some()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:38:12
|
|
|
|
|
LL | if let Some(_) = Some(42) {}
|
|
| -------^^^^^^^----------- help: try: `if Some(42).is_some()`
|
|
|
|
error: redundant pattern matching, consider using `is_some()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:41:12
|
|
|
|
|
LL | if let Some(_) = Some(42) {
|
|
| -------^^^^^^^----------- help: try: `if Some(42).is_some()`
|
|
|
|
error: redundant pattern matching, consider using `is_some()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:48:15
|
|
|
|
|
LL | while let Some(_) = Some(42) {}
|
|
| ----------^^^^^^^----------- help: try: `while Some(42).is_some()`
|
|
|
|
error: redundant pattern matching, consider using `is_none()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:51:15
|
|
|
|
|
LL | while let None = Some(42) {}
|
|
| ----------^^^^----------- help: try: `while Some(42).is_none()`
|
|
|
|
error: redundant pattern matching, consider using `is_none()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:54:15
|
|
|
|
|
LL | while let None = None::<()> {}
|
|
| ----------^^^^------------- help: try: `while None::<()>.is_none()`
|
|
|
|
error: redundant pattern matching, consider using `is_some()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:58:15
|
|
|
|
|
LL | while let Some(_) = v.pop() {
|
|
| ----------^^^^^^^---------- help: try: `while v.pop().is_some()`
|
|
|
|
error: redundant pattern matching, consider using `is_some()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:67:5
|
|
|
|
|
LL | / match Some(42) {
|
|
LL | |
|
|
LL | | Some(_) => true,
|
|
LL | | None => false,
|
|
LL | | };
|
|
| |_____^ help: try: `Some(42).is_some()`
|
|
|
|
error: redundant pattern matching, consider using `is_none()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:73:5
|
|
|
|
|
LL | / match None::<()> {
|
|
LL | |
|
|
LL | | Some(_) => false,
|
|
LL | | None => true,
|
|
LL | | };
|
|
| |_____^ help: try: `None::<()>.is_none()`
|
|
|
|
error: redundant pattern matching, consider using `is_none()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:79:13
|
|
|
|
|
LL | let _ = match None::<()> {
|
|
| _____________^
|
|
LL | |
|
|
LL | | Some(_) => false,
|
|
LL | | None => true,
|
|
LL | | };
|
|
| |_____^ help: try: `None::<()>.is_none()`
|
|
|
|
error: redundant pattern matching, consider using `is_some()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:86:20
|
|
|
|
|
LL | let _ = if let Some(_) = opt { true } else { false };
|
|
| -------^^^^^^^------ help: try: `if opt.is_some()`
|
|
|
|
error: redundant pattern matching, consider using `is_some()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:93:20
|
|
|
|
|
LL | let _ = if let Some(_) = gen_opt() {
|
|
| -------^^^^^^^------------ help: try: `if gen_opt().is_some()`
|
|
|
|
error: redundant pattern matching, consider using `is_none()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:96:19
|
|
|
|
|
LL | } else if let None = gen_opt() {
|
|
| -------^^^^------------ help: try: `if gen_opt().is_none()`
|
|
|
|
error: redundant pattern matching, consider using `is_some()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:103:12
|
|
|
|
|
LL | if let Some(..) = gen_opt() {}
|
|
| -------^^^^^^^^------------ help: try: `if gen_opt().is_some()`
|
|
|
|
error: redundant pattern matching, consider using `is_some()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:119:12
|
|
|
|
|
LL | if let Some(_) = Some(42) {}
|
|
| -------^^^^^^^----------- help: try: `if Some(42).is_some()`
|
|
|
|
error: redundant pattern matching, consider using `is_none()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:122:12
|
|
|
|
|
LL | if let None = None::<()> {}
|
|
| -------^^^^------------- help: try: `if None::<()>.is_none()`
|
|
|
|
error: redundant pattern matching, consider using `is_some()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:125:15
|
|
|
|
|
LL | while let Some(_) = Some(42) {}
|
|
| ----------^^^^^^^----------- help: try: `while Some(42).is_some()`
|
|
|
|
error: redundant pattern matching, consider using `is_none()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:128:15
|
|
|
|
|
LL | while let None = None::<()> {}
|
|
| ----------^^^^------------- help: try: `while None::<()>.is_none()`
|
|
|
|
error: redundant pattern matching, consider using `is_some()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:131:5
|
|
|
|
|
LL | / match Some(42) {
|
|
LL | |
|
|
LL | | Some(_) => true,
|
|
LL | | None => false,
|
|
LL | | };
|
|
| |_____^ help: try: `Some(42).is_some()`
|
|
|
|
error: redundant pattern matching, consider using `is_none()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:137:5
|
|
|
|
|
LL | / match None::<()> {
|
|
LL | |
|
|
LL | | Some(_) => false,
|
|
LL | | None => true,
|
|
LL | | };
|
|
| |_____^ help: try: `None::<()>.is_none()`
|
|
|
|
error: redundant pattern matching, consider using `is_none()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:146:12
|
|
|
|
|
LL | if let None = *(&None::<()>) {}
|
|
| -------^^^^----------------- help: try: `if (&None::<()>).is_none()`
|
|
|
|
error: redundant pattern matching, consider using `is_none()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:148:12
|
|
|
|
|
LL | if let None = *&None::<()> {}
|
|
| -------^^^^--------------- help: try: `if (&None::<()>).is_none()`
|
|
|
|
error: redundant pattern matching, consider using `is_some()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:155:5
|
|
|
|
|
LL | / match x {
|
|
LL | |
|
|
LL | | Some(_) => true,
|
|
LL | | _ => false,
|
|
LL | | };
|
|
| |_____^ help: try: `x.is_some()`
|
|
|
|
error: redundant pattern matching, consider using `is_none()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:161:5
|
|
|
|
|
LL | / match x {
|
|
LL | |
|
|
LL | | None => true,
|
|
LL | | _ => false,
|
|
LL | | };
|
|
| |_____^ help: try: `x.is_none()`
|
|
|
|
error: redundant pattern matching, consider using `is_none()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:167:5
|
|
|
|
|
LL | / match x {
|
|
LL | |
|
|
LL | | Some(_) => false,
|
|
LL | | _ => true,
|
|
LL | | };
|
|
| |_____^ help: try: `x.is_none()`
|
|
|
|
error: redundant pattern matching, consider using `is_some()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:173:5
|
|
|
|
|
LL | / match x {
|
|
LL | |
|
|
LL | | None => false,
|
|
LL | | _ => true,
|
|
LL | | };
|
|
| |_____^ help: try: `x.is_some()`
|
|
|
|
error: redundant pattern matching, consider using `is_some()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:189:13
|
|
|
|
|
LL | let _ = matches!(x, Some(_));
|
|
| ^^^^^^^^^^^^^^^^^^^^ help: try: `x.is_some()`
|
|
|
|
error: redundant pattern matching, consider using `is_none()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:192:13
|
|
|
|
|
LL | let _ = matches!(x, None);
|
|
| ^^^^^^^^^^^^^^^^^ help: try: `x.is_none()`
|
|
|
|
error: redundant pattern matching, consider using `is_none()`
|
|
--> tests/ui/redundant_pattern_matching_option.rs:203:17
|
|
|
|
|
LL | let _ = matches!(*p, None);
|
|
| ^^^^^^^^^^^^^^^^^^ help: try: `(*p).is_none()`
|
|
|
|
error: aborting due to 31 previous errors
|
|
|