Skip to content

Commit

Permalink
hustoj: Fix outdated byte-unit API usage
Browse files Browse the repository at this point in the history
Not catched by CI because hustoj not enabled... :(
  • Loading branch information
xry111 committed Nov 29, 2023
1 parent f99a9e7 commit d78b93a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/data_hustoj.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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::{
Expand Down

0 comments on commit d78b93a

Please sign in to comment.