Fix various useless derefs and slicings

This commit is contained in:
Oliver Schneider
2017-03-24 09:31:26 +01:00
parent 79feb9476d
commit eb447f4ef4
46 changed files with 120 additions and 122 deletions

View File

@@ -5151,15 +5151,15 @@ 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, "path") {
self.directory.path.push(&*path.as_str());
self.directory.path.push(&path.as_str());
self.directory.ownership = DirectoryOwnership::Owned;
} else {
self.directory.path.push(&*id.name.as_str());
self.directory.path.push(&id.name.as_str());
}
}
pub fn submod_path_from_attr(attrs: &[ast::Attribute], dir_path: &Path) -> Option<PathBuf> {
attr::first_attr_value_str_by_name(attrs, "path").map(|d| dir_path.join(&*d.as_str()))
attr::first_attr_value_str_by_name(attrs, "path").map(|d| dir_path.join(&d.as_str()))
}
/// Returns either a path to a module, or .