Skip to content

Commit 58896d6

Browse files
committed
clippy lints
1 parent fb0ae0c commit 58896d6

File tree

9 files changed

+22
-29
lines changed

9 files changed

+22
-29
lines changed

plugins/java/src/ant.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,16 @@ use super::{error::JavaError, plugin::JavaPlugin, CompileResult, TestRun, SEPARA
66

77
use j4rs::Jvm;
88
use policy::AntStudentFilePolicy;
9-
use std::collections::HashSet;
109
use std::env;
1110
use std::fs::{self, File};
1211
use std::io::Write;
13-
use std::io::{Read, Seek};
1412
use std::path::{Path, PathBuf};
1513
use std::process::Stdio;
1614
use std::time::Duration;
1715
use tmc_langs_framework::{
1816
command::TmcCommand,
1917
domain::{ExerciseDesc, RunResult, ValidationResult},
2018
plugin::{Language, LanguagePlugin},
21-
zip::ZipArchive,
2219
TmcError,
2320
};
2421
use walkdir::WalkDir;
@@ -299,6 +296,7 @@ mod test {
299296
use super::*;
300297
use tempfile::{tempdir, TempDir};
301298
use tmc_langs_framework::domain::Strategy;
299+
use tmc_langs_framework::zip::ZipArchive;
302300

303301
fn init() {
304302
let _ = env_logger::builder().is_test(true).try_init();

plugins/java/src/maven.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ use super::{error::JavaError, plugin::JavaPlugin, CompileResult, TestRun, SEPARA
77
use flate2::read::GzDecoder;
88
use j4rs::Jvm;
99
use policy::MavenStudentFilePolicy;
10-
use std::ffi::{OsStr, OsString};
10+
use std::ffi::OsString;
1111
use std::fs;
12-
use std::io::{Cursor, Read, Seek};
12+
use std::io::Cursor;
1313
use std::path::{Path, PathBuf};
1414
use std::process::Stdio;
1515
use std::time::Duration;
@@ -18,7 +18,6 @@ use tmc_langs_framework::{
1818
command::TmcCommand,
1919
domain::{ExerciseDesc, RunResult, ValidationResult},
2020
plugin::{Language, LanguagePlugin},
21-
zip::ZipArchive,
2221
TmcError,
2322
};
2423

@@ -272,6 +271,7 @@ mod test {
272271
use std::fs::File;
273272
use tempfile::{tempdir, TempDir};
274273
use tmc_langs_framework::domain::Strategy;
274+
use tmc_langs_framework::zip::ZipArchive;
275275
use walkdir::WalkDir;
276276

277277
#[cfg(windows)]

plugins/make/src/plugin.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,14 @@ use crate::valgrind_log::ValgrindLog;
88
use lazy_static::lazy_static;
99
use regex::Regex;
1010
use std::collections::HashMap;
11-
use std::ffi::OsStr;
1211
use std::fs::File;
13-
use std::io;
14-
use std::io::{BufRead, BufReader, Read, Seek};
15-
use std::path::{Path, PathBuf};
12+
use std::io::{self, BufRead, BufReader, Read};
13+
use std::path::Path;
1614
use std::time::Duration;
1715
use tmc_langs_framework::{
1816
command::TmcCommand,
1917
domain::{ExerciseDesc, RunResult, RunStatus, TestDesc, TmcProjectYml},
2018
plugin::LanguagePlugin,
21-
zip::ZipArchive,
2219
TmcError,
2320
};
2421

@@ -278,6 +275,7 @@ mod test {
278275
use super::*;
279276
use std::path::PathBuf;
280277
use tempfile::{tempdir, TempDir};
278+
use tmc_langs_framework::zip::ZipArchive;
281279

282280
fn init() {
283281
let _ = env_logger::builder().is_test(true).try_init();
@@ -296,9 +294,9 @@ mod test {
296294
.skip(path.components().count())
297295
.collect();
298296
let temp_path = temp.path().join(entry_path);
299-
temp_path
300-
.parent()
301-
.map(|p| std::fs::create_dir_all(&p).unwrap());
297+
if let Some(parent) = temp_path.parent() {
298+
std::fs::create_dir_all(parent).unwrap();
299+
}
302300
log::trace!("copying {:?} -> {:?}", entry.path(), temp_path);
303301
std::fs::copy(entry.path(), temp_path).unwrap();
304302
}

plugins/python3/src/plugin.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@ use crate::policy::Python3StudentFilePolicy;
55
use crate::{LocalPy, PythonTestResult, LOCAL_PY};
66

77
use std::collections::HashMap;
8-
use std::ffi::OsStr;
98
use std::fs::{self, File};
10-
use std::io::{BufReader, Read, Seek};
11-
use std::path::{Path, PathBuf};
9+
use std::io::BufReader;
10+
use std::path::Path;
1211
use std::time::Duration;
1312
use tmc_langs_framework::{
1413
command::{OutputWithTimeout, TmcCommand},
1514
domain::{ExerciseDesc, RunResult, RunStatus, TestDesc, TestResult},
1615
plugin::LanguagePlugin,
17-
zip::ZipArchive,
1816
TmcError,
1917
};
2018
use walkdir::WalkDir;
@@ -208,6 +206,7 @@ mod test {
208206
use super::*;
209207
use std::path::{Path, PathBuf};
210208
use tempfile::{tempdir, TempDir};
209+
use tmc_langs_framework::zip::ZipArchive;
211210
use tmc_langs_framework::{domain::RunStatus, plugin::LanguagePlugin};
212211

213212
fn init() {

plugins/r/src/plugin.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use tmc_langs_framework::{
1313
};
1414

1515
use std::collections::HashMap;
16-
use std::ffi::OsStr;
1716
use std::fs::{self, File};
1817
use std::io::{Read, Seek};
1918
use std::path::{Path, PathBuf};
@@ -177,9 +176,9 @@ mod test {
177176
.skip(path.components().count())
178177
.collect();
179178
let temp_path = temp.path().join(entry_path);
180-
temp_path
181-
.parent()
182-
.map(|p| std::fs::create_dir_all(&p).unwrap());
179+
if let Some(parent) = temp_path.parent() {
180+
std::fs::create_dir_all(&parent).unwrap();
181+
}
183182
log::trace!("copying {:?} -> {:?}", entry.path(), temp_path);
184183
std::fs::copy(entry.path(), temp_path).unwrap();
185184
}

tmc-langs-cli/tests/core_integration.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ fn run_core_cmd(args: &[&str]) -> Output {
3232
let child_stdin = child.stdin.as_mut().unwrap();
3333
let password_write = format!("{}\n", password);
3434
child_stdin.write_all(password_write.as_bytes()).unwrap();
35-
let out = child.wait_with_output().unwrap();
36-
out
35+
child.wait_with_output().unwrap()
3736
}
3837

3938
#[test]

tmc-langs-core/src/tmc_core.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,7 @@ mod test {
12351235
#[test]
12361236
fn checks_submission_finished() {
12371237
let (core, addr) = init();
1238-
let m = mock("GET", "/submission-url")
1238+
let _m = mock("GET", "/submission-url")
12391239
.with_body(serde_json::json!({
12401240
"api_version": 7,
12411241
"all_tests_passed": true,

tmc-langs-framework/src/domain/meta_syntax.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ mod test {
214214
fn parse_simple() {
215215
init();
216216

217-
const JAVA_FILE: &'static str = r#"
217+
const JAVA_FILE: &str = r#"
218218
public class JavaTestCase {
219219
public int foo() {
220220
return 3;
@@ -240,7 +240,7 @@ public class JavaTestCase {
240240
fn parse_solution() {
241241
init();
242242

243-
const JAVA_FILE_SOLUTION: &'static str = r#"
243+
const JAVA_FILE_SOLUTION: &str = r#"
244244
/* SOLUTION FILE */
245245
public class JavaTestCase {
246246
// BEGIN SOLUTION
@@ -269,7 +269,7 @@ public class JavaTestCase {
269269
fn parse_stubs() {
270270
init();
271271

272-
const JAVA_FILE_STUB: &'static str = r#"
272+
const JAVA_FILE_STUB: &str = r#"
273273
public class JavaTestCase {
274274
public int foo() {
275275
return 3;

tmc-langs-framework/src/io/tmc_zip.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Contains functions for zipping and unzipping projects.
22
33
use crate::policy::StudentFilePolicy;
4-
use crate::{LanguagePlugin, Result, TmcError};
4+
use crate::{Result, TmcError};
55
use std::collections::HashSet;
66
use std::fs::{self, File};
77
use std::io::{Cursor, Read, Seek, Write};

0 commit comments

Comments
 (0)