mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Use Clippy lint table over Cargo config (#490)
Closes https://github.com/astral-sh/puffin/issues/482.
This commit is contained in:
parent
443a0a9df2
commit
9d35128840
28 changed files with 106 additions and 43 deletions
|
@ -1,33 +0,0 @@
|
|||
[target.'cfg(all())']
|
||||
rustflags = [
|
||||
# CLIPPY LINT SETTINGS
|
||||
# This is a workaround to configure lints for the entire workspace, pending the ability to configure this via TOML.
|
||||
# See: `https://github.com/rust-lang/cargo/issues/5034`
|
||||
# `https://github.com/EmbarkStudios/rust-ecosystem/issues/22#issuecomment-947011395`
|
||||
"-Dunsafe_code",
|
||||
"-Wclippy::pedantic",
|
||||
# Allowed pedantic lints
|
||||
"-Wclippy::char_lit_as_u8",
|
||||
"-Aclippy::collapsible_else_if",
|
||||
"-Aclippy::collapsible_if",
|
||||
"-Aclippy::implicit_hasher",
|
||||
"-Aclippy::match_same_arms",
|
||||
"-Aclippy::missing_errors_doc",
|
||||
"-Aclippy::missing_panics_doc",
|
||||
"-Aclippy::module_name_repetitions",
|
||||
"-Aclippy::must_use_candidate",
|
||||
"-Aclippy::similar_names",
|
||||
"-Aclippy::too_many_lines",
|
||||
# Disallowed restriction lints
|
||||
"-Wclippy::print_stdout",
|
||||
"-Wclippy::print_stderr",
|
||||
"-Wclippy::dbg_macro",
|
||||
"-Wclippy::empty_drop",
|
||||
"-Wclippy::empty_structs_with_brackets",
|
||||
"-Wclippy::exit",
|
||||
"-Wclippy::get_unwrap",
|
||||
"-Wclippy::rc_buffer",
|
||||
"-Wclippy::rc_mutex",
|
||||
"-Wclippy::rest_pat_in_fully_bound_structs",
|
||||
"-Wunreachable_pub"
|
||||
]
|
32
Cargo.toml
32
Cargo.toml
|
@ -4,7 +4,7 @@ resolver = "2"
|
|||
|
||||
[workspace.package]
|
||||
edition = "2021"
|
||||
rust-version = "1.72"
|
||||
rust-version = "1.74"
|
||||
homepage = "https://astral.sh"
|
||||
documentation = "https://astral.sh"
|
||||
repository = "https://github.com/astral-sh/puffin"
|
||||
|
@ -93,6 +93,36 @@ zip = { version = "0.6.6", default-features = false, features = ["deflate"] }
|
|||
# For pyproject-toml
|
||||
pep508_rs = { path = "crates/pep508-rs" }
|
||||
|
||||
[workspace.lints.rust]
|
||||
unsafe_code = "warn"
|
||||
unreachable_pub = "warn"
|
||||
|
||||
[workspace.lints.clippy]
|
||||
pedantic = { level = "warn", priority = -2 }
|
||||
# Allowed pedantic lints
|
||||
char_lit_as_u8 = "allow"
|
||||
collapsible_else_if = "allow"
|
||||
collapsible_if = "allow"
|
||||
implicit_hasher = "allow"
|
||||
match_same_arms = "allow"
|
||||
missing_errors_doc = "allow"
|
||||
missing_panics_doc = "allow"
|
||||
module_name_repetitions = "allow"
|
||||
must_use_candidate = "allow"
|
||||
similar_names = "allow"
|
||||
too_many_lines = "allow"
|
||||
# Disallowed restriction lints
|
||||
print_stdout = "warn"
|
||||
print_stderr = "warn"
|
||||
dbg_macro = "warn"
|
||||
empty_drop = "warn"
|
||||
empty_structs_with_brackets = "warn"
|
||||
exit = "warn"
|
||||
get_unwrap = "warn"
|
||||
rc_buffer = "warn"
|
||||
rc_mutex = "warn"
|
||||
rest_pat_in_fully_bound_structs = "warn"
|
||||
|
||||
[profile.profiling]
|
||||
inherits = "release"
|
||||
debug = true
|
||||
|
|
|
@ -11,6 +11,9 @@ documentation = { workspace = true }
|
|||
repository = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[lib]
|
||||
bench = false
|
||||
|
||||
|
|
|
@ -9,6 +9,9 @@ repository = { workspace = true }
|
|||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
pep440_rs = { path = "../pep440-rs" }
|
||||
platform-tags = { path = "../platform-tags" }
|
||||
|
|
|
@ -9,6 +9,9 @@ repository = { workspace = true }
|
|||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
distribution-filename = { path = "../distribution-filename" }
|
||||
pep440_rs = { path = "../pep440-rs" }
|
||||
|
|
|
@ -13,6 +13,9 @@ repository = { workspace = true }
|
|||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
platform-host = { path = "../platform-host" }
|
||||
puffin-interpreter = { path = "../puffin-interpreter" }
|
||||
|
|
|
@ -13,6 +13,9 @@ repository = { workspace = true }
|
|||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[lib]
|
||||
name = "install_wheel_rs"
|
||||
|
||||
|
|
|
@ -9,6 +9,9 @@ repository = { workspace = true }
|
|||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
fs-err = { workspace = true }
|
||||
goblin = { workspace = true }
|
||||
|
|
|
@ -139,21 +139,21 @@ mod tests {
|
|||
#[test]
|
||||
fn parse_ldd_output() {
|
||||
let ver_str = ldd_output_to_version_str(
|
||||
r#"ldd (GNU libc) 2.12
|
||||
r"ldd (GNU libc) 2.12
|
||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
Written by Roland McGrath and Ulrich Drepper."#,
|
||||
Written by Roland McGrath and Ulrich Drepper.",
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(ver_str, "2.12");
|
||||
|
||||
let ver_str = ldd_output_to_version_str(
|
||||
r#"ldd (Ubuntu GLIBC 2.31-0ubuntu9.2) 2.31
|
||||
r"ldd (Ubuntu GLIBC 2.31-0ubuntu9.2) 2.31
|
||||
Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
Written by Roland McGrath and Ulrich Drepper."#,
|
||||
Written by Roland McGrath and Ulrich Drepper.",
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(ver_str, "2.31");
|
||||
|
|
|
@ -9,6 +9,9 @@ repository = { workspace = true }
|
|||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
platform-host = { path = "../platform-host" }
|
||||
|
||||
|
|
|
@ -10,6 +10,9 @@ repository = { workspace = true }
|
|||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
gourgeist = { path = "../gourgeist" }
|
||||
pep508_rs = { path = "../pep508-rs" }
|
||||
|
|
|
@ -646,13 +646,13 @@ mod test {
|
|||
fn missing_header() {
|
||||
let output = Output {
|
||||
status: ExitStatus::default(), // This is wrong but `from_raw` is platform gated
|
||||
stdout: indoc!(r#"
|
||||
stdout: indoc!(r"
|
||||
running bdist_wheel
|
||||
running build
|
||||
[...]
|
||||
creating build/temp.linux-x86_64-cpython-39/pygraphviz
|
||||
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DOPENSSL_NO_SSL3 -fPIC -DSWIG_PYTHON_STRICT_BYTE_CHAR -I/tmp/.tmpy6vVes/.venv/include -I/home/konsti/.pyenv/versions/3.9.18/include/python3.9 -c pygraphviz/graphviz_wrap.c -o build/temp.linux-x86_64-cpython-39/pygraphviz/graphviz_wrap.o
|
||||
"#
|
||||
"
|
||||
).as_bytes().to_vec(),
|
||||
stderr: indoc!(r#"
|
||||
warning: no files found matching '*.png' under directory 'doc'
|
||||
|
|
|
@ -10,6 +10,9 @@ repository = { workspace = true }
|
|||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
distribution-filename = { path = "../distribution-filename" }
|
||||
pypi-types = { path = "../pypi-types" }
|
||||
|
|
|
@ -9,6 +9,9 @@ repository = { workspace = true }
|
|||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[[bin]]
|
||||
name = "puffin"
|
||||
path = "src/main.rs"
|
||||
|
|
|
@ -10,6 +10,9 @@ repository = { workspace = true }
|
|||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
distribution-filename = { path = "../distribution-filename" }
|
||||
gourgeist = { path = "../gourgeist" }
|
||||
|
|
|
@ -10,6 +10,9 @@ repository = { workspace = true }
|
|||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
distribution-types = { path = "../distribution-types" }
|
||||
gourgeist = { path = "../gourgeist" }
|
||||
|
|
|
@ -9,6 +9,9 @@ repository = { workspace = true }
|
|||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
distribution-filename = { path = "../distribution-filename" }
|
||||
distribution-types = { path = "../distribution-types" }
|
||||
|
|
|
@ -9,6 +9,9 @@ repository = { workspace = true }
|
|||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
puffin-cache = { path = "../puffin-cache" }
|
||||
|
||||
|
|
|
@ -9,6 +9,9 @@ repository = { workspace = true }
|
|||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
distribution-filename = { path = "../distribution-filename" }
|
||||
install-wheel-rs = { path = "../install-wheel-rs", default-features = false }
|
||||
|
|
|
@ -9,6 +9,9 @@ repository = { workspace = true }
|
|||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
pep440_rs = { path = "../pep440-rs" }
|
||||
pep508_rs = { path = "../pep508-rs", features = ["serde"] }
|
||||
|
|
|
@ -9,6 +9,9 @@ repository = { workspace = true }
|
|||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
colored = { workspace = true }
|
||||
fxhash = { workspace = true }
|
||||
|
|
|
@ -9,6 +9,9 @@ repository = { workspace = true }
|
|||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
distribution-filename = { path = "../distribution-filename" }
|
||||
install-wheel-rs = { path = "../install-wheel-rs" }
|
||||
|
|
|
@ -9,6 +9,9 @@ repository = { workspace = true }
|
|||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
pep508_rs = { path = "../pep508-rs" }
|
||||
puffin-interpreter = { path = "../puffin-interpreter" }
|
||||
|
|
|
@ -9,6 +9,9 @@ repository = { workspace = true }
|
|||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
pep440_rs = { path = "../pep440-rs" }
|
||||
pep508_rs = { path = "../pep508-rs" }
|
||||
|
|
|
@ -9,6 +9,9 @@ repository = { workspace = true }
|
|||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
pep440_rs = { path = "../pep440-rs", features = ["serde"] }
|
||||
pep508_rs = { path = "../pep508-rs", features = ["serde"] }
|
||||
|
|
|
@ -9,6 +9,9 @@ repository = { workspace = true }
|
|||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
pep440_rs = { path = "../pep440-rs", features = ["serde"] }
|
||||
pep508_rs = { path = "../pep508-rs", features = ["serde"] }
|
||||
|
|
|
@ -489,7 +489,7 @@ mod test {
|
|||
let working_dir = workspace_test_data_dir().join("requirements-txt");
|
||||
let requirements_txt = working_dir.join(path);
|
||||
|
||||
let actual = RequirementsTxt::parse(&requirements_txt, &working_dir).unwrap();
|
||||
let actual = RequirementsTxt::parse(requirements_txt, &working_dir).unwrap();
|
||||
|
||||
let snapshot = format!("parse-{}", path.to_string_lossy());
|
||||
insta::assert_debug_snapshot!(snapshot, actual);
|
||||
|
@ -521,7 +521,7 @@ mod test {
|
|||
// Write to a new file.
|
||||
let temp_dir = tempdir().unwrap();
|
||||
let requirements_txt = temp_dir.path().join(path);
|
||||
fs::write(&requirements_txt, &contents).unwrap();
|
||||
fs::write(&requirements_txt, contents).unwrap();
|
||||
|
||||
let actual = RequirementsTxt::parse(&requirements_txt, &working_dir).unwrap();
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
[toolchain]
|
||||
channel = "1.73"
|
||||
channel = "1.74"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue