diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-01-07 12:27:17 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-01-07 12:27:17 +0000 |
commit | 7967ce85cfc5fc2b1996425b44f2a45d0841c8ff (patch) | |
tree | 4495b9de7ea6c8e9dd9fd347d42517e9dee511fa /crates/assists/src/handlers/replace_if_let_with_match.rs | |
parent | c3e9fb183bc287d83b97b776edc87c54d18d1a73 (diff) | |
parent | 72b9a4fbd3c12f3250b9157a1d44230e04ec8b22 (diff) |
Merge #7184
7184: Changes Cursor Marker To $0 r=matklad a=kevaundray
Co-authored-by: Kevaundray Wedderburn <[email protected]>
Diffstat (limited to 'crates/assists/src/handlers/replace_if_let_with_match.rs')
-rw-r--r-- | crates/assists/src/handlers/replace_if_let_with_match.rs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/crates/assists/src/handlers/replace_if_let_with_match.rs b/crates/assists/src/handlers/replace_if_let_with_match.rs index b67219222..aee3397ab 100644 --- a/crates/assists/src/handlers/replace_if_let_with_match.rs +++ b/crates/assists/src/handlers/replace_if_let_with_match.rs | |||
@@ -20,7 +20,7 @@ use crate::{utils::unwrap_trivial_block, AssistContext, AssistId, AssistKind, As | |||
20 | // enum Action { Move { distance: u32 }, Stop } | 20 | // enum Action { Move { distance: u32 }, Stop } |
21 | // | 21 | // |
22 | // fn handle(action: Action) { | 22 | // fn handle(action: Action) { |
23 | // <|>if let Action::Move { distance } = action { | 23 | // $0if let Action::Move { distance } = action { |
24 | // foo(distance) | 24 | // foo(distance) |
25 | // } else { | 25 | // } else { |
26 | // bar() | 26 | // bar() |
@@ -89,7 +89,7 @@ pub(crate) fn replace_if_let_with_match(acc: &mut Assists, ctx: &AssistContext) | |||
89 | // enum Action { Move { distance: u32 }, Stop } | 89 | // enum Action { Move { distance: u32 }, Stop } |
90 | // | 90 | // |
91 | // fn handle(action: Action) { | 91 | // fn handle(action: Action) { |
92 | // <|>match action { | 92 | // $0match action { |
93 | // Action::Move { distance } => foo(distance), | 93 | // Action::Move { distance } => foo(distance), |
94 | // _ => bar(), | 94 | // _ => bar(), |
95 | // } | 95 | // } |
@@ -179,7 +179,7 @@ mod tests { | |||
179 | r#" | 179 | r#" |
180 | impl VariantData { | 180 | impl VariantData { |
181 | pub fn is_struct(&self) -> bool { | 181 | pub fn is_struct(&self) -> bool { |
182 | if <|>let VariantData::Struct(..) = *self { | 182 | if $0let VariantData::Struct(..) = *self { |
183 | true | 183 | true |
184 | } else { | 184 | } else { |
185 | false | 185 | false |
@@ -204,7 +204,7 @@ impl VariantData { | |||
204 | replace_if_let_with_match, | 204 | replace_if_let_with_match, |
205 | r#" | 205 | r#" |
206 | fn foo() { | 206 | fn foo() { |
207 | if <|>let VariantData::Struct(..) = a { | 207 | if $0let VariantData::Struct(..) = a { |
208 | bar( | 208 | bar( |
209 | 123 | 209 | 123 |
210 | ) | 210 | ) |
@@ -233,7 +233,7 @@ fn foo() { | |||
233 | r#" | 233 | r#" |
234 | impl VariantData { | 234 | impl VariantData { |
235 | pub fn is_struct(&self) -> bool { | 235 | pub fn is_struct(&self) -> bool { |
236 | if <|>let VariantData::Struct(..) = *self { | 236 | if $0let VariantData::Struct(..) = *self { |
237 | true | 237 | true |
238 | } else { | 238 | } else { |
239 | false | 239 | false |
@@ -257,7 +257,7 @@ enum Option<T> { Some(T), None } | |||
257 | use Option::*; | 257 | use Option::*; |
258 | 258 | ||
259 | fn foo(x: Option<i32>) { | 259 | fn foo(x: Option<i32>) { |
260 | <|>if let Some(x) = x { | 260 | $0if let Some(x) = x { |
261 | println!("{}", x) | 261 | println!("{}", x) |
262 | } else { | 262 | } else { |
263 | println!("none") | 263 | println!("none") |
@@ -287,7 +287,7 @@ enum Result<T, E> { Ok(T), Err(E) } | |||
287 | use Result::*; | 287 | use Result::*; |
288 | 288 | ||
289 | fn foo(x: Result<i32, ()>) { | 289 | fn foo(x: Result<i32, ()>) { |
290 | <|>if let Ok(x) = x { | 290 | $0if let Ok(x) = x { |
291 | println!("{}", x) | 291 | println!("{}", x) |
292 | } else { | 292 | } else { |
293 | println!("none") | 293 | println!("none") |
@@ -315,7 +315,7 @@ fn foo(x: Result<i32, ()>) { | |||
315 | r#" | 315 | r#" |
316 | fn main() { | 316 | fn main() { |
317 | if true { | 317 | if true { |
318 | <|>if let Ok(rel_path) = path.strip_prefix(root_path) { | 318 | $0if let Ok(rel_path) = path.strip_prefix(root_path) { |
319 | let rel_path = RelativePathBuf::from_path(rel_path).ok()?; | 319 | let rel_path = RelativePathBuf::from_path(rel_path).ok()?; |
320 | Some((*id, rel_path)) | 320 | Some((*id, rel_path)) |
321 | } else { | 321 | } else { |
@@ -347,7 +347,7 @@ fn main() { | |||
347 | r#" | 347 | r#" |
348 | impl VariantData { | 348 | impl VariantData { |
349 | pub fn is_struct(&self) -> bool { | 349 | pub fn is_struct(&self) -> bool { |
350 | <|>match *self { | 350 | $0match *self { |
351 | VariantData::Struct(..) => true, | 351 | VariantData::Struct(..) => true, |
352 | _ => false, | 352 | _ => false, |
353 | } | 353 | } |
@@ -372,7 +372,7 @@ impl VariantData { | |||
372 | replace_match_with_if_let, | 372 | replace_match_with_if_let, |
373 | r#" | 373 | r#" |
374 | fn foo() { | 374 | fn foo() { |
375 | <|>match a { | 375 | $0match a { |
376 | VariantData::Struct(..) => { | 376 | VariantData::Struct(..) => { |
377 | bar( | 377 | bar( |
378 | 123 | 378 | 123 |
@@ -401,7 +401,7 @@ fn foo() { | |||
401 | r#" | 401 | r#" |
402 | impl VariantData { | 402 | impl VariantData { |
403 | pub fn is_struct(&self) -> bool { | 403 | pub fn is_struct(&self) -> bool { |
404 | <|>match *self { | 404 | $0match *self { |
405 | VariantData::Struct(..) => true, | 405 | VariantData::Struct(..) => true, |
406 | _ => false, | 406 | _ => false, |
407 | } | 407 | } |
@@ -423,7 +423,7 @@ enum Option<T> { Some(T), None } | |||
423 | use Option::*; | 423 | use Option::*; |
424 | 424 | ||
425 | fn foo(x: Option<i32>) { | 425 | fn foo(x: Option<i32>) { |
426 | <|>match x { | 426 | $0match x { |
427 | Some(x) => println!("{}", x), | 427 | Some(x) => println!("{}", x), |
428 | None => println!("none"), | 428 | None => println!("none"), |
429 | } | 429 | } |
@@ -453,7 +453,7 @@ enum Result<T, E> { Ok(T), Err(E) } | |||
453 | use Result::*; | 453 | use Result::*; |
454 | 454 | ||
455 | fn foo(x: Result<i32, ()>) { | 455 | fn foo(x: Result<i32, ()>) { |
456 | <|>match x { | 456 | $0match x { |
457 | Ok(x) => println!("{}", x), | 457 | Ok(x) => println!("{}", x), |
458 | Err(_) => println!("none"), | 458 | Err(_) => println!("none"), |
459 | } | 459 | } |
@@ -481,7 +481,7 @@ fn foo(x: Result<i32, ()>) { | |||
481 | r#" | 481 | r#" |
482 | fn main() { | 482 | fn main() { |
483 | if true { | 483 | if true { |
484 | <|>match path.strip_prefix(root_path) { | 484 | $0match path.strip_prefix(root_path) { |
485 | Ok(rel_path) => { | 485 | Ok(rel_path) => { |
486 | let rel_path = RelativePathBuf::from_path(rel_path).ok()?; | 486 | let rel_path = RelativePathBuf::from_path(rel_path).ok()?; |
487 | Some((*id, rel_path)) | 487 | Some((*id, rel_path)) |
@@ -512,7 +512,7 @@ fn main() { | |||
512 | replace_match_with_if_let, | 512 | replace_match_with_if_let, |
513 | r#" | 513 | r#" |
514 | fn main() { | 514 | fn main() { |
515 | <|>match path.strip_prefix(root_path) { | 515 | $0match path.strip_prefix(root_path) { |
516 | Ok(rel_path) => println!("{}", rel_path), | 516 | Ok(rel_path) => println!("{}", rel_path), |
517 | _ => (), | 517 | _ => (), |
518 | } | 518 | } |