mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
Fix clippy::identity_conversion
This commit is contained in:
parent
ed3d93b875
commit
40424d4222
16 changed files with 49 additions and 59 deletions
|
@ -206,48 +206,48 @@ fn match_lhs(pattern: &crate::Subtree, input: &mut TtCursor) -> Result<Bindings,
|
|||
"path" => {
|
||||
let path =
|
||||
input.eat_path().ok_or(ExpandError::UnexpectedToken)?.clone();
|
||||
res.inner.insert(text.clone(), Binding::Simple(path.into()));
|
||||
res.inner.insert(text.clone(), Binding::Simple(path));
|
||||
}
|
||||
"expr" => {
|
||||
let expr =
|
||||
input.eat_expr().ok_or(ExpandError::UnexpectedToken)?.clone();
|
||||
res.inner.insert(text.clone(), Binding::Simple(expr.into()));
|
||||
res.inner.insert(text.clone(), Binding::Simple(expr));
|
||||
}
|
||||
"ty" => {
|
||||
let ty = input.eat_ty().ok_or(ExpandError::UnexpectedToken)?.clone();
|
||||
res.inner.insert(text.clone(), Binding::Simple(ty.into()));
|
||||
res.inner.insert(text.clone(), Binding::Simple(ty));
|
||||
}
|
||||
"pat" => {
|
||||
let pat = input.eat_pat().ok_or(ExpandError::UnexpectedToken)?.clone();
|
||||
res.inner.insert(text.clone(), Binding::Simple(pat.into()));
|
||||
res.inner.insert(text.clone(), Binding::Simple(pat));
|
||||
}
|
||||
"stmt" => {
|
||||
let pat = input.eat_stmt().ok_or(ExpandError::UnexpectedToken)?.clone();
|
||||
res.inner.insert(text.clone(), Binding::Simple(pat.into()));
|
||||
res.inner.insert(text.clone(), Binding::Simple(pat));
|
||||
}
|
||||
"block" => {
|
||||
let block =
|
||||
input.eat_block().ok_or(ExpandError::UnexpectedToken)?.clone();
|
||||
res.inner.insert(text.clone(), Binding::Simple(block.into()));
|
||||
res.inner.insert(text.clone(), Binding::Simple(block));
|
||||
}
|
||||
"meta" => {
|
||||
let meta =
|
||||
input.eat_meta().ok_or(ExpandError::UnexpectedToken)?.clone();
|
||||
res.inner.insert(text.clone(), Binding::Simple(meta.into()));
|
||||
res.inner.insert(text.clone(), Binding::Simple(meta));
|
||||
}
|
||||
"tt" => {
|
||||
let token = input.eat().ok_or(ExpandError::UnexpectedToken)?.clone();
|
||||
res.inner.insert(text.clone(), Binding::Simple(token.into()));
|
||||
res.inner.insert(text.clone(), Binding::Simple(token));
|
||||
}
|
||||
"item" => {
|
||||
let item =
|
||||
input.eat_item().ok_or(ExpandError::UnexpectedToken)?.clone();
|
||||
res.inner.insert(text.clone(), Binding::Simple(item.into()));
|
||||
res.inner.insert(text.clone(), Binding::Simple(item));
|
||||
}
|
||||
"lifetime" => {
|
||||
let lifetime =
|
||||
input.eat_lifetime().ok_or(ExpandError::UnexpectedToken)?.clone();
|
||||
res.inner.insert(text.clone(), Binding::Simple(lifetime.into()));
|
||||
res.inner.insert(text.clone(), Binding::Simple(lifetime));
|
||||
}
|
||||
"literal" => {
|
||||
let literal =
|
||||
|
@ -262,7 +262,7 @@ fn match_lhs(pattern: &crate::Subtree, input: &mut TtCursor) -> Result<Bindings,
|
|||
// `vis` is optional
|
||||
if let Some(vis) = input.try_eat_vis() {
|
||||
let vis = vis.clone();
|
||||
res.inner.insert(text.clone(), Binding::Simple(vis.into()));
|
||||
res.inner.insert(text.clone(), Binding::Simple(vis));
|
||||
} else {
|
||||
res.push_optional(&text);
|
||||
}
|
||||
|
@ -452,7 +452,7 @@ fn expand_tt(
|
|||
|
||||
let idx = ctx.nesting.pop().unwrap();
|
||||
ctx.nesting.push(idx + 1);
|
||||
token_trees.push(reduce_single_token(t).into());
|
||||
token_trees.push(reduce_single_token(t));
|
||||
|
||||
if let Some(ref sep) = repeat.separator {
|
||||
match sep {
|
||||
|
|
|
@ -155,9 +155,10 @@ fn convert_doc_comment<'a>(token: &ra_syntax::SyntaxToken<'a>) -> Option<Vec<tt:
|
|||
if let ast::CommentPlacement::Inner = doc {
|
||||
token_trees.push(mk_punct('!'));
|
||||
}
|
||||
token_trees.push(tt::TokenTree::from(tt::Subtree::from(
|
||||
tt::Subtree { delimiter: tt::Delimiter::Bracket, token_trees: meta_tkns }.into(),
|
||||
)));
|
||||
token_trees.push(tt::TokenTree::from(tt::Subtree {
|
||||
delimiter: tt::Delimiter::Bracket,
|
||||
token_trees: meta_tkns,
|
||||
}));
|
||||
|
||||
return Some(token_trees);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue