diff --git a/crates/backend/src/cli.rs b/crates/backend/src/cli.rs index 5891f944..889bbb2d 100644 --- a/crates/backend/src/cli.rs +++ b/crates/backend/src/cli.rs @@ -25,7 +25,11 @@ pub struct Opts { #[arg(short = 'f', long = "frontend_folder")] pub frontend_folder: Option, - #[arg(long = "versions_file_path", default_value = "./config/versions.json", env = "VERSIONS_FILE_PATH")] + #[arg( + long = "versions_file_path", + default_value = "./config/versions.json", + env = "VERSIONS_FILE_PATH" + )] pub versions_file_path: String, #[arg(short = 'g', long = "github_token", env = "GITHUB_GIST_TOKEN")] diff --git a/crates/backend/src/main.rs b/crates/backend/src/main.rs index 85feed4f..24e928f3 100644 --- a/crates/backend/src/main.rs +++ b/crates/backend/src/main.rs @@ -127,7 +127,7 @@ async fn main() -> std::io::Result<()> { get().to(route_status), ) .app_data(web::Data::new(AppVersionState { - versions_file_path: versions_file_path, + versions_file_path, })) .service( web::resource("/version_list").to(route_version_list) diff --git a/crates/backend/src/services/contract.rs b/crates/backend/src/services/contract.rs index 0ee3bdd2..df435521 100644 --- a/crates/backend/src/services/contract.rs +++ b/crates/backend/src/services/contract.rs @@ -151,7 +151,6 @@ pub async fn route_status() -> HttpResponse { HttpResponse::Ok().body("ink-compiler is live") } - // ------------------------------------------------------------------------------------------------- // TESTS // ------------------------------------------------------------------------------------------------- diff --git a/crates/backend/src/services/frontend.rs b/crates/backend/src/services/frontend.rs index ad8ee9a8..a9298264 100644 --- a/crates/backend/src/services/frontend.rs +++ b/crates/backend/src/services/frontend.rs @@ -14,9 +14,12 @@ //! This module contains the service which serves the backend as static files. -use std::path::{PathBuf, Path}; -use actix_web::{Result, web}; use actix_files as fs; +use actix_web::{ + web, + Result, +}; +use std::path::Path; pub struct FrontendState { pub frontend_folder: String, @@ -29,7 +32,9 @@ pub fn route_frontend(at: &str, dir: &str) -> actix_files::Files { pub async fn route_frontend_version( data: web::Data, ) -> Result { - Ok(fs::NamedFile::open(PathBuf::from(Path::new(&data.frontend_folder).join("index.html")))?) + Ok(fs::NamedFile::open( + Path::new(&data.frontend_folder).join("index.html"), + )?) } #[cfg(test)] diff --git a/crates/backend/src/services/version.rs b/crates/backend/src/services/version.rs index 47da36d0..93952213 100644 --- a/crates/backend/src/services/version.rs +++ b/crates/backend/src/services/version.rs @@ -1,9 +1,16 @@ use std::fs; -use actix_web::{body::BoxBody, web, HttpResponse}; +use actix_web::{ + body::BoxBody, + web, + HttpResponse, +}; pub use sandbox::VersionListResult; -use serde_json::{json, Value}; +use serde_json::{ + json, + Value, +}; pub struct AppVersionState { pub versions_file_path: String, @@ -17,7 +24,7 @@ pub async fn route_version_list( data: web::Data, ) -> HttpResponse { let versions_file_path = &data.versions_file_path; - let versions_arr_string = read_json_file(&versions_file_path).unwrap(); + let versions_arr_string = read_json_file(versions_file_path).unwrap(); let versions_arr_json: Value = serde_json::from_str(versions_arr_string.as_str()).expect("Failed to parse JSON"); let versions_json = json!({ diff --git a/crates/generate-bindings/src/main.rs b/crates/generate-bindings/src/main.rs index 53136652..f0712179 100644 --- a/crates/generate-bindings/src/main.rs +++ b/crates/generate-bindings/src/main.rs @@ -18,7 +18,6 @@ mod cli; use crate::cli::Cli; use backend::services::{ - version::VersionListResult, contract::{ CompilationRequest, CompilationResult, @@ -38,6 +37,7 @@ use backend::services::{ GistLoadResponse, }, }, + version::VersionListResult, }; use clap::Parser; use std::{ @@ -65,7 +65,7 @@ fn main() -> std::io::Result<()> { GistLoadResponse, GistCreateRequest, GistCreateResponse, - VersionListResult + VersionListResult, ); let path = Path::new(&target); diff --git a/crates/sandbox/src/build_command.rs b/crates/sandbox/src/build_command.rs index 4acb95d6..2e8321f9 100644 --- a/crates/sandbox/src/build_command.rs +++ b/crates/sandbox/src/build_command.rs @@ -19,7 +19,10 @@ //! strategy. This allows easy mocking. use crate::docker_command; -use std::{path::Path, time::Duration}; +use std::{ + path::Path, + time::Duration, +}; use tokio::process::Command; const DOCKER_PROCESS_TIMEOUT_SOFT: Duration = Duration::from_secs(20); diff --git a/crates/sandbox/src/lib.rs b/crates/sandbox/src/lib.rs index b945f361..8212a15a 100644 --- a/crates/sandbox/src/lib.rs +++ b/crates/sandbox/src/lib.rs @@ -167,7 +167,7 @@ pub enum FormattingResult { #[serde(rename_all = "snake_case")] // #[serde(tag = "type", content = "payload", rename_all = "SCREAMING_SNAKE_CASE")] pub struct VersionListResult { - versions: Vec + versions: Vec, } // ------------------------------------------------------------------------------------------------- @@ -201,8 +201,8 @@ impl Sandbox { pub fn compile(&self, req: &CompilationRequest) -> Result { self.write_source_code(&req.source)?; - let command = build_compile_command(&self.input_file, &self.output_dir, &req.version); - + let command = + build_compile_command(&self.input_file, &self.output_dir, &req.version); println!("Executing command: \n{:?}", command); let output = run_command_with_timeout(command)?; diff --git a/packages/playground/src/app/Header/VersionsSubmenu.tsx b/packages/playground/src/app/Header/VersionsSubmenu.tsx index 8efc7d87..c2d43753 100644 --- a/packages/playground/src/app/Header/VersionsSubmenu.tsx +++ b/packages/playground/src/app/Header/VersionsSubmenu.tsx @@ -1,4 +1,4 @@ -import { MenuSelectElementWrapper, MenuElementWrapper } from '@paritytech/components/'; +import { MenuSelectElementWrapper } from '@paritytech/components/'; import { ReactElement, useContext } from 'react'; import { AppContext } from '~/context/app/'; import { Dispatch, State } from '~/context/app/reducer'; diff --git a/rustfmt.toml b/rustfmt.toml index 25a156b6..29528533 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -35,7 +35,7 @@ struct_field_align_threshold = 0 enum_discrim_align_threshold = 0 match_arm_blocks = true force_multiline_blocks = true # changed -fn_args_layout = "Tall" +fn_params_layout = "Tall" brace_style = "SameLineWhere" control_brace_style = "AlwaysSameLine" trailing_semicolon = false # changed