From 9218e444342d13088092edec90a4f889f98ecff2 Mon Sep 17 00:00:00 2001 From: "leonardo.yvens" Date: Wed, 13 Sep 2017 14:21:16 -0300 Subject: [PATCH] Fix initial review --- src/librustc/middle/lang_items.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index 086b598497d57..da9f9128cf4ce 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -74,14 +74,14 @@ impl LanguageItems { } pub fn require(&self, it: LangItem) -> Result { - self.items[it as usize].ok_or(format!("requires `{}` lang_item", it.name())) + self.items[it as usize].ok_or_else(|| format!("requires `{}` lang_item", it.name())) } pub fn fn_trait_kind(&self, id: DefId) -> Option { match Some(id) { x if x == self.fn_trait() => Some(ty::ClosureKind::Fn), x if x == self.fn_mut_trait() => Some(ty::ClosureKind::FnMut), - x if x == self.fn_once_trait() => Some(ty::ClosureKind::FnOnce), + x if x == self.fn_once_trait() => Some(ty::ClosureKind::FnOnce), _ => None } }