1
Fork 0

Emit warnings for unused fields in custom targets.

This commit is contained in:
Adam Bratschi-Kaye 2021-05-27 10:21:53 +02:00
parent 0ef2b4a29b
commit 88b01f1178
7 changed files with 235 additions and 91 deletions

View file

@ -1114,6 +1114,15 @@ impl Json {
}
}
/// If the Json value is an Object, deletes the value associated with the
/// provided key from the Object and returns it. Otherwise, returns None.
pub fn remove_key(&mut self, key: &str) -> Option<Json> {
match *self {
Json::Object(ref mut map) => map.remove(key),
_ => None,
}
}
/// Attempts to get a nested Json Object for each key in `keys`.
/// If any key is found not to exist, `find_path` will return `None`.
/// Otherwise, it will return the Json value associated with the final key.