From 5b8e0657d452e2895f63d603a7d7b2b93b3febd1 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 17 Mar 2023 17:31:16 -0700 Subject: [PATCH] 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 ~ }) | --- serde_derive_internals/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/serde_derive_internals/lib.rs b/serde_derive_internals/lib.rs index 3bba7b4f8..3fa0bf732 100644 --- a/serde_derive_internals/lib.rs +++ b/serde_derive_internals/lib.rs @@ -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,