aboutsummaryrefslogtreecommitdiff
path: root/crates/assists/src/handlers/replace_if_let_with_match.rs
diff options
context:
space:
mode:
authorKevaundray Wedderburn <[email protected]>2021-01-06 20:15:48 +0000
committerKevaundray Wedderburn <[email protected]>2021-01-07 12:09:23 +0000
commit72b9a4fbd3c12f3250b9157a1d44230e04ec8b22 (patch)
treec138363e3592c690d841aeedb9ac97d6b2ff4396 /crates/assists/src/handlers/replace_if_let_with_match.rs
parent171c3c08fe245938fb25321394233de5fe2abc7c (diff)
Change <|> to $0 - Rebase
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.rs30
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#"
180impl VariantData { 180impl 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#"
206fn foo() { 206fn 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#"
234impl VariantData { 234impl 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 }
257use Option::*; 257use Option::*;
258 258
259fn foo(x: Option<i32>) { 259fn 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) }
287use Result::*; 287use Result::*;
288 288
289fn foo(x: Result<i32, ()>) { 289fn 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#"
316fn main() { 316fn 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#"
348impl VariantData { 348impl 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#"
374fn foo() { 374fn 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#"
402impl VariantData { 402impl 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 }
423use Option::*; 423use Option::*;
424 424
425fn foo(x: Option<i32>) { 425fn 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) }
453use Result::*; 453use Result::*;
454 454
455fn foo(x: Result<i32, ()>) { 455fn 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#"
482fn main() { 482fn 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#"
514fn main() { 514fn 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 }