Skip to content

Commit

Permalink
Merge pull request #39 from ethangreen-dev/revert-overwrite-deprecate
Browse files Browse the repository at this point in the history
Revert pattern patch `overwrite` deprecation warning
  • Loading branch information
ethangreen-dev authored May 18, 2024
2 parents 446ef7d + c819602 commit 4b511f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 1 addition & 7 deletions crates/lovely-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
};

Expand Down
4 changes: 4 additions & 0 deletions crates/lovely-core/src/patch/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ pub struct PatternPatch {
pub payload_files: Option<Vec<String>>,
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 {
Expand Down

0 comments on commit 4b511f5

Please sign in to comment.