rust/tests/ui/redundant_pattern_matching_option.stderr

213 lines
7.4 KiB
Plaintext
Raw Normal View History

error: redundant pattern matching, consider using `is_none()`
--> $DIR/redundant_pattern_matching_option.rs:16: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`
error: redundant pattern matching, consider using `is_none()`
--> $DIR/redundant_pattern_matching_option.rs:20: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()`
--> $DIR/redundant_pattern_matching_option.rs:29:12
|
LL | if let None = None::<()> {}
| -------^^^^------------- help: try: `if None::<()>.is_none()`
error: redundant pattern matching, consider using `is_some()`
--> $DIR/redundant_pattern_matching_option.rs:31:12
|
LL | if let Some(_) = Some(42) {}
2023-07-01 06:08:01 -05:00
| -------^^^^^^^----------- help: try: `if Some(42).is_some()`
error: redundant pattern matching, consider using `is_some()`
--> $DIR/redundant_pattern_matching_option.rs:33:12
|
LL | if let Some(_) = Some(42) {
2023-07-01 06:08:01 -05:00
| -------^^^^^^^----------- help: try: `if Some(42).is_some()`
error: redundant pattern matching, consider using `is_some()`
--> $DIR/redundant_pattern_matching_option.rs:39:15
|
LL | while let Some(_) = Some(42) {}
2023-07-01 06:08:01 -05:00
| ----------^^^^^^^----------- help: try: `while Some(42).is_some()`
error: redundant pattern matching, consider using `is_none()`
--> $DIR/redundant_pattern_matching_option.rs:41:15
|
LL | while let None = Some(42) {}
2023-07-01 06:08:01 -05:00
| ----------^^^^----------- help: try: `while Some(42).is_none()`
error: redundant pattern matching, consider using `is_none()`
--> $DIR/redundant_pattern_matching_option.rs:43:15
|
LL | while let None = None::<()> {}
2023-07-01 06:08:01 -05:00
| ----------^^^^------------- help: try: `while None::<()>.is_none()`
error: redundant pattern matching, consider using `is_some()`
--> $DIR/redundant_pattern_matching_option.rs:46:15
|
LL | while let Some(_) = v.pop() {
2023-07-01 06:08:01 -05:00
| ----------^^^^^^^---------- help: try: `while v.pop().is_some()`
error: redundant pattern matching, consider using `is_some()`
--> $DIR/redundant_pattern_matching_option.rs:54:5
|
LL | / match Some(42) {
LL | | Some(_) => true,
LL | | None => false,
LL | | };
2023-07-01 06:08:01 -05:00
| |_____^ help: try: `Some(42).is_some()`
error: redundant pattern matching, consider using `is_none()`
--> $DIR/redundant_pattern_matching_option.rs:59:5
|
LL | / match None::<()> {
LL | | Some(_) => false,
LL | | None => true,
LL | | };
2023-07-01 06:08:01 -05:00
| |_____^ help: try: `None::<()>.is_none()`
error: redundant pattern matching, consider using `is_none()`
--> $DIR/redundant_pattern_matching_option.rs:64:13
|
LL | let _ = match None::<()> {
| _____________^
LL | | Some(_) => false,
LL | | None => true,
LL | | };
2023-07-01 06:08:01 -05:00
| |_____^ help: try: `None::<()>.is_none()`
error: redundant pattern matching, consider using `is_some()`
--> $DIR/redundant_pattern_matching_option.rs:70:20
|
LL | let _ = if let Some(_) = opt { true } else { false };
2023-07-01 06:08:01 -05:00
| -------^^^^^^^------ help: try: `if opt.is_some()`
error: redundant pattern matching, consider using `is_some()`
--> $DIR/redundant_pattern_matching_option.rs:76:20
|
LL | let _ = if let Some(_) = gen_opt() {
2023-07-01 06:08:01 -05:00
| -------^^^^^^^------------ help: try: `if gen_opt().is_some()`
error: redundant pattern matching, consider using `is_none()`
--> $DIR/redundant_pattern_matching_option.rs:78:19
|
LL | } else if let None = gen_opt() {
2023-07-01 06:08:01 -05:00
| -------^^^^------------ help: try: `if gen_opt().is_none()`
error: redundant pattern matching, consider using `is_some()`
--> $DIR/redundant_pattern_matching_option.rs:84:12
|
LL | if let Some(..) = gen_opt() {}
2023-07-01 06:08:01 -05:00
| -------^^^^^^^^------------ help: try: `if gen_opt().is_some()`
error: redundant pattern matching, consider using `is_some()`
--> $DIR/redundant_pattern_matching_option.rs:99:12
|
LL | if let Some(_) = Some(42) {}
2023-07-01 06:08:01 -05:00
| -------^^^^^^^----------- help: try: `if Some(42).is_some()`
error: redundant pattern matching, consider using `is_none()`
--> $DIR/redundant_pattern_matching_option.rs:101:12
|
LL | if let None = None::<()> {}
2023-07-01 06:08:01 -05:00
| -------^^^^------------- help: try: `if None::<()>.is_none()`
error: redundant pattern matching, consider using `is_some()`
--> $DIR/redundant_pattern_matching_option.rs:103:15
|
LL | while let Some(_) = Some(42) {}
2023-07-01 06:08:01 -05:00
| ----------^^^^^^^----------- help: try: `while Some(42).is_some()`
error: redundant pattern matching, consider using `is_none()`
--> $DIR/redundant_pattern_matching_option.rs:105:15
|
LL | while let None = None::<()> {}
2023-07-01 06:08:01 -05:00
| ----------^^^^------------- help: try: `while None::<()>.is_none()`
error: redundant pattern matching, consider using `is_some()`
--> $DIR/redundant_pattern_matching_option.rs:107:5
|
LL | / match Some(42) {
LL | | Some(_) => true,
LL | | None => false,
LL | | };
2023-07-01 06:08:01 -05:00
| |_____^ help: try: `Some(42).is_some()`
error: redundant pattern matching, consider using `is_none()`
--> $DIR/redundant_pattern_matching_option.rs:112:5
|
LL | / match None::<()> {
LL | | Some(_) => false,
LL | | None => true,
LL | | };
2023-07-01 06:08:01 -05:00
| |_____^ help: try: `None::<()>.is_none()`
error: redundant pattern matching, consider using `is_none()`
--> $DIR/redundant_pattern_matching_option.rs:120:12
|
LL | if let None = *(&None::<()>) {}
2023-07-01 06:08:01 -05:00
| -------^^^^----------------- help: try: `if (&None::<()>).is_none()`
error: redundant pattern matching, consider using `is_none()`
--> $DIR/redundant_pattern_matching_option.rs:121:12
|
LL | if let None = *&None::<()> {}
2023-07-01 06:08:01 -05:00
| -------^^^^--------------- help: try: `if (&None::<()>).is_none()`
2023-05-05 14:33:16 -05:00
error: redundant pattern matching, consider using `is_some()`
--> $DIR/redundant_pattern_matching_option.rs:127:5
2023-05-05 14:33:16 -05:00
|
2023-05-11 00:20:02 -05:00
LL | / match x {
2023-05-05 14:33:16 -05:00
LL | | Some(_) => true,
LL | | _ => false,
LL | | };
2023-07-01 06:08:01 -05:00
| |_____^ help: try: `x.is_some()`
2023-05-05 14:33:16 -05:00
error: redundant pattern matching, consider using `is_none()`
--> $DIR/redundant_pattern_matching_option.rs:132:5
2023-05-05 14:33:16 -05:00
|
2023-05-11 00:20:02 -05:00
LL | / match x {
2023-05-05 14:33:16 -05:00
LL | | None => true,
LL | | _ => false,
LL | | };
2023-07-01 06:08:01 -05:00
| |_____^ help: try: `x.is_none()`
2023-05-05 14:33:16 -05:00
2023-05-15 12:43:22 -05:00
error: redundant pattern matching, consider using `is_none()`
--> $DIR/redundant_pattern_matching_option.rs:137:5
2023-05-05 14:33:16 -05:00
|
2023-05-15 12:43:22 -05:00
LL | / match x {
LL | | Some(_) => false,
LL | | _ => true,
2023-05-05 14:33:16 -05:00
LL | | };
2023-07-01 06:08:01 -05:00
| |_____^ help: try: `x.is_none()`
2023-05-05 14:33:16 -05:00
2023-05-15 12:43:22 -05:00
error: redundant pattern matching, consider using `is_some()`
--> $DIR/redundant_pattern_matching_option.rs:142:5
2023-05-05 14:33:16 -05:00
|
2023-05-15 12:43:22 -05:00
LL | / match x {
LL | | None => false,
LL | | _ => true,
2023-05-05 14:33:16 -05:00
LL | | };
2023-07-01 06:08:01 -05:00
| |_____^ help: try: `x.is_some()`
2023-05-05 14:33:16 -05:00
2023-05-25 23:16:39 -05:00
error: redundant pattern matching, consider using `is_some()`
--> $DIR/redundant_pattern_matching_option.rs:157:13
2023-05-25 23:16:39 -05:00
|
LL | let _ = matches!(x, Some(_));
2023-07-01 06:08:01 -05:00
| ^^^^^^^^^^^^^^^^^^^^ help: try: `x.is_some()`
2023-05-25 23:16:39 -05:00
error: redundant pattern matching, consider using `is_none()`
--> $DIR/redundant_pattern_matching_option.rs:159:13
2023-05-25 23:16:39 -05:00
|
LL | let _ = matches!(x, None);
2023-07-01 06:08:01 -05:00
| ^^^^^^^^^^^^^^^^^ help: try: `x.is_none()`
2023-05-25 23:16:39 -05:00
error: aborting due to 30 previous errors