Fixed clippy warnings (#90)

* Fixed clippy warnings

* Fix as per review
This commit is contained in:
boyned//Kampfkarren
2018-12-03 10:35:40 -08:00
committed by Lucien Greathouse
parent 26a7bb9746
commit 13a7c1ba81
7 changed files with 31 additions and 47 deletions

View File

@@ -65,20 +65,15 @@ impl PathIdTree {
let root_id = root_node.id;
let mut to_visit: Vec<PathBuf> = root_node.children.drain().collect();
loop {
let next_path = match to_visit.pop() {
Some(path) => path,
None => break,
};
match self.nodes.remove(&next_path) {
while let Some(path) = to_visit.pop() {
match self.nodes.remove(&path) {
Some(mut node) => {
for child in node.children.drain() {
to_visit.push(child);
}
},
None => {
warn!("Consistency issue; tried to remove {} but it was already removed", next_path.display());
warn!("Consistency issue; tried to remove {} but it was already removed", path.display());
},
}
}
@@ -203,7 +198,7 @@ fn construct_initial_tree(
construct_project_node(
&mut context,
None,
project.name.clone(),
&project.name,
&project.name,
&project.tree,
);
@@ -231,7 +226,7 @@ fn insert_or_create_tree(context: &mut ConstructContext, parent_instance_id: Opt
fn construct_project_node(
context: &mut ConstructContext,
parent_instance_id: Option<RbxId>,
instance_path: String,
instance_path: &str,
instance_name: &str,
project_node: &ProjectNode,
) {
@@ -264,7 +259,7 @@ fn construct_instance_node(
for (child_name, child_project_node) in &project_node.children {
let child_path = format!("{}/{}", instance_path, child_name);
construct_project_node(context, Some(id), child_path, child_name, child_project_node);
construct_project_node(context, Some(id), &child_path, child_name, child_project_node);
}
id