Skip to content
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
8 changes: 4 additions & 4 deletions src/init/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,10 @@ fn compute_desired_tools(
}
if categories.contains(&check.category) {
let entry = by_key.entry(key.to_string()).or_default();
if let Some(comp) = check.mise_install_components {
if !entry.contains(&comp) {
entry.push(comp);
}
if let Some(comp) = check.mise_install_components
&& !entry.contains(&comp)
{
entry.push(comp);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/linters/renovate_deps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ mod tests {
format!(r#"{{"msg":"Extracted dependencies","packageFiles":{config_json}}}"#).into_bytes()
}

#[allow(clippy::type_complexity)]
fn dep_map(entries: &[(&str, &[(&str, &[&str])])]) -> DepMap {
entries
.iter()
Expand Down
18 changes: 11 additions & 7 deletions src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,12 +498,16 @@ fn check_biome_format() -> Check {
}

fn check_cargo_clippy() -> Check {
Check::project("cargo-clippy", "cargo clippy -q -- -D warnings", &["*.rs"])
.fix("cargo clippy -q --fix --allow-dirty --allow-staged -- -D warnings")
.mise_tool("rust")
.install_components("clippy")
.desc("Lint Rust code; runs on all .rs files, not just changed")
.lang()
Check::project(
"cargo-clippy",
"cargo clippy -q --all-targets -- -D warnings",
&["*.rs"],
)
.fix("cargo clippy -q --all-targets --fix --allow-dirty --allow-staged -- -D warnings")
.mise_tool("rust")
.install_components("clippy")
.desc("Lint Rust code; runs on all .rs files, not just changed")
.lang()
Comment thread
zeitlinger marked this conversation as resolved.
}

fn check_cargo_fmt() -> Check {
Expand Down Expand Up @@ -1008,7 +1012,7 @@ mod tests {
};
let separator: Vec<String> = widths.iter().map(|&w| "-".repeat(w)).collect();
let sep_row = format!("| {} |", separator.join(" | "));
let header_strs: Vec<&str> = headers.iter().copied().collect();
let header_strs: Vec<&str> = headers.to_vec();

let mut lines = vec![
generated_comment.to_string(),
Expand Down
4 changes: 4 additions & 0 deletions tests/cases/cargo-clippy/failure-in-tests/files/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[package]
name = "test"
version = "0.1.0"
edition = "2024"
2 changes: 2 additions & 0 deletions tests/cases/cargo-clippy/failure-in-tests/files/mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[tools]
rust = "latest"
13 changes: 13 additions & 0 deletions tests/cases/cargo-clippy/failure-in-tests/files/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
pub fn add(x: i32, y: i32) -> i32 {
x + y
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn unused_var() {
let result = add(1, 2);
}
}
19 changes: 19 additions & 0 deletions tests/cases/cargo-clippy/failure-in-tests/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[expected]
args = "run --full cargo-clippy"
exit = 1
stderr = '''
[cargo-clippy]
error: unused variable: `result`
--> src/lib.rs:11:13
|
11 | let result = add(1, 2);
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_result`
|
= note: `-D unused-variables` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(unused_variables)]`

error: could not compile `test` (lib test) due to 1 previous error

flint: 1 check failed (cargo-clippy)
💡 Try `flint run --fix` to auto-fix lint issues, then re-run `flint run` to verify.
'''
1 change: 1 addition & 0 deletions tests/cases/cargo-clippy/failure/test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ error: equal expressions as operands to `==`
= note: `#[deny(clippy::eq_op)]` on by default

error: could not compile `test` (lib) due to 1 previous error
error: could not compile `test` (lib test) due to 1 previous error

flint: 1 check failed (cargo-clippy)
💡 Try `flint run --fix` to auto-fix lint issues, then re-run `flint run` to verify.
Expand Down
28 changes: 14 additions & 14 deletions tests/e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,26 +346,26 @@ fn write_test_toml(path: &Path, cfg: &toml::Value, exit: i32, stderr: &str, stdo
}
}

if let Some(env) = cfg.get("env").and_then(|v| v.as_table()) {
if !env.is_empty() {
out += "\n\n[env]\n";
for (k, v) in env {
if let Some(s) = v.as_str() {
out += &format!("{k} = \"{}\"\n", toml_escape(s));
}
if let Some(env) = cfg.get("env").and_then(|v| v.as_table())
&& !env.is_empty()
{
out += "\n\n[env]\n";
for (k, v) in env {
if let Some(s) = v.as_str() {
out += &format!("{k} = \"{}\"\n", toml_escape(s));
}
}
}

// Serialize as multiline literal strings so shell scripts stay readable.
// TOML trims the first newline after ''', so '''\n{s}''' roundtrips cleanly.
if let Some(bins) = cfg.get("fake_bins").and_then(|v| v.as_table()) {
if !bins.is_empty() {
out += "\n[fake_bins]\n";
for (k, v) in bins {
if let Some(s) = v.as_str() {
out += &format!("{k} = '''\n{s}'''\n");
}
if let Some(bins) = cfg.get("fake_bins").and_then(|v| v.as_table())
&& !bins.is_empty()
{
out += "\n[fake_bins]\n";
for (k, v) in bins {
if let Some(s) = v.as_str() {
out += &format!("{k} = '''\n{s}'''\n");
}
}
}
Expand Down
Loading