Readability improvement in tag handling.
This commit is contained in:
parent
6b01b554e0
commit
3365ccadb6
1 changed files with 7 additions and 10 deletions
|
@ -1037,16 +1037,13 @@ impl<T: Iterator<Item = char>> Parser<T> {
|
||||||
if handle == "!!" {
|
if handle == "!!" {
|
||||||
// "!!" is a shorthand for "tag:yaml.org,2002:". However, that default can be
|
// "!!" is a shorthand for "tag:yaml.org,2002:". However, that default can be
|
||||||
// overridden.
|
// overridden.
|
||||||
match self.tags.get("!!") {
|
Ok(Tag {
|
||||||
Some(prefix) => Ok(Tag {
|
handle: self
|
||||||
handle: prefix.to_string(),
|
.tags
|
||||||
|
.get("!!")
|
||||||
|
.map_or_else(|| "tag:yaml.org,2002:".to_string(), ToString::to_string),
|
||||||
suffix,
|
suffix,
|
||||||
}),
|
})
|
||||||
None => Ok(Tag {
|
|
||||||
handle: "tag:yaml.org,2002:".to_string(),
|
|
||||||
suffix,
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
} else if handle.is_empty() && suffix == "!" {
|
} else if handle.is_empty() && suffix == "!" {
|
||||||
// "!" introduces a local tag. Local tags may have their prefix overridden.
|
// "!" introduces a local tag. Local tags may have their prefix overridden.
|
||||||
match self.tags.get("") {
|
match self.tags.get("") {
|
||||||
|
|
Loading…
Reference in a new issue