diff options
| author | Nicholas Nethercote <nnethercote@mozilla.com> | 2020-02-05 14:33:08 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2020-02-06 16:42:58 +1100 |
| commit | f840a955bd449810e75d8320b4c46482d6dbdec1 (patch) | |
| tree | ed8eeda6f3af723c4c335811736d9f06d828e758 /src/librustc_parse/parser/module.rs | |
| parent | 6bf2cc2229768faa8e86e0e8a9f5bd8ebfc817a2 (diff) | |
Remove the `Cow` from `Directory`.
The previous commit wrapped `Parser` within a `Cow` for the hot macro parsing path. As a result, there's no need for the `Cow` within `Directory`, because it lies within `Parser`.
Diffstat (limited to 'src/librustc_parse/parser/module.rs')
| -rw-r--r-- | src/librustc_parse/parser/module.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/librustc_parse/parser/module.rs b/src/librustc_parse/parser/module.rs index 6ce94d3c679..0c8fad03d86 100644 --- a/src/librustc_parse/parser/module.rs +++ b/src/librustc_parse/parser/module.rs @@ -285,7 +285,7 @@ impl<'a> Parser<'a> { fn push_directory(&mut self, id: Ident, attrs: &[Attribute]) { if let Some(path) = attr::first_attr_value_str_by_name(attrs, sym::path) { - self.directory.path.to_mut().push(&*path.as_str()); + self.directory.path.push(&*path.as_str()); self.directory.ownership = DirectoryOwnership::Owned { relative: None }; } else { // We have to push on the current module name in the case of relative @@ -297,10 +297,10 @@ impl<'a> Parser<'a> { if let DirectoryOwnership::Owned { relative } = &mut self.directory.ownership { if let Some(ident) = relative.take() { // remove the relative offset - self.directory.path.to_mut().push(&*ident.as_str()); + self.directory.path.push(&*ident.as_str()); } } - self.directory.path.to_mut().push(&*id.as_str()); + self.directory.path.push(&*id.as_str()); } } } |
