diff --git a/src/data_hustoj.rs b/src/data_hustoj.rs index 1fee78b..3fb5291 100644 --- a/src/data_hustoj.rs +++ b/src/data_hustoj.rs @@ -80,7 +80,8 @@ impl DataSource for HustOJDataSource { return Err(Error::BadProblem(p)); } - let memory_limit = Byte::from_bytes(memory_limit as u128 * byte_unit::MEBIBYTE); + // Overflow cannot happen. + let memory_limit = Byte::from_i64_with_unit(memory_limit as i64, MiB).unwrap(); let language = match line.language { 0 => "c", diff --git a/src/main.rs b/src/main.rs index 559f26d..097a212 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,6 +9,7 @@ pub mod prelude { pub use crate::error::{Error, Result}; pub use crate::util; pub use byte_unit::Byte; + pub use byte_unit::Unit::{KiB, MiB}; pub use cfg_if::cfg_if; pub use log::{debug, error, info, trace, warn}; pub use serde::Deserialize; @@ -18,7 +19,6 @@ pub mod prelude { pub use std::time::Duration; } -pub use byte_unit::Unit::{KiB, MiB}; use clap::{Args, Parser, ValueEnum}; use data::Verdict; use log4rs::{