mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Run cargo +nightly fix --clippy -Z unstable-options
This commit is contained in:
parent
eab80cd961
commit
b8ddcb0652
48 changed files with 132 additions and 149 deletions
|
@ -100,7 +100,7 @@ fn next_op<'a>(
|
|||
Op::Repeat { subtree, separator, kind }
|
||||
}
|
||||
tt::TokenTree::Leaf(leaf) => match leaf {
|
||||
tt::Leaf::Punct(..) => Err(ExpandError::UnexpectedToken)?,
|
||||
tt::Leaf::Punct(..) => return Err(ExpandError::UnexpectedToken),
|
||||
tt::Leaf::Ident(ident) => {
|
||||
let name = &ident.text;
|
||||
let kind = eat_fragment_kind(src, mode)?;
|
||||
|
@ -147,15 +147,15 @@ fn parse_repeat(src: &mut TtIter) -> Result<(Option<Separator>, RepeatKind), Exp
|
|||
for tt in src {
|
||||
let tt = match tt {
|
||||
tt::TokenTree::Leaf(leaf) => leaf,
|
||||
tt::TokenTree::Subtree(_) => Err(ExpandError::InvalidRepeat)?,
|
||||
tt::TokenTree::Subtree(_) => return Err(ExpandError::InvalidRepeat),
|
||||
};
|
||||
let has_sep = match &separator {
|
||||
Separator::Puncts(puncts) => puncts.len() != 0,
|
||||
Separator::Puncts(puncts) => !puncts.is_empty(),
|
||||
_ => true,
|
||||
};
|
||||
match tt {
|
||||
tt::Leaf::Ident(_) | tt::Leaf::Literal(_) if has_sep => {
|
||||
Err(ExpandError::InvalidRepeat)?
|
||||
return Err(ExpandError::InvalidRepeat)
|
||||
}
|
||||
tt::Leaf::Ident(ident) => separator = Separator::Ident(ident.clone()),
|
||||
tt::Leaf::Literal(lit) => separator = Separator::Literal(lit.clone()),
|
||||
|
@ -168,11 +168,11 @@ fn parse_repeat(src: &mut TtIter) -> Result<(Option<Separator>, RepeatKind), Exp
|
|||
match &mut separator {
|
||||
Separator::Puncts(puncts) => {
|
||||
if puncts.len() == 3 {
|
||||
Err(ExpandError::InvalidRepeat)?
|
||||
return Err(ExpandError::InvalidRepeat);
|
||||
}
|
||||
puncts.push(punct.clone())
|
||||
}
|
||||
_ => Err(ExpandError::InvalidRepeat)?,
|
||||
_ => return Err(ExpandError::InvalidRepeat),
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue