Skip to content

Commit

Permalink
Fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
Heliozoa committed Feb 21, 2024
1 parent 47171d9 commit 2f3fb76
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
5 changes: 3 additions & 2 deletions crates/plugins/java/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ fn instantiate_jvm() -> Result<JvmWrapper, JavaError> {
let tmc_dir = tmc_dir()?;

// j4rs may panic
let jvm = match std::panic::catch_unwind(|| -> Result<Jvm, JavaError> {
let catch = std::panic::catch_unwind(|| -> Result<Jvm, JavaError> {
let jvm = JvmBuilder::new()
.with_base_path(
tmc_dir
Expand All @@ -152,7 +152,8 @@ fn instantiate_jvm() -> Result<JvmWrapper, JavaError> {
.build()
.map_err(JavaError::j4rs)?;
Ok(jvm)
}) {
});
let jvm = match catch {
Ok(jvm_result) => jvm_result?,
Err(jvm_panic) => {
// try to extract error message from panic, if any
Expand Down
8 changes: 5 additions & 3 deletions crates/plugins/r/src/r_run_result.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Struct modeling the test run results from R.
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::{collections::HashMap, fmt::Write};
use tmc_langs_framework::{RunResult, RunStatus, TestResult};

#[derive(Debug, Deserialize, Serialize)]
Expand All @@ -21,8 +21,10 @@ impl From<RRunResult> for RunResult {
r_run_result
.backtrace
.into_iter()
.map(|s| format!("{s}\n"))
.collect(),
.fold(String::new(), |mut output, s| {
let _ = writeln!(output, "{s}");
output
}),
);
}
let status = match r_run_result.run_status {
Expand Down
7 changes: 4 additions & 3 deletions crates/tmc-langs-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fn main() -> ExitCode {
"TRACE" => "TRACE,reqwest=DEBUG,rustls=DEBUG",
other => other,
};
let _ = std::env::set_var("RUST_LOG", level);
std::env::set_var("RUST_LOG", level);
}

env_logger::init();
Expand Down Expand Up @@ -56,10 +56,11 @@ fn run() -> Result<(), ()> {
}
};
let pretty = cli.pretty;
match std::panic::catch_unwind(|| {
let catch = std::panic::catch_unwind(|| {
register_reporters(pretty);
tmc_langs_cli::run(cli)
}) {
});
match catch {
Ok(Ok(output)) => {
print_output(&output, pretty, None).map_err(|_| ())?;
Ok(())
Expand Down
1 change: 0 additions & 1 deletion crates/tmc-testmycode-client/src/client/api_v8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use serde::de::DeserializeOwned;
use std::{
collections::HashMap,
io::{Read, Write},
time::SystemTime,
};
use tmc_langs_plugins::Language;
use tmc_langs_util::deserialize;
Expand Down

0 comments on commit 2f3fb76

Please sign in to comment.