mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Fix clippy::or_fun_call
This commit is contained in:
parent
40424d4222
commit
b28ca32db2
12 changed files with 29 additions and 26 deletions
|
@ -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 `{}`",
|
||||
|
|
|
@ -125,8 +125,8 @@ fn parse_repeat(p: &mut TtCursor, transcriber: bool) -> Result<crate::Repeat, Pa
|
|||
}
|
||||
}
|
||||
|
||||
let sep = p.eat_seperator().ok_or(ParseError::Expected(String::from("separator")))?;
|
||||
let rep = p.eat_punct().ok_or(ParseError::Expected(String::from("repeat")))?;
|
||||
let sep = p.eat_seperator().ok_or_else(|| ParseError::Expected(String::from("separator")))?;
|
||||
let rep = p.eat_punct().ok_or_else(|| ParseError::Expected(String::from("repeat")))?;
|
||||
|
||||
mk_repeat(rep.char, subtree, Some(sep))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue