Ignore single_match_else pedantic clippy lint in serde_derive_internals

error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
        --> serde_derive_internals/src/attr.rs:1412:8
         |
    1412 |       Ok(match string.parse() {
         |  ________^
    1413 | |         Ok(path) => Some(path),
    1414 | |         Err(_) => {
    1415 | |             cx.error_spanned_by(
    ...    |
    1420 | |         }
    1421 | |     })
         | |_____^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match_else
         = note: `-D clippy::single-match-else` implied by `-D clippy::pedantic`
    help: try this
         |
    1412 ~     Ok(if let Ok(path) = string.parse() { Some(path) } else {
    1413 +         cx.error_spanned_by(
    1414 +             &string,
    1415 +             format!("failed to parse path: {:?}", string.value()),
    1416 +         );
    1417 +         None
    1418 ~     })
         |

    error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
        --> serde_derive_internals/src/attr.rs:1434:8
         |
    1434 |       Ok(match string.parse() {
         |  ________^
    1435 | |         Ok(expr) => Some(expr),
    1436 | |         Err(_) => {
    1437 | |             cx.error_spanned_by(
    ...    |
    1442 | |         }
    1443 | |     })
         | |_____^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match_else
    help: try this
         |
    1434 ~     Ok(if let Ok(expr) = string.parse() { Some(expr) } else {
    1435 +         cx.error_spanned_by(
    1436 +             &string,
    1437 +             format!("failed to parse path: {:?}", string.value()),
    1438 +         );
    1439 +         None
    1440 ~     })
         |

    error: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
        --> serde_derive_internals/src/attr.rs:1478:8
         |
    1478 |       Ok(match string.parse() {
         |  ________^
    1479 | |         Ok(ty) => Some(ty),
    1480 | |         Err(_) => {
    1481 | |             cx.error_spanned_by(
    ...    |
    1486 | |         }
    1487 | |     })
         | |_____^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match_else
    help: try this
         |
    1478 ~     Ok(if let Ok(ty) = string.parse() { Some(ty) } else {
    1479 +         cx.error_spanned_by(
    1480 +             &string,
    1481 +             format!("failed to parse type: {} = {:?}", attr_name, string.value()),
    1482 +         );
    1483 +         None
    1484 ~     })
         |
This commit is contained in:
David Tolnay 2023-03-17 17:31:16 -07:00
parent 9fc0d13e2c
commit 5b8e0657d4
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -31,6 +31,7 @@
clippy::module_name_repetitions,
clippy::must_use_candidate,
clippy::similar_names,
clippy::single_match_else,
clippy::struct_excessive_bools,
clippy::too_many_lines,
clippy::unused_self,