Fix static analysis warnings

This commit is contained in:
Andrew Brown
2019-07-11 16:10:42 -07:00
committed by Dan Gohman
parent d492cf7e0e
commit 6605f308b3
2 changed files with 4 additions and 4 deletions

View File

@@ -79,7 +79,7 @@ impl InstructionGroup {
pub fn by_name(&self, name: &'static str) -> &Instruction { pub fn by_name(&self, name: &'static str) -> &Instruction {
self.instructions self.instructions
.iter() .iter()
.find(|inst| inst.name == name) .find(|inst| &inst.name == name)
.expect(&format!("unexisting instruction with name {}", name)) .expect(&format!("unexisting instruction with name {}", name))
} }
} }
@@ -155,7 +155,7 @@ impl ops::Deref for Instruction {
impl Instruction { impl Instruction {
pub fn snake_name(&self) -> &str { pub fn snake_name(&self) -> &str {
if self.name == "return" { if &self.name == "return" {
"return_" "return_"
} else { } else {
&self.name &self.name
@@ -800,7 +800,7 @@ impl InstructionPredicateNode {
ret.extend(node.collect_leaves()); ret.extend(node.collect_leaves());
} }
} }
_ => ret.push(&self), _ => ret.push(self),
} }
ret ret
} }

View File

@@ -53,7 +53,7 @@ impl<'builder> RecipeGroup<'builder> {
pub fn recipe(&self, name: &str) -> &EncodingRecipe { pub fn recipe(&self, name: &str) -> &EncodingRecipe {
self.recipes self.recipes
.iter() .iter()
.find(|recipe| recipe.name == name) .find(|recipe| &recipe.name == name)
.expect(&format!("unknown recipe name: {}. Try template?", name)) .expect(&format!("unknown recipe name: {}. Try template?", name))
} }
pub fn template(&self, name: &str) -> &Template { pub fn template(&self, name: &str) -> &Template {