Skip to content

Commit

Permalink
cargo clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Eason0729 committed Apr 29, 2024
1 parent fdd0897 commit c63a15b
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 23 deletions.
9 changes: 4 additions & 5 deletions judger/src/filesystem/tar/block.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::{
future::IntoFuture,
io::SeekFrom,
ops::DerefMut,
pin::{pin, Pin},
Expand All @@ -14,7 +13,7 @@ use tokio::{
sync::{Mutex, OwnedMutexGuard},
};

#[derive(Default,Debug)]
#[derive(Default, Debug)]
enum Stage<F> {
Reading(OwnedMutexGuard<F>),
Seeking(OwnedMutexGuard<F>),
Expand Down Expand Up @@ -59,9 +58,9 @@ where
fn clone(&self) -> Self {
Self {
file: self.file.clone(),
start: self.start.clone(),
size: self.size.clone(),
cursor: self.cursor.clone(),
start: self.start,
size: self.size,
cursor: self.cursor,
stage: Stage::Done,
}
}
Expand Down
10 changes: 5 additions & 5 deletions judger/src/filesystem/tar/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ use std::{
sync::Arc,
};

#[cfg(test)]
use std::io::Cursor;
use tar::*;
#[cfg(test)]
use tokio::io::BufReader;
use tokio::{
fs::File,
io::{AsyncRead, AsyncSeek},
sync::Mutex,
task::spawn_blocking,
};
#[cfg(test)]
use std::io::Cursor;
#[cfg(test)]
use tokio::io::BufReader;

use super::{block::TarBlock, entry::Entry};

Expand Down Expand Up @@ -106,9 +106,9 @@ where

#[cfg(test)]
mod test {
use super::*;
use std::ffi::OsStr;
use tokio::io::AsyncReadExt;
use super::*;

macro_rules! assert_content {
($entry:expr, $content:expr) => {
Expand Down
3 changes: 1 addition & 2 deletions judger/src/sandbox/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ mod process;

use std::{ffi::OsStr, path::Path, time::Duration};

pub use self::monitor::{Cpu, Memory, Stat};
pub use process::*;
pub use self::monitor::{Cpu, Memory};

pub trait Context: Limit {
type FS: Filesystem;
Expand Down
16 changes: 8 additions & 8 deletions judger/src/sandbox/monitor/mod.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
//! Provide ability to limit resource such as memory limit, cpu limit, walltime limit and output limit
pub(self) mod hier;
pub(self) mod mem_cpu;
pub(self) mod output;
pub(self) mod stat;
pub(self) mod walltime;
pub(self) mod wrapper;
mod hier;
mod mem_cpu;
mod output;
mod stat;
mod walltime;
mod wrapper;

use std::{fmt::Display, sync::atomic::AtomicUsize, time::Duration};

pub use stat::*;
use tokio::io::AsyncRead;

pub(self) use crate::Error;
pub(self) type Result<T> = std::result::Result<T, Error>;
use crate::Error;
type Result<T> = std::result::Result<T, Error>;
use hier::*;

use self::output::Output;
Expand Down
2 changes: 1 addition & 1 deletion judger/src/sandbox/monitor/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl<'a> CgroupWrapper<'a> {
let controller = self.cgroup.controller_of::<MemController>().unwrap();
let kusage = controller.kmem_stat();

let kernel = kusage.max_usage_in_bytes as u64;
let kernel = kusage.max_usage_in_bytes;
let user = controller.memory_stat().max_usage_in_bytes;
let total = kernel + user;

Expand Down
2 changes: 0 additions & 2 deletions judger/src/sandbox/process/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@ mod process;

use super::*;

pub use corpse::Corpse;
pub use process::Process;

0 comments on commit c63a15b

Please sign in to comment.