From a5e939506e662b17d7be7a1a31e7b4bd30bb98e8 Mon Sep 17 00:00:00 2001 From: cool-mist Date: Wed, 8 Jul 2026 15:09:12 +0530 Subject: [PATCH] Fix formatting to 120 lines --- rustfmt.toml | 1 + src/config.rs | 15 ++++++--------- src/main.rs | 5 +---- 3 files changed, 8 insertions(+), 13 deletions(-) create mode 100644 rustfmt.toml diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..7530651 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1 @@ +max_width = 120 diff --git a/src/config.rs b/src/config.rs index 2dd6a82..0255137 100644 --- a/src/config.rs +++ b/src/config.rs @@ -62,9 +62,7 @@ impl Nick { } } - Ok(Self { - name: nick.to_string(), - }) + Ok(Self { name: nick.to_string() }) } } @@ -156,12 +154,11 @@ impl Config { // TODO: Also consider \r and \r\n if b == b'\n' { - let key_str = String::from_utf8(take(&mut key)) - .map_err(|e| error::map_config_error_utf8(&e, line_number))?; - let value_str = String::from_utf8(take(&mut value)) - .map_err(|e| error::map_config_error_utf8(&e, line_number))?; - let mac = Mac::create(&value_str) - .map_err(|e| error::map_config_error(&e, line_number))?; + let key_str = + String::from_utf8(take(&mut key)).map_err(|e| error::map_config_error_utf8(&e, line_number))?; + let value_str = + String::from_utf8(take(&mut value)).map_err(|e| error::map_config_error_utf8(&e, line_number))?; + let mac = Mac::create(&value_str).map_err(|e| error::map_config_error(&e, line_number))?; let nick = Nick { name: key_str }; if nick_map.contains_key(&nick) { diff --git a/src/main.rs b/src/main.rs index 2c11907..fbbb910 100644 --- a/src/main.rs +++ b/src/main.rs @@ -93,9 +93,6 @@ mod tests { 50, 26, 255, 62, 16, 239, ]; - assert_eq!( - magic_bytes, expected, - "Magic bytes are not created correctly" - ); + assert_eq!(magic_bytes, expected, "Magic bytes are not created correctly"); } }