Skip to content

Commit

Permalink
clippy + fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
dp1 committed Oct 16, 2023
1 parent c26a73b commit 6a83fb0
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion task-maker-exec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ mod tests {
cwd.path(),
1000,
1000,
UnsafeSandboxRunner::default(),
UnsafeSandboxRunner,
);

assert!(exec_done2.load(Ordering::Relaxed));
Expand Down
2 changes: 1 addition & 1 deletion task-maker-exec/src/sandbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ mod tests {
exec.limits_mut().read_only(true);
let sandbox = Sandbox::new(tmpdir.path(), &exec, &HashMap::new(), None).unwrap();
let outfile = sandbox.output_path(Path::new("fooo"));
if let Err(e) = sandbox.run(&ErrorSandboxRunner::default()) {
if let Err(e) = sandbox.run(&ErrorSandboxRunner) {
assert!(e.to_string().contains("Nope"));
} else {
panic!("Sandbox not called");
Expand Down
4 changes: 3 additions & 1 deletion task-maker-format/src/ioi/sanity_checks/subtasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,9 @@ impl SanityCheck for AllOutputsEqual {
let outputs = self.outputs.lock().unwrap();

for (id, out) in outputs.iter() {
let Some(subtask) = task.subtasks.get(id) else { continue; };
let Some(subtask) = task.subtasks.get(id) else {
continue;
};
if out.len() != subtask.testcases.len() {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion task-maker-format/src/ioi/sanity_checks/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl SanityCheck for NoBitsStdCpp {
fn pre_hook(&self, task: &IOITask, eval: &mut EvaluationData) -> Result<(), Error> {
lazy_static! {
static ref RE: Regex =
Regex::new(r###"(?m)^#\s*include\s*(?:<|")bits/stdc\+\+\.h(?:>|").*$"###)
Regex::new(r#"(?m)^#\s*include\s*(?:<|")bits/stdc\+\+\.h(?:>|").*$"#)
.expect("Invalid regex");
}

Expand Down
4 changes: 2 additions & 2 deletions task-maker-format/src/ioi/statement/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ mod tests {
let logo2 = Some(logo);

let mut eval = EvaluationData::new(tmpdir.path()).0;
let in_files = vec!["logo.pdf", "test.png", "asset.pdf"];
let not_in_files = vec!["asy_image.pdf", "tex_file.pdf"];
let in_files = ["logo.pdf", "test.png", "asset.pdf"];
let not_in_files = ["asy_image.pdf", "tex_file.pdf"];
std::fs::write(tmpdir.path().join("asy_image.asy"), "").unwrap();
std::fs::write(tmpdir.path().join("tex_file.tex"), "").unwrap();

Expand Down
8 changes: 4 additions & 4 deletions task-maker-format/src/ioi/ui_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ impl UIStateT for UIState {
.entry(solution)
.or_insert_with(|| SolutionEvaluationState::new(task));
let subtask = eval.subtasks.get_mut(&subtask).expect("Missing subtask");
let mut testcase = subtask
let testcase = subtask
.testcases
.get_mut(&testcase)
.expect("Missing testcase");
Expand Down Expand Up @@ -599,7 +599,7 @@ impl UIStateT for UIState {
.entry(solution)
.or_insert_with(|| SolutionEvaluationState::new(task));
let subtask = eval.subtasks.get_mut(&subtask).expect("Missing subtask");
let mut testcase = subtask
let testcase = subtask
.testcases
.get_mut(&testcase)
.expect("Missing testcase");
Expand All @@ -626,7 +626,7 @@ impl UIStateT for UIState {
.entry(solution)
.or_insert_with(|| SolutionEvaluationState::new(task));
let subtask = eval.subtasks.get_mut(&subtask).expect("Missing subtask");
let mut testcase = subtask
let testcase = subtask
.testcases
.get_mut(&testcase)
.expect("Missing testcase");
Expand All @@ -650,7 +650,7 @@ impl UIStateT for UIState {
.evaluations
.entry(solution)
.or_insert_with(|| SolutionEvaluationState::new(task));
let mut subtask = eval.subtasks.get_mut(&subtask).expect("Missing subtask");
let subtask = eval.subtasks.get_mut(&subtask).expect("Missing subtask");
subtask.score = Some(score);
subtask.normalized_score = Some(normalized_score);
}
Expand Down
1 change: 0 additions & 1 deletion task-maker-format/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ use task_maker_lang::{GraderMap, LanguageManager};

use crate::ioi::task_info::IOITaskInfo;
use crate::ioi::IOITask;
use crate::solution::Solution;
pub use crate::solution::*;
use crate::terry::{Seed, TerryTask};
use crate::ui::UI;
Expand Down
2 changes: 1 addition & 1 deletion task-maker-format/src/ui/curses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ where
Ok(std::thread::Builder::new()
.name("CursesUI thread".to_owned())
.spawn(move || {
let loading = vec!['◐', '◓', '◑', '◒'];
let loading = ['◐', '◓', '◑', '◒'];
let mut loading_index = 0;
let stdin = termion::async_stdin();
let mut events = stdin.events();
Expand Down
2 changes: 1 addition & 1 deletion task-maker-lang/src/languages/cpp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ mod tests {
)
.unwrap();
let imports = extract_includes(&path);
for (i, import) in vec!["iostream", "test.hpp"].iter().enumerate() {
for (i, import) in ["iostream", "test.hpp"].iter().enumerate() {
let import = PathBuf::from(import);
assert_that(&imports[i].0).is_equal_to(tmpdir.path().join(&import));
assert_that(&imports[i].1).is_equal_to(&import);
Expand Down
2 changes: 1 addition & 1 deletion task-maker-lang/src/languages/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ mod tests {
)
.unwrap();
let imports = extract_imports(&path);
for (i, import) in vec!["foo", "bar", "baz", "biz"].iter().enumerate() {
for (i, import) in ["foo", "bar", "baz", "biz"].iter().enumerate() {
let import = PathBuf::from(format!("{}.py", import));
assert_that(&imports[i]).is_equal_to((import.clone(), import));
}
Expand Down
2 changes: 1 addition & 1 deletion task-maker-lang/src/source_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ mod tests {
cwd.path(),
1000,
1000,
SuccessSandboxRunner::default(),
SuccessSandboxRunner,
);

assert!(exec_start.load(Ordering::Relaxed));
Expand Down

0 comments on commit 6a83fb0

Please sign in to comment.