mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
remove useless conversions
This commit is contained in:
parent
cc80c5bd07
commit
efd2c20e96
17 changed files with 26 additions and 38 deletions
|
@ -53,7 +53,7 @@ pub(crate) fn generate_default_from_new(acc: &mut Assists, ctx: &AssistContext<'
|
|||
return None;
|
||||
}
|
||||
|
||||
let impl_ = fn_node.syntax().ancestors().into_iter().find_map(ast::Impl::cast)?;
|
||||
let impl_ = fn_node.syntax().ancestors().find_map(ast::Impl::cast)?;
|
||||
if is_default_implemented(ctx, &impl_) {
|
||||
cov_mark::hit!(default_block_is_already_present);
|
||||
cov_mark::hit!(struct_in_module_with_default);
|
||||
|
|
|
@ -85,8 +85,7 @@ fn generate_tuple_deref(acc: &mut Assists, ctx: &AssistContext<'_>) -> Option<()
|
|||
let strukt = ctx.find_node_at_offset::<ast::Struct>()?;
|
||||
let field = ctx.find_node_at_offset::<ast::TupleField>()?;
|
||||
let field_list = ctx.find_node_at_offset::<ast::TupleFieldList>()?;
|
||||
let field_list_index =
|
||||
field_list.syntax().children().into_iter().position(|s| &s == field.syntax())?;
|
||||
let field_list_index = field_list.syntax().children().position(|s| &s == field.syntax())?;
|
||||
|
||||
let deref_type_to_generate = match existing_deref_impl(&ctx.sema, &strukt) {
|
||||
None => DerefType::Deref,
|
||||
|
|
|
@ -42,7 +42,7 @@ pub(crate) fn replace_turbofish_with_explicit_type(
|
|||
let r_angle = generic_args.r_angle_token()?;
|
||||
let turbofish_range = TextRange::new(colon2.text_range().start(), r_angle.text_range().end());
|
||||
|
||||
let turbofish_args: Vec<GenericArg> = generic_args.generic_args().into_iter().collect();
|
||||
let turbofish_args: Vec<GenericArg> = generic_args.generic_args().collect();
|
||||
|
||||
// Find type of ::<_>
|
||||
if turbofish_args.len() != 1 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue