From 70db8b57cd6fe7489867caf2fb8fd621051b4ed2 Mon Sep 17 00:00:00 2001 From: SKTT1Ryze Date: Wed, 11 Oct 2023 21:18:24 +0900 Subject: [PATCH] add rustfmt.toml in runtime --- runtime/rust-toolchain | 1 + runtime/rustfmt.toml | 9 +++++++++ runtime/src/container.rs | 9 +++++---- runtime/src/registration.rs | 3 +-- 4 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 runtime/rust-toolchain create mode 100644 runtime/rustfmt.toml diff --git a/runtime/rust-toolchain b/runtime/rust-toolchain new file mode 100644 index 0000000..bf867e0 --- /dev/null +++ b/runtime/rust-toolchain @@ -0,0 +1 @@ +nightly diff --git a/runtime/rustfmt.toml b/runtime/rustfmt.toml new file mode 100644 index 0000000..b4040e3 --- /dev/null +++ b/runtime/rustfmt.toml @@ -0,0 +1,9 @@ +error_on_line_overflow = false +format_strings = true +normalize_comments = true +imports_granularity = "Crate" +reorder_modules = true +# enum_discrim_align_threshold = 20 +use_try_shorthand = true +wrap_comments = true +edition = "2021" \ No newline at end of file diff --git a/runtime/src/container.rs b/runtime/src/container.rs index 7b1aca4..ef062a7 100644 --- a/runtime/src/container.rs +++ b/runtime/src/container.rs @@ -1,8 +1,9 @@ -use std::collections::HashMap; -use std::sync::{Arc, Mutex}; +use std::{ + collections::HashMap, + sync::{Arc, Mutex}, +}; -use leetcode::problems::Problem; -use leetcode::solutions::Solution; +use leetcode::{problems::Problem, solutions::Solution}; #[derive(Default)] pub struct Container { diff --git a/runtime/src/registration.rs b/runtime/src/registration.rs index 1a51042..7b552d6 100644 --- a/runtime/src/registration.rs +++ b/runtime/src/registration.rs @@ -1,7 +1,6 @@ use super::container::ContainerHandle; -use leetcode::problems; -use leetcode::solutions; +use leetcode::{problems, solutions}; pub fn register_all(handle: ContainerHandle) -> anyhow::Result<()> { handle.register_problem(|_| problems::two_sum::TwoSum)?;