From b28ca32db22d5e2ed34db556c6fd50a5fc2d679c Mon Sep 17 00:00:00 2001 From: Alan Du Date: Mon, 3 Jun 2019 10:27:51 -0400 Subject: Fix clippy::or_fun_call --- crates/ra_mbe/src/mbe_expander.rs | 14 ++++++-------- crates/ra_mbe/src/mbe_parser.rs | 4 ++-- 2 files changed, 8 insertions(+), 10 deletions(-) (limited to 'crates/ra_mbe/src') diff --git a/crates/ra_mbe/src/mbe_expander.rs b/crates/ra_mbe/src/mbe_expander.rs index 7cfb47f7a..55a6ecf58 100644 --- a/crates/ra_mbe/src/mbe_expander.rs +++ b/crates/ra_mbe/src/mbe_expander.rs @@ -105,17 +105,15 @@ impl Bindings { } fn get(&self, name: &SmolStr, nesting: &[usize]) -> Result<&tt::TokenTree, ExpandError> { - let mut b = self - .inner - .get(name) - .ok_or(ExpandError::BindingError(format!("could not find binding `{}`", name)))?; + let mut b = self.inner.get(name).ok_or_else(|| { + ExpandError::BindingError(format!("could not find binding `{}`", name)) + })?; for &idx in nesting.iter() { b = match b { Binding::Simple(_) => break, - Binding::Nested(bs) => bs.get(idx).ok_or(ExpandError::BindingError(format!( - "could not find nested binding `{}`", - name - )))?, + Binding::Nested(bs) => bs.get(idx).ok_or_else(|| { + ExpandError::BindingError(format!("could not find nested binding `{}`", name)) + })?, Binding::Empty => { return Err(ExpandError::BindingError(format!( "could not find empty binding `{}`", diff --git a/crates/ra_mbe/src/mbe_parser.rs b/crates/ra_mbe/src/mbe_parser.rs index d8fe293c7..dca16b537 100644 --- a/crates/ra_mbe/src/mbe_parser.rs +++ b/crates/ra_mbe/src/mbe_parser.rs @@ -125,8 +125,8 @@ fn parse_repeat(p: &mut TtCursor, transcriber: bool) -> Result