diff options
| author | Alex Macleod <alex@macleod.io> | 2023-11-02 19:23:36 +0000 |
|---|---|---|
| committer | Alex Macleod <alex@macleod.io> | 2023-11-10 18:03:13 +0000 |
| commit | 13b4bb12ad6ef84dea53c5a2547473b3d4ab93e3 (patch) | |
| tree | 341af039a28f94e7a75763ba7216bdafda142ff0 /clippy_lints/src/inconsistent_struct_constructor.rs | |
| parent | 9681b4afe09600c175c951705f0a69a51ac30ac8 (diff) | |
Clean up after if chain removal
Diffstat (limited to 'clippy_lints/src/inconsistent_struct_constructor.rs')
| -rw-r--r-- | clippy_lints/src/inconsistent_struct_constructor.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/clippy_lints/src/inconsistent_struct_constructor.rs b/clippy_lints/src/inconsistent_struct_constructor.rs index 14842800b57..f6e1281a291 100644 --- a/clippy_lints/src/inconsistent_struct_constructor.rs +++ b/clippy_lints/src/inconsistent_struct_constructor.rs @@ -1,6 +1,5 @@ use clippy_utils::diagnostics::span_lint_and_sugg; use clippy_utils::source::snippet; -use if_chain::if_chain; use rustc_data_structures::fx::FxHashMap; use rustc_errors::Applicability; use rustc_hir::{self as hir, ExprKind}; @@ -94,14 +93,15 @@ impl<'tcx> LateLintPass<'tcx> for InconsistentStructConstructor { fields_snippet.push_str(&last_ident.to_string()); let base_snippet = if let Some(base) = base { - format!(", ..{}", snippet(cx, base.span, "..")) - } else { - String::new() - }; + format!(", ..{}", snippet(cx, base.span, "..")) + } else { + String::new() + }; - let sugg = format!("{} {{ {fields_snippet}{base_snippet} }}", + let sugg = format!( + "{} {{ {fields_snippet}{base_snippet} }}", snippet(cx, qpath.span(), ".."), - ); + ); span_lint_and_sugg( cx, @@ -111,7 +111,7 @@ impl<'tcx> LateLintPass<'tcx> for InconsistentStructConstructor { "try", sugg, Applicability::MachineApplicable, - ) + ); } } } |
