Skip to content

Commit d9dcfd8

Browse files
committed
Simplify xtask
lib/bin/test separation isn't really needed.
1 parent c17f2bf commit d9dcfd8

17 files changed

+167
-180
lines changed

xtask/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ authors = ["rust-analyzer developers"]
66
publish = false
77
license = "MIT OR Apache-2.0"
88

9-
[lib]
10-
doctest = false
11-
129
[dependencies]
1310
anyhow = "1.0.26"
1411
flate2 = "1.0"

xtask/src/codegen.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use xshell::{cmd, pushenv, read_file, write_file};
2020

2121
use crate::{ensure_rustfmt, project_root, Result};
2222

23-
pub use self::{
23+
pub(crate) use self::{
2424
gen_assists_docs::{generate_assists_docs, generate_assists_tests},
2525
gen_diagnostic_docs::generate_diagnostic_docs,
2626
gen_feature_docs::generate_feature_docs,
@@ -30,17 +30,17 @@ pub use self::{
3030
};
3131

3232
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
33-
pub enum Mode {
33+
pub(crate) enum Mode {
3434
Overwrite,
3535
Verify,
3636
}
3737

38-
pub struct CodegenCmd {
39-
pub features: bool,
38+
pub(crate) struct CodegenCmd {
39+
pub(crate) features: bool,
4040
}
4141

4242
impl CodegenCmd {
43-
pub fn run(self) -> Result<()> {
43+
pub(crate) fn run(self) -> Result<()> {
4444
if self.features {
4545
generate_lint_completions(Mode::Overwrite)?;
4646
}

xtask/src/codegen/gen_assists_docs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ use crate::{
77
project_root, rust_files_in, Result,
88
};
99

10-
pub fn generate_assists_tests(mode: Mode) -> Result<()> {
10+
pub(crate) fn generate_assists_tests(mode: Mode) -> Result<()> {
1111
let assists = Assist::collect()?;
1212
generate_tests(&assists, mode)
1313
}
1414

15-
pub fn generate_assists_docs(mode: Mode) -> Result<()> {
15+
pub(crate) fn generate_assists_docs(mode: Mode) -> Result<()> {
1616
let assists = Assist::collect()?;
1717
let contents = assists.into_iter().map(|it| it.to_string()).collect::<Vec<_>>().join("\n\n");
1818
let contents = format!("//{}\n{}\n", PREAMBLE, contents.trim());

xtask/src/codegen/gen_diagnostic_docs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::{
77
project_root, rust_files, Result,
88
};
99

10-
pub fn generate_diagnostic_docs(mode: Mode) -> Result<()> {
10+
pub(crate) fn generate_diagnostic_docs(mode: Mode) -> Result<()> {
1111
let diagnostics = Diagnostic::collect()?;
1212
let contents =
1313
diagnostics.into_iter().map(|it| it.to_string()).collect::<Vec<_>>().join("\n\n");

xtask/src/codegen/gen_feature_docs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::{
77
project_root, rust_files, Result,
88
};
99

10-
pub fn generate_feature_docs(mode: Mode) -> Result<()> {
10+
pub(crate) fn generate_feature_docs(mode: Mode) -> Result<()> {
1111
let features = Feature::collect()?;
1212
let contents = features.into_iter().map(|it| it.to_string()).collect::<Vec<_>>().join("\n\n");
1313
let contents = format!("//{}\n{}\n", PREAMBLE, contents.trim());

xtask/src/codegen/gen_lint_completions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::{
1010
run_rustfmt,
1111
};
1212

13-
pub fn generate_lint_completions(mode: Mode) -> Result<()> {
13+
pub(crate) fn generate_lint_completions(mode: Mode) -> Result<()> {
1414
if !Path::new("./target/rust").exists() {
1515
cmd!("git clone --depth=1 https://github.com/rust-lang/rust ./target/rust").run()?;
1616
}

xtask/src/codegen/gen_parser_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::{
1212
project_root, Result,
1313
};
1414

15-
pub fn generate_parser_tests(mode: Mode) -> Result<()> {
15+
pub(crate) fn generate_parser_tests(mode: Mode) -> Result<()> {
1616
let tests = tests_from_dir(&project_root().join(Path::new("crates/parser/src/grammar")))?;
1717
fn install_tests(tests: &HashMap<String, Test>, into: &str, mode: Mode) -> Result<()> {
1818
let tests_dir = project_root().join(into);

xtask/src/codegen/gen_syntax.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use crate::{
1818
project_root, Result,
1919
};
2020

21-
pub fn generate_syntax(mode: Mode) -> Result<()> {
21+
pub(crate) fn generate_syntax(mode: Mode) -> Result<()> {
2222
let grammar = rust_grammar();
2323
let ast = lower(&grammar);
2424

xtask/src/dist.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ use xshell::{cmd, cp, mkdir_p, pushd, read_file, rm_rf, write_file};
1111

1212
use crate::{date_iso, project_root};
1313

14-
pub struct DistCmd {
15-
pub nightly: bool,
16-
pub client_version: Option<String>,
14+
pub(crate) struct DistCmd {
15+
pub(crate) nightly: bool,
16+
pub(crate) client_version: Option<String>,
1717
}
1818

1919
impl DistCmd {
20-
pub fn run(self) -> Result<()> {
20+
pub(crate) fn run(self) -> Result<()> {
2121
let dist = project_root().join("dist");
2222
rm_rf(&dist)?;
2323
mkdir_p(&dist)?;

xtask/src/install.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ use xshell::{cmd, pushd};
88
// Latest stable, feel free to send a PR if this lags behind.
99
const REQUIRED_RUST_VERSION: u32 = 50;
1010

11-
pub struct InstallCmd {
12-
pub client: Option<ClientOpt>,
13-
pub server: Option<ServerOpt>,
11+
pub(crate) struct InstallCmd {
12+
pub(crate) client: Option<ClientOpt>,
13+
pub(crate) server: Option<ServerOpt>,
1414
}
1515

1616
#[derive(Clone, Copy)]
17-
pub enum ClientOpt {
17+
pub(crate) enum ClientOpt {
1818
VsCode,
1919
VsCodeExploration,
2020
VsCodeInsiders,
@@ -24,7 +24,7 @@ pub enum ClientOpt {
2424
}
2525

2626
impl ClientOpt {
27-
pub const fn as_cmds(&self) -> &'static [&'static str] {
27+
pub(crate) const fn as_cmds(&self) -> &'static [&'static str] {
2828
match self {
2929
ClientOpt::VsCode => &["code"],
3030
ClientOpt::VsCodeExploration => &["code-exploration"],
@@ -60,18 +60,18 @@ impl std::str::FromStr for ClientOpt {
6060
}
6161
}
6262

63-
pub struct ServerOpt {
64-
pub malloc: Malloc,
63+
pub(crate) struct ServerOpt {
64+
pub(crate) malloc: Malloc,
6565
}
6666

67-
pub enum Malloc {
67+
pub(crate) enum Malloc {
6868
System,
6969
Mimalloc,
7070
Jemalloc,
7171
}
7272

7373
impl InstallCmd {
74-
pub fn run(self) -> Result<()> {
74+
pub(crate) fn run(self) -> Result<()> {
7575
if cfg!(target_os = "macos") {
7676
fix_path_for_mac().context("Fix path for mac")?
7777
}

0 commit comments

Comments
 (0)