Skip to content

Commit f481181

Browse files
committed
Run rustfmt directly on CI
1 parent c125e8c commit f481181

File tree

2 files changed

+5
-22
lines changed

2 files changed

+5
-22
lines changed

.github/workflows/ci.yaml

+5-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
rustup update --no-self-update ${{ env.RUST_CHANNEL }}
6666
rustup component add --toolchain ${{ env.RUST_CHANNEL }} rustfmt rust-src
6767
rustup default ${{ env.RUST_CHANNEL }}
68-
68+
# https://github.com/actions-rust-lang/setup-rust-toolchain/blob/main/rust.json
6969
- name: Install Rust Problem Matcher
7070
if: matrix.os == 'ubuntu-latest'
7171
run: echo "::add-matcher::.github/rust.json"
@@ -111,6 +111,10 @@ jobs:
111111
if: matrix.os == 'windows-latest'
112112
run: cargo clippy --all-targets -- -D clippy::disallowed_macros -D clippy::dbg_macro -D clippy::todo -D clippy::print_stdout -D clippy::print_stderr
113113

114+
- name: rustfmt
115+
if: matrix.os == 'ubuntu-latest'
116+
run: cargo fmt -- --check
117+
114118
# Weird targets to catch non-portable code
115119
rust-cross:
116120
if: github.repository == 'rust-lang/rust-analyzer'

crates/rust-analyzer/tests/slow-tests/tidy.rs

-21
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,6 @@ use xshell::Shell;
99
#[cfg(not(feature = "in-rust-tree"))]
1010
use xshell::cmd;
1111

12-
#[cfg(not(feature = "in-rust-tree"))]
13-
#[test]
14-
fn check_code_formatting() {
15-
let sh = &Shell::new().unwrap();
16-
sh.change_dir(sourcegen::project_root());
17-
18-
let out = cmd!(sh, "rustup run stable rustfmt --version").read().unwrap();
19-
if !out.contains("stable") {
20-
panic!(
21-
"Failed to run rustfmt from toolchain 'stable'. \
22-
Please run `rustup component add rustfmt --toolchain stable` to install it.",
23-
)
24-
}
25-
26-
let res = cmd!(sh, "rustup run stable cargo fmt -- --check").run();
27-
if res.is_err() {
28-
let _ = cmd!(sh, "rustup run stable cargo fmt").run();
29-
}
30-
res.unwrap()
31-
}
32-
3312
#[test]
3413
fn check_lsp_extensions_docs() {
3514
let sh = &Shell::new().unwrap();

0 commit comments

Comments
 (0)