Repository: rust-analyzer/rust-analyzer
Pull request #2076 (2019-10-26 15:04:09)

use correct spacing for enum pattern


Patch:
diff --git a/crates/ra_assists/src/assists/fill_match_arms.rs b/crates/ra_assists/src/assists/fill_match_arms.rs
index 13b98d0333..b6166f947d 100644
--- a/crates/ra_assists/src/assists/fill_match_arms.rs
+++ b/crates/ra_assists/src/assists/fill_match_arms.rs
@@ -26,7 +26,7 @@ use crate::{Assist, AssistCtx, AssistId};
 //
 // fn handle(action: Action) {
 //     match action {
-//         Action::Move{ distance } => (),
+//         Action::Move { distance } => (),
 //         Action::Stop => (),
 //     }
 // }
@@ -154,7 +154,7 @@ mod tests {
                     A::Bs => (),
                     A::Cs(_) => (),
                     A::Ds(_, _) => (),
-                    A::Es{ x, y } => (),
+                    A::Es { x, y } => (),
                 }
             }
             "#,
@@ -207,7 +207,7 @@ mod tests {
 
             fn foo(a: &mut A) {
                 match <|>a {
-                    A::Es{ x, y } => (),
+                    A::Es { x, y } => (),
                 }
             }
             "#,
diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs
index 00422ea913..76dad91557 100644
--- a/crates/ra_syntax/src/ast/make.rs
+++ b/crates/ra_syntax/src/ast/make.rs
@@ -77,7 +77,7 @@ pub fn tuple_struct_pat(
 
 pub fn record_pat(path: ast::Path, pats: impl Iterator<Item = ast::Pat>) -> ast::RecordPat {
     let pats_str = pats.map(|p| p.syntax().to_string()).join(", ");
-    return from_text(&format!("{}{{ {} }}", path.syntax(), pats_str));
+    return from_text(&format!("{} {{ {} }}", path.syntax(), pats_str));
 
     fn from_text(text: &str) -> ast::RecordPat {
         ast_from_text(&format!("fn f({}: ())", text))
diff --git a/docs/user/assists.md b/docs/user/assists.md
index 7a64c80ad5..603b29c661 100644
--- a/docs/user/assists.md
+++ b/docs/user/assists.md
@@ -191,7 +191,7 @@ enum Action { Move { distance: u32 }, Stop }
 
 fn handle(action: Action) {
     match action {
-        Action::Move{ distance } => (),
+        Action::Move { distance } => (),
         Action::Stop => (),
     }
 }
diff --git a/xtask/src/main.rs b/xtask/src/main.rs
index 04dca402c1..34eb63eb34 100644
--- a/xtask/src/main.rs
+++ b/xtask/src/main.rs
@@ -166,17 +166,6 @@ fn fix_path_for_mac() -> Result<()> {
 }
 
 fn install_client(ClientOpt::VsCode: ClientOpt) -> Result<()> {
-    let npm_version = Cmd {
-        unix: r"npm --version",
-        windows: r"cmd.exe /c npm.cmd --version",
-        work_dir: "./editors/code",
-    }
-    .run();
-
-    if npm_version.is_err() {
-        eprintln!("\nERROR: `npm --version` failed, `npm` is required to build the VS Code plugin")
-    }
-
     Cmd { unix: r"npm ci", windows: r"cmd.exe /c npm.cmd ci", work_dir: "./editors/code" }.run()?;
     Cmd {
         unix: r"npm run package",


Test patch:
diff --git a/crates/ra_assists/src/doc_tests/generated.rs b/crates/ra_assists/src/doc_tests/generated.rs
index 2f36c3baa3..43fa159d7d 100644
--- a/crates/ra_assists/src/doc_tests/generated.rs
+++ b/crates/ra_assists/src/doc_tests/generated.rs
@@ -196,7 +196,7 @@ enum Action { Move { distance: u32 }, Stop }
 
 fn handle(action: Action) {
     match action {
-        Action::Move{ distance } => (),
+        Action::Move { distance } => (),
         Action::Stop => (),
     }
 }