From ed47c93afe7f9dd2c27956905e7fb9fcf9d5baf2 Mon Sep 17 00:00:00 2001 From: Aleksander Vognild Burkow Date: Sat, 29 Dec 2018 22:19:35 +0100 Subject: Install rustfmt in rustfmt test --- crates/ra_lsp_server/Cargo.toml | 1 + crates/ra_lsp_server/tests/heavy_tests/main.rs | 2 ++ crates/tools/src/lib.rs | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) (limited to 'crates') diff --git a/crates/ra_lsp_server/Cargo.toml b/crates/ra_lsp_server/Cargo.toml index c53106a62..f8f91e5e7 100644 --- a/crates/ra_lsp_server/Cargo.toml +++ b/crates/ra_lsp_server/Cargo.toml @@ -33,6 +33,7 @@ ra_text_edit = { path = "../ra_text_edit" } ra_analysis = { path = "../ra_analysis" } gen_lsp_server = { path = "../gen_lsp_server" } ra_vfs = { path = "../ra_vfs" } +tools = { path = "../tools" } [dev-dependencies] tempdir = "0.3.7" diff --git a/crates/ra_lsp_server/tests/heavy_tests/main.rs b/crates/ra_lsp_server/tests/heavy_tests/main.rs index e9f02a6e4..b0e1e65b6 100644 --- a/crates/ra_lsp_server/tests/heavy_tests/main.rs +++ b/crates/ra_lsp_server/tests/heavy_tests/main.rs @@ -121,6 +121,8 @@ fn test_eggs() {} use std::collections::HashMap; #[test] fn test_format_document() { + tools::install_rustfmt().unwrap(); + let server = project( r#" [package] diff --git a/crates/tools/src/lib.rs b/crates/tools/src/lib.rs index 6f96b8120..e5b32c25c 100644 --- a/crates/tools/src/lib.rs +++ b/crates/tools/src/lib.rs @@ -117,7 +117,7 @@ pub fn run_rustfmt(mode: Mode) -> Result<()> { Ok(()) } -fn install_rustfmt() -> Result<()> { +pub fn install_rustfmt() -> Result<()> { run(&format!("rustup install {}", TOOLCHAIN), ".")?; run( &format!("rustup component add rustfmt --toolchain {}", TOOLCHAIN), -- cgit v1.2.3