Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
  • Loading branch information
akamya997 committed Jan 17, 2024
1 parent 7e83d90 commit 6a66ca0
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 14 deletions.
4 changes: 2 additions & 2 deletions judge-core/src/compiler.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::error::JudgeCoreError;
use crate::utils::get_pathbuf_str;
use anyhow::anyhow;
use serde_derive::{Serialize, Deserialize};
use std::{fmt, fs};
use serde_derive::{Deserialize, Serialize};
use std::path::PathBuf;
use std::{fmt, fs};
use std::{process::Command, str::FromStr};

const TEMPLATE_ARG_SRC_PATH: &str = "{src_path}";
Expand Down
4 changes: 1 addition & 3 deletions judge-core/src/judge/interact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ use crate::utils::get_pathbuf_str;

use nix::errno::Errno;
use nix::fcntl::{fcntl, FcntlArg, OFlag};
use nix::sys::epoll::{
Epoll, EpollCreateFlags, EpollEvent, EpollFlags,
};
use nix::sys::epoll::{Epoll, EpollCreateFlags, EpollEvent, EpollFlags};
use nix::unistd::{pipe, read, write};
use std::fs::File;
use std::os::fd::BorrowedFd;
Expand Down
12 changes: 8 additions & 4 deletions judge-core/tests/judge_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ use std::path::PathBuf;
use judge_core::{
compiler::Language,
judge::{
interact::run_interact, result::JudgeVerdict, CheckerConfig, JudgeConfig, ProgramConfig,
RuntimeConfig, TestdataConfig, builder::{JudgeBuilder, JudgeBuilderInput},
builder::{JudgeBuilder, JudgeBuilderInput},
interact::run_interact,
result::JudgeVerdict,
CheckerConfig, JudgeConfig, ProgramConfig, RuntimeConfig, TestdataConfig,
},
run::{executor::Executor, RlimitConfigs}, package::PackageType,
package::PackageType,
run::{executor::Executor, RlimitConfigs},
};

use judge_core::judge::common::run_judge;
Expand Down Expand Up @@ -156,7 +159,8 @@ fn test_build_icpc() {
package_path: PathBuf::from(TEST_DATA_PATH).join("packages/icpc/hello_world"),
runtime_path: PathBuf::from(TEST_TEMP_PATH).join("hello_world"),
src_language: Language::Cpp,
src_path: PathBuf::from(TEST_DATA_PATH).join("built-in-programs/src/programs/read_and_write.cpp"),
src_path: PathBuf::from(TEST_DATA_PATH)
.join("built-in-programs/src/programs/read_and_write.cpp"),
})
.unwrap();
log::info!("builder: {:?}", builder);
Expand Down
2 changes: 1 addition & 1 deletion judger/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#[allow(dead_code)]
pub mod service;
pub mod service;
2 changes: 1 addition & 1 deletion judger/src/server/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mod service;
extern crate serde_derive;
extern crate lazy_static;

use actix_web::{App, HttpServer, web::Data};
use actix_web::{web::Data, App, HttpServer};
use utoipa::OpenApi;

#[actix_web::main] // or #[tokio::main]
Expand Down
6 changes: 3 additions & 3 deletions judger/src/server/service/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub async fn get_state() -> Result<HttpResponse, ServiceError> {
let state = STATE.read().map_err(|e| {
ServiceError::InternalError(anyhow::anyhow!("Failed to lock state: {:?}", e))
})?;
Ok(HttpResponse::Ok().content_type(
"application/text; charset=utf-8",
).body(format!("{:?}", *state)))
Ok(HttpResponse::Ok()
.content_type("application/text; charset=utf-8")
.body(format!("{:?}", *state)))
}

0 comments on commit 6a66ca0

Please sign in to comment.