rust/crates/ide-assists/src/handlers
bors 2271b82007 Auto merge of #16264 - roife:refactor/refactor-generate-delegate-trait, r=Veykril
internal: clean and enhance readability for `generate_delegate_trait`

Continue from #16112

This PR primarily involves some cleanup and simple refactoring work, including:

- Adding numerous comments to layer the code and explain the behavior of each step.
- Renaming some variables to make them more sensible.
- Simplify certain operations using a more elegant approach.

The goal is to make this intricate implementation clearer and facilitate future maintenance.

In addition to this, the PR also removes redundant `path_transform` operations for `type_gen_args`.
Taking the example of `impl Trait<T1> for S<S1>`, where `S1` is considered. The struct `S` must be in the file where the user triggers code actions, so there's no need for the `path_transform`. Furthermore, before performing the transform, we've already renamed `S1`, ensuring it won't clash with existing generics parameters. Therefore, there's no need to transform it.
2024-01-05 13:37:54 +00:00
..
add_braces.rs
add_explicit_type.rs Add flag to disallow opaque types for DisplayTarget::SourceCode 2023-04-12 19:03:48 +09:00
add_label_to_loop.rs
add_lifetime_to_type.rs
add_missing_impl_members.rs Ignore doc(hidden) attr if no body is present 2023-11-09 02:12:53 +01:00
add_missing_match_arms.rs Add config for preferring / ignoring prelude modules in find_path 2023-11-11 14:56:38 +01:00
add_return_type.rs fix some typos 2023-05-01 14:53:25 +08:00
add_turbo_fish.rs Fix panic in add_type_ascription 2023-11-14 18:43:48 -05:00
apply_demorgan.rs Replace unwrap with expect 2023-10-04 13:06:23 +02:00
auto_import.rs internal: Speed up import searching some more 2024-01-05 12:58:20 +01:00
bind_unused_param.rs Better trait implementation support 2023-08-29 22:56:31 +07:00
bool_to_enum.rs fix: use original range to deal with macros in promote_local_to_const 2024-01-02 10:33:48 +01:00
change_visibility.rs limit change_visibility assist to applicable items 2023-07-22 17:16:51 +03:00
convert_bool_then.rs Parse builtin# syntax 2023-09-05 10:36:35 +02:00
convert_comment_block.rs v4 2023-09-22 13:32:20 +02:00
convert_integer_literal.rs
convert_into_to_from.rs Add config for preferring / ignoring prelude modules in find_path 2023-11-11 14:56:38 +01:00
convert_iter_for_each_to_for.rs internal: Replace Display impl for Name 2023-05-24 20:55:12 +02:00
convert_let_else_to_match.rs
convert_match_to_let_else.rs
convert_named_struct_to_tuple_struct.rs Deunwrap convert_named_struct_to_tuple_struct 2023-08-09 16:40:23 +02:00
convert_nested_function_to_closure.rs Address another round of review comments 2023-04-05 18:48:21 +02:00
convert_to_guarded_return.rs fix: allow more kinds of if let patterns in guarded return assist 2023-10-01 11:48:10 -07:00
convert_tuple_return_type_to_struct.rs Implicit format args support 2023-12-05 17:07:00 +01:00
convert_tuple_struct_to_named_struct.rs fix: Fix incorrectly replacing references in macro invocation in "Convert to named struct" assist 2023-11-14 16:01:59 +09:00
convert_two_arm_bool_match_to_matches_macro.rs Allow match to matches assist to trigger on non-literal bool arms 2023-08-01 12:10:38 +02:00
convert_while_to_loop.rs
destructure_tuple_binding.rs Add IdentPat::set_pat 2023-11-13 20:41:06 -05:00
desugar_doc_comment.rs v4 2023-09-22 13:32:20 +02:00
expand_glob_import.rs Updated search to expose some more functions and to make search take the search scope by reference. 2023-07-09 17:30:21 -04:00
extract_expressions_from_format_string.rs Implicit format args support 2023-12-05 17:07:00 +01:00
extract_function.rs Auto merge of #16009 - werifu:fix-extract-function, r=Veykril 2023-12-07 17:28:41 +00:00
extract_module.rs Replace ID based TokenMap with proper relative text-ranges / spans 2023-11-28 10:55:39 +01:00
extract_struct_from_enum_variant.rs test: add test case for TupleField 2024-01-03 20:07:53 +08:00
extract_type_alias.rs Use ConstArg instead of Expr for AstId of InTypeConstId 2023-06-11 00:39:28 +03:30
extract_variable.rs Migrate extract_variable to mutable ast 2023-12-10 18:37:51 -05:00
fix_visibility.rs Replace ID based TokenMap with proper relative text-ranges / spans 2023-11-28 10:55:39 +01:00
flip_binexpr.rs flip binexpr works for lhs cmp 2023-12-08 11:36:30 +01:00
flip_comma.rs
flip_trait_bound.rs
generate_constant.rs Replace ID based TokenMap with proper relative text-ranges / spans 2023-11-28 10:55:39 +01:00
generate_default_from_enum_variant.rs
generate_default_from_new.rs Don't provide generate_default_from_new when impl self ty is missing 2023-08-07 03:23:41 +09:00
generate_delegate_methods.rs fix: prefer keeping Self if it is in the same impl def 2023-12-08 12:30:14 +01:00
generate_delegate_trait.rs internal: remove unnecessary path_tranform on type_gen_args in generate_delegate_trait. 2024-01-05 13:59:44 +08:00
generate_deref.rs Add config for preferring / ignoring prelude modules in find_path 2023-11-11 14:56:38 +01:00
generate_derive.rs v2 2023-08-16 00:22:08 +02:00
generate_documentation_template.rs Spelling 2023-04-19 09:45:55 -04:00
generate_enum_is_method.rs
generate_enum_projection_method.rs
generate_enum_variant.rs fix: Deduplicate annotations 2023-12-19 08:49:00 +01:00
generate_from_impl_for_enum.rs
generate_function.rs Migrate generate_function to mutable ast 2023-12-10 18:39:43 -05:00
generate_getter_or_setter.rs Unify getter and setter assists 2023-07-06 12:27:45 +02:00
generate_impl.rs
generate_is_empty_from_len.rs
generate_mut_trait_impl.rs make generate_mut_trait_impl assist trigged for std trait only 2023-11-05 12:27:10 +08:00
generate_new.rs Add config for preferring / ignoring prelude modules in find_path 2023-11-11 14:56:38 +01:00
generate_trait_from_impl.rs Minor changes 2023-07-05 16:45:54 +02:00
inline_call.rs fix: self type replacement with macros 2023-12-14 00:42:33 +08:00
inline_const_as_literal.rs fix: use render_eval instead of inlined expr 2023-06-06 12:08:11 +02:00
inline_local_variable.rs Implicit format args support 2023-12-05 17:07:00 +01:00
inline_macro.rs Turn unresolved proc macro expansions into missing expressions 2023-08-05 20:00:37 +02:00
inline_type_alias.rs
into_to_qualified_from.rs Make QualPathTy case readable 2023-09-22 21:23:03 +02:00
introduce_named_generic.rs refactor: extracted the fn handling conflicts in generics and add docs 2024-01-02 21:30:57 +08:00
introduce_named_lifetime.rs Spelling 2023-04-19 09:45:55 -04:00
invert_if.rs
merge_imports.rs
merge_match_arms.rs Fix pattern type mismatch in tuples 2023-05-04 16:03:36 +03:30
move_bounds.rs
move_const_to_impl.rs Updated search to expose some more functions and to make search take the search scope by reference. 2023-07-09 17:30:21 -04:00
move_from_mod_rs.rs internal: Replace Display impl for Name 2023-05-24 20:55:12 +02:00
move_guard.rs
move_module_to_file.rs internal: Replace Display impl for Name 2023-05-24 20:55:12 +02:00
move_to_mod_rs.rs internal: Replace Display impl for Name 2023-05-24 20:55:12 +02:00
number_representation.rs
promote_local_to_const.rs fix: use original range to deal with macros in promote_local_to_const 2024-01-02 10:33:48 +01:00
pull_assignment_up.rs Use anonymous lifetime where possible 2023-06-29 23:27:28 +09:00
qualify_method_call.rs Add config for preferring / ignoring prelude modules in find_path 2023-11-11 14:56:38 +01:00
qualify_path.rs internal: Speed up import searching some more 2024-01-05 12:58:20 +01:00
raw_string.rs update assist to include more literals 2023-06-06 00:34:00 +02:00
remove_dbg.rs Parse builtin# syntax 2023-09-05 10:36:35 +02:00
remove_mut.rs
remove_parentheses.rs move parentheses judge logic into builder 2023-11-22 14:11:00 +08:00
remove_unused_imports.rs test: add test case for remove comma 2023-12-22 21:04:53 +08:00
remove_unused_param.rs Rollback changes in remove_unused_param.rs 2023-08-29 23:06:12 +07:00
reorder_fields.rs internal: Replace Display impl for Name 2023-05-24 20:55:12 +02:00
reorder_impl_items.rs internal: Replace Display impl for Name 2023-05-24 20:55:12 +02:00
replace_arith_op.rs
replace_derive_with_manual_impl.rs Remove limit from symbol_index::Query 2024-01-04 19:20:10 +01:00
replace_if_let_with_match.rs
replace_is_method_with_if_let_method.rs Migrate replace_is_method_with_if_let_method to mutable ast 2023-12-10 18:39:43 -05:00
replace_let_with_if_let.rs
replace_method_eager_lazy.rs
replace_named_generic_with_impl.rs Implicit format args support 2023-12-05 17:07:00 +01:00
replace_qualified_name_with_use.rs Add config for preferring / ignoring prelude modules in find_path 2023-11-11 14:56:38 +01:00
replace_string_with_char.rs Spelling 2023-04-19 09:45:55 -04:00
replace_try_expr_with_match.rs
replace_turbofish_with_explicit_type.rs Add flag to disallow opaque types for DisplayTarget::SourceCode 2023-04-12 19:03:48 +09:00
sort_items.rs Restrict "sort items" assist inside Impl & Trait 2023-04-17 12:36:32 +02:00
split_import.rs
toggle_ignore.rs Replace option.map(cond) == Some(true) with option.is_some_and(cond) 2023-11-24 09:06:44 -08:00
unmerge_match_arm.rs
unmerge_use.rs Give unmerge_use a label explaining what it will affect. 2023-09-16 13:29:03 -07:00
unnecessary_async.rs Implicit format args support 2023-12-05 17:07:00 +01:00
unqualify_method_call.rs chore: add use case for PathSegment::qualifying_trait 2023-11-17 21:31:33 +08:00
unwrap_block.rs
unwrap_result_return_type.rs fix panic with wrapping/unwrapping result return type assists 2023-09-24 16:00:55 -07:00
unwrap_tuple.rs
wrap_return_type_in_result.rs fix panic with wrapping/unwrapping result return type assists 2023-09-24 16:00:55 -07:00