Remove Action::Remove

You can just use an empty string in replace instead
This commit is contained in:
Harsh Shandilya 2021-11-12 10:05:34 +05:30
parent 3fd078e51b
commit 9cbf540e5e
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80

View file

@ -58,8 +58,6 @@ pub enum Action {
Prefix { prefix: String },
#[serde(rename = "suffix")]
Suffix { suffix: String },
#[serde(rename = "remove")]
Remove { substring: String },
}
impl Act for Action {
@ -68,7 +66,6 @@ impl Act for Action {
Action::Replace { from, to } => input.replace(&from, &to),
Action::Prefix { prefix } => format!("{}{}", prefix, input),
Action::Suffix { suffix } => format!("{}{}", input, suffix),
Action::Remove { substring } => input.replace(&substring, ""),
};
}
}