From c81960245e3832704243c5855e892dce02306a92 Mon Sep 17 00:00:00 2001 From: Ethan Green Date: Sat, 18 May 2024 12:58:40 -0400 Subject: [PATCH] revert pattern patch `overwrite` deprecation warning --- crates/lovely-core/src/lib.rs | 8 +------- crates/lovely-core/src/patch/pattern.rs | 4 ++++ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/crates/lovely-core/src/lib.rs b/crates/lovely-core/src/lib.rs index d92f755..91f6d1c 100644 --- a/crates/lovely-core/src/lib.rs +++ b/crates/lovely-core/src/lib.rs @@ -258,14 +258,8 @@ impl PatchTable { let str = fs::read_to_string(&patch_file) .unwrap_or_else(|e| panic!("Failed to read patch file at {patch_file:?}:\n{e:?}")); + // Handle invalid fields in a non-explosive way. let ignored_key_callback = |key: serde_ignored::Path| { - // get the last component of the key, which looks something like patches.0.overwrite - if let serde_ignored::Path::Map { parent: _, key: ref key_last_component } = key - { - if key_last_component == "overwrite" { - warn!("The key `overwrite` is deprecated. To perform replacement use `position = \"at\"`."); - } - } warn!("Unknown key `{key}` found in patch file at {patch_file:?}, ignoring it"); }; diff --git a/crates/lovely-core/src/patch/pattern.rs b/crates/lovely-core/src/patch/pattern.rs index f95545b..5a280df 100644 --- a/crates/lovely-core/src/patch/pattern.rs +++ b/crates/lovely-core/src/patch/pattern.rs @@ -18,6 +18,10 @@ pub struct PatternPatch { pub payload_files: Option>, pub payload: String, pub match_indent: bool, + + /// We keep this field around for legacy compat. It doesn't do anything (and never has). + #[serde(default)] + pub overwrite: bool, } impl PatternPatch {