3 Cursor position or selection is signified by `┃` character.
8 Adds a new `#[derive()]` clause to a struct or enum.
25 ## `add_explicit_type`
27 Specify type for a let binding.
43 Adds a hash to a raw string literal.
59 Adds a new inherent impl for a type.
63 struct Ctx<T: Clone> {
68 struct Ctx<T: Clone> {
72 impl<T: Clone> Ctx<T> {
77 ## `add_impl_default_members`
79 Adds scaffold for overriding default impl members.
110 ## `add_impl_missing_members`
112 Adds scaffold for required impl members.
134 fn foo(&self) { unimplemented!() }
141 Adds a use statement for a given fully-qualified path.
145 fn process(map: std::collections::┃HashMap<String, String>) {}
148 use std::collections::HashMap;
150 fn process(map: HashMap<String, String>) {}
155 Adds a new inherent impl for a type.
159 struct Ctx<T: Clone> {
164 struct Ctx<T: Clone> {
168 impl<T: Clone> Ctx<T> {
169 fn new(data: T) -> Self { Self { data } }
176 Apply [De Morgan's law](https://en.wikipedia.org/wiki/De_Morgan%27s_laws).
177 This transforms expressions of the form `!l || !r` into `!(l && r)`.
178 This also works with `&&`. This assist can only be applied with the cursor
179 on either `||` or `&&`, with both operands being a negation of some kind.
180 This means something of the form `!x` or `x != y`.
194 ## `change_visibility`
196 Adds or changes existing visibility specifier.
203 pub(crate) fn frobnicate() {}
206 ## `convert_to_guarded_return`
208 Replace a large conditional with a guarded return.
231 Adds missing clauses to a `match` expression.
235 enum Action { Move { distance: u32 }, Stop }
237 fn handle(action: Action) {
244 enum Action { Move { distance: u32 }, Stop }
246 fn handle(action: Action) {
248 Action::Move { distance } => (),
256 Flips operands of a binary expression.
272 Flips two comma-separated items.
286 ## `flip_trait_bound`
288 Flips two trait bounds.
292 fn foo<T: Clone +┃ Copy>() { }
295 fn foo<T: Copy + Clone>() { }
298 ## `inline_local_variable`
300 Inlines local variable.
315 ## `introduce_variable`
317 Extracts subexpression into a variable.
327 let var_name = (1 + 2);
334 Adds `r#` to a plain string literal.
348 ## `make_usual_string`
350 Turns a raw string into a plain string.
355 r#"Hello,┃ "World!""#;
364 ## `merge_match_arms`
366 Merges identical match arms.
370 enum Action { Move { distance: u32 }, Stop }
372 fn handle(action: Action) {
374 ┃Action::Move(..) => foo(),
375 Action::Stop => foo(),
380 enum Action { Move { distance: u32 }, Stop }
382 fn handle(action: Action) {
384 Action::Move(..) | Action::Stop => foo(),
389 ## `move_arm_cond_to_match_guard`
391 Moves if expression from match arm body into a guard.
395 enum Action { Move { distance: u32 }, Stop }
397 fn handle(action: Action) {
399 Action::Move { distance } => ┃if distance > 10 { foo() },
405 enum Action { Move { distance: u32 }, Stop }
407 fn handle(action: Action) {
409 Action::Move { distance } if distance > 10 => foo(),
415 ## `move_bounds_to_where_clause`
417 Moves inline type bounds to a where clause.
421 fn apply<T, U, ┃F: FnOnce(T) -> U>(f: F, x: T) -> U {
426 fn apply<T, U, F>(f: F, x: T) -> U where F: FnOnce(T) -> U {
431 ## `move_guard_to_arm_body`
433 Moves match guard into match arm body.
437 enum Action { Move { distance: u32 }, Stop }
439 fn handle(action: Action) {
441 Action::Move { distance } ┃if distance > 10 => foo(),
447 enum Action { Move { distance: u32 }, Stop }
449 fn handle(action: Action) {
451 Action::Move { distance } => if distance > 10 { foo() },
459 Removes `dbg!()` macro call.
475 Removes a hash from a raw string literal.
489 ## `replace_if_let_with_match`
491 Replaces `if let` with an else branch with a `match` expression.
495 enum Action { Move { distance: u32 }, Stop }
497 fn handle(action: Action) {
498 ┃if let Action::Move { distance } = action {
506 enum Action { Move { distance: u32 }, Stop }
508 fn handle(action: Action) {
510 Action::Move { distance } => foo(distance),
518 Wraps the tail of import into braces.
522 use std::┃collections::HashMap;
525 use std::{collections::HashMap};