Skip to content

Commit 2f3fb76

Browse files
committed
Fix clippy lints
1 parent 47171d9 commit 2f3fb76

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

crates/plugins/java/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ fn instantiate_jvm() -> Result<JvmWrapper, JavaError> {
138138
let tmc_dir = tmc_dir()?;
139139

140140
// j4rs may panic
141-
let jvm = match std::panic::catch_unwind(|| -> Result<Jvm, JavaError> {
141+
let catch = std::panic::catch_unwind(|| -> Result<Jvm, JavaError> {
142142
let jvm = JvmBuilder::new()
143143
.with_base_path(
144144
tmc_dir
@@ -152,7 +152,8 @@ fn instantiate_jvm() -> Result<JvmWrapper, JavaError> {
152152
.build()
153153
.map_err(JavaError::j4rs)?;
154154
Ok(jvm)
155-
}) {
155+
});
156+
let jvm = match catch {
156157
Ok(jvm_result) => jvm_result?,
157158
Err(jvm_panic) => {
158159
// try to extract error message from panic, if any

crates/plugins/r/src/r_run_result.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Struct modeling the test run results from R.
22
33
use serde::{Deserialize, Serialize};
4-
use std::collections::HashMap;
4+
use std::{collections::HashMap, fmt::Write};
55
use tmc_langs_framework::{RunResult, RunStatus, TestResult};
66

77
#[derive(Debug, Deserialize, Serialize)]
@@ -21,8 +21,10 @@ impl From<RRunResult> for RunResult {
2121
r_run_result
2222
.backtrace
2323
.into_iter()
24-
.map(|s| format!("{s}\n"))
25-
.collect(),
24+
.fold(String::new(), |mut output, s| {
25+
let _ = writeln!(output, "{s}");
26+
output
27+
}),
2628
);
2729
}
2830
let status = match r_run_result.run_status {

crates/tmc-langs-cli/src/main.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fn main() -> ExitCode {
2222
"TRACE" => "TRACE,reqwest=DEBUG,rustls=DEBUG",
2323
other => other,
2424
};
25-
let _ = std::env::set_var("RUST_LOG", level);
25+
std::env::set_var("RUST_LOG", level);
2626
}
2727

2828
env_logger::init();
@@ -56,10 +56,11 @@ fn run() -> Result<(), ()> {
5656
}
5757
};
5858
let pretty = cli.pretty;
59-
match std::panic::catch_unwind(|| {
59+
let catch = std::panic::catch_unwind(|| {
6060
register_reporters(pretty);
6161
tmc_langs_cli::run(cli)
62-
}) {
62+
});
63+
match catch {
6364
Ok(Ok(output)) => {
6465
print_output(&output, pretty, None).map_err(|_| ())?;
6566
Ok(())

crates/tmc-testmycode-client/src/client/api_v8.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use serde::de::DeserializeOwned;
1313
use std::{
1414
collections::HashMap,
1515
io::{Read, Write},
16-
time::SystemTime,
1716
};
1817
use tmc_langs_plugins::Language;
1918
use tmc_langs_util::deserialize;

0 commit comments

Comments
 (0)