]> git.lizzy.rs Git - rust.git/commitdiff
Fix initial review
authorleonardo.yvens <leoyvens@gmail.com>
Wed, 13 Sep 2017 17:21:16 +0000 (14:21 -0300)
committerleonardo.yvens <leoyvens@gmail.com>
Wed, 13 Sep 2017 17:21:16 +0000 (14:21 -0300)
src/librustc/middle/lang_items.rs

index 086b598497d57a7b127ae5bfd79f554c623114d5..da9f9128cf4cef6b4bbe8b2be146f9b62f9e9244 100644 (file)
@@ -74,14 +74,14 @@ pub fn items(&self) -> &[Option<DefId>] {
     }
 
     pub fn require(&self, it: LangItem) -> Result<DefId, String> {
-        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<ty::ClosureKind> {
         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
         }
     }