From b792276b05a0e216c8bee4aa80b5897c25253162 Mon Sep 17 00:00:00 2001 From: ddidderr Date: Wed, 12 Jul 2023 12:39:55 +0200 Subject: [PATCH] [rustfmt][clippy] more lints, better formatting --- rustfmt.toml | 4 +++- src/main.rs | 20 +++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/rustfmt.toml b/rustfmt.toml index d82647b..e270811 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1 +1,3 @@ -imports_layout = "Vertical" +group_imports = "StdExternalCrate" +imports_granularity = "Crate" +imports_layout = "HorizontalVertical" diff --git a/src/main.rs b/src/main.rs index 9e05083..324056a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,17 +1,16 @@ -use chrono::prelude::*; +#![warn(clippy::pedantic)] +#![warn(clippy::todo)] +#![warn(clippy::unwrap_used)] +#![allow(clippy::inline_always)] + use std::{ env::args, fs::File, - io::{ - stdin, - stdout, - Error as IoError, - ErrorKind, - Read, - Write, - }, + io::{stdin, stdout, Error as IoError, ErrorKind, Read, Write}, }; +use chrono::prelude::*; + const TIME_FORMAT: &str = "%H:%M:%S%.6f"; type LogtimesResult = Result<(), IoError>; @@ -81,9 +80,8 @@ fn run() -> LogtimesResult { if let Err(e) = inp.read_exact(&mut buf) { if e.kind() == ErrorKind::UnexpectedEof { return Ok(()); - } else { - return Err(e); } + return Err(e); } // push that char to the "current line" buffer