Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use more workspace-wide configurations #4061

Merged
merged 4 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
name = "rustup"
version = "1.27.1"
edition = "2021"
version.workspace = true
edition.workspace = true
license.workspace = true
description = "Manage multiple rust installations with ease"
homepage = "https://github.com/rust-lang/rustup"
keywords = ["rustup", "multirust", "install", "proxy"]
license = "MIT OR Apache-2.0"
readme = "README.md"
repository = "https://github.com/rust-lang/rustup"
build = "build.rs"
Expand Down Expand Up @@ -130,9 +130,17 @@ trycmd = "0.15.0"
platforms.workspace = true
regex = "1"

[lints]
workspace = true

[workspace]
members = ["download"]

[workspace.package]
version = "1.27.1"
edition = "2021"
license = "MIT OR Apache-2.0"

[workspace.dependencies]
anyhow = "1.0.69"
fs_at = "0.2.1"
Expand All @@ -153,6 +161,14 @@ tracing-subscriber = "0.3.16"
url = "2.4"
walkdir = "2"

[workspace.lints.rust]
rust_2018_idioms = "deny"

[workspace.lints.clippy]
# `dbg!()` and `todo!()` clearly shouldn't make it to production:
dbg_macro = "warn"
todo = "warn"

[lib]
name = "rustup"
path = "src/lib.rs"
Expand Down
9 changes: 6 additions & 3 deletions download/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "download"
version = "1.27.1"
edition = "2021"
license = "MIT OR Apache-2.0"
version.workspace = true
edition.workspace = true
license.workspace = true

[features]
default = ["reqwest-backend", "reqwest-rustls-tls", "reqwest-native-tls"]
Expand Down Expand Up @@ -32,3 +32,6 @@ http-body-util = "0.1.0"
hyper = { version = "1.0", default-features = false, features = ["server", "http1"] }
hyper-util = { version = "0.1.1", features = ["tokio"] }
tempfile.workspace = true

[lints]
workspace = true
1 change: 0 additions & 1 deletion download/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//! Easy file downloading
#![deny(rust_2018_idioms)]

use std::fs::remove_file;
use std::path::Path;
Expand Down
3 changes: 2 additions & 1 deletion src/cli/rustup_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,8 @@ pub async fn main(
}

let Some(subcmd) = matches.subcmd else {
eprintln!("{}", Rustup::command().render_long_help());
let help = Rustup::command().render_long_help();
writeln!(process.stderr().lock(), "{help}")?;
return Ok(utils::ExitCode(1));
};

Expand Down
1 change: 1 addition & 0 deletions src/diskio/threaded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ impl<'a> Executor for Threaded<'a> {
prev_files as u64,
));
}
#[allow(clippy::print_stderr)]
rami3l marked this conversation as resolved.
Show resolved Hide resolved
if prev_files > 50 {
eprintln!("{prev_files} deferred IO operations");
}
Expand Down
6 changes: 5 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
#![deny(rust_2018_idioms)]
#![allow(
clippy::type_complexity,
clippy::result_large_err, // 288 bytes is our 'large' variant today, which is unlikely to be a performance problem
clippy::arc_with_non_send_sync, // will get resolved as we move further into async
)]
#![cfg_attr(not(test), warn(
// We use the logging system instead of printing directly.
clippy::print_stdout,
clippy::print_stderr,
))]
#![recursion_limit = "1024"]

use anyhow::{anyhow, Result};
Expand Down
2 changes: 1 addition & 1 deletion src/test.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(clippy::box_default)]
#![allow(clippy::box_default, clippy::print_stdout, clippy::print_stderr)]
//! Test support module; public to permit use from integration tests.

pub mod mock;
Expand Down
7 changes: 5 additions & 2 deletions src/test/mock/clitools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -668,8 +668,11 @@ impl Config {
println!("expected.ok: true");
print_indented("expected.stdout", stdout);
print_indented("expected.stderr", stderr);
dbg!(out.stdout == stdout);
rami3l marked this conversation as resolved.
Show resolved Hide resolved
dbg!(out.stderr == stderr);
#[allow(clippy::dbg_macro)]
{
dbg!(out.stdout == stdout);
dbg!(out.stderr == stderr);
}
panic!();
}
}
Expand Down
Loading