Skip to content

Commit

Permalink
refactor: update SymbolStr dereferencing
Browse files Browse the repository at this point in the history
AFAICT these changes are required based on the changes `LocalInternedString` and `SymbolStr` in
rust-lang/rust#65776
  • Loading branch information
calebcartwright committed Jan 15, 2020
1 parent 73adbd3 commit a34d9b1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions rustfmt-core/rustfmt-lib/src/modules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ impl<'ast, 'sess, 'c> ModResolver<'ast, 'sess> {
} else {
// An internal module (`mod foo { /* ... */ }`);
if let Some(path) = find_path_value(&item.attrs) {
let path = Path::new(&path.as_str()).to_path_buf();
let path = Path::new(&*path.as_str()).to_path_buf();
Ok(Some(SubModKind::InternalWithPath(path)))
} else {
Ok(Some(SubModKind::Internal(item)))
Expand Down Expand Up @@ -288,7 +288,7 @@ impl<'ast, 'sess, 'c> ModResolver<'ast, 'sess> {

fn push_inline_mod_directory(&mut self, id: ast::Ident, attrs: &[ast::Attribute]) {
if let Some(path) = find_path_value(attrs) {
self.directory.path.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
Expand All @@ -300,10 +300,10 @@ impl<'ast, 'sess, 'c> ModResolver<'ast, 'sess> {
if let DirectoryOwnership::Owned { relative } = &mut self.directory.ownership {
if let Some(ident) = relative.take() {
// remove the relative offset
self.directory.path.push(ident.as_str());
self.directory.path.push(&*ident.as_str());
}
}
self.directory.path.push(&id.as_str());
self.directory.path.push(&*id.as_str());
}
}

Expand Down
2 changes: 1 addition & 1 deletion rustfmt-core/rustfmt-lib/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ fn is_skip(meta_item: &MetaItem) -> bool {
match meta_item.kind {
MetaItemKind::Word => {
let path_str = pprust::path_to_string(&meta_item.path);
path_str == skip_annotation().as_str() || path_str == depr_skip_annotation().as_str()
path_str == &*skip_annotation().as_str() || path_str == &*depr_skip_annotation().as_str()
}
MetaItemKind::List(ref l) => {
meta_item.check_name(sym::cfg_attr) && l.len() == 2 && is_skip_nested(&l[1])
Expand Down

0 comments on commit a34d9b1

Please sign in to comment.