From 6bbc306c232831fa1253f5c33d3da1b59043db05 Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Sat, 10 May 2025 13:09:49 -0300 Subject: [PATCH] style: reorder imports and adjust formatting --- src/compression.rs | 2 +- src/main.rs | 4 +++- src/modes/common.rs | 6 +++--- src/modes/info.rs | 4 ++-- src/modes/list.rs | 10 +++++----- src/modes/save.rs | 8 ++++---- 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/compression.rs b/src/compression.rs index 8ac2fad..64e8325 100755 --- a/src/compression.rs +++ b/src/compression.rs @@ -1,5 +1,5 @@ -use std::io; use anyhow::{anyhow, Context, Result}; +use std::io; use std::io::{Read, Write}; use std::path::PathBuf; use std::process::{Command, Stdio}; diff --git a/src/main.rs b/src/main.rs index 8c565d0..77d199e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -308,7 +308,9 @@ fn main() -> Result<(), Error> { crate::modes::get::mode_get(&mut cmd, args, ids, tags, &mut conn, data_path)? } KeepModes::Diff => mode_diff(&mut cmd, args, ids, tags, &mut conn, data_path)?, - KeepModes::List => crate::modes::list::mode_list(&mut cmd, args, ids, tags, &mut conn, data_path)?, + KeepModes::List => { + crate::modes::list::mode_list(&mut cmd, args, ids, tags, &mut conn, data_path)? + } KeepModes::Update => { crate::modes::update::mode_update(&mut cmd, args, ids, tags, &mut conn, data_path)? } diff --git a/src/modes/common.rs b/src/modes/common.rs index 3a728da..09ef076 100644 --- a/src/modes/common.rs +++ b/src/modes/common.rs @@ -52,15 +52,15 @@ pub fn get_format_box_chars_no_border_line_separator() -> TableFormat { .borders('│') .separators( &[prettytable::format::LinePosition::Top], - prettytable::format::LineSeparator::new('─', '┬', '┌', '┐') + prettytable::format::LineSeparator::new('─', '┬', '┌', '┐'), ) .separators( &[prettytable::format::LinePosition::Title], - prettytable::format::LineSeparator::new('─', '┼', '├', '┤') + prettytable::format::LineSeparator::new('─', '┼', '├', '┤'), ) .separators( &[prettytable::format::LinePosition::Bottom], - prettytable::format::LineSeparator::new('─', '┴', '└', '┘') + prettytable::format::LineSeparator::new('─', '┴', '└', '┘'), ) .padding(1, 1) .build() diff --git a/src/modes/info.rs b/src/modes/info.rs index a442f7c..8950c42 100644 --- a/src/modes/info.rs +++ b/src/modes/info.rs @@ -4,12 +4,12 @@ use clap::Command; use std::path::PathBuf; use std::str::FromStr; -use crate::modes::common::{format_size, get_format_box_chars_no_border_line_separator}; // Add function import -use is_terminal::IsTerminal; use crate::compression::get_engine; use crate::compression::CompressionType; use crate::db::{get_item, get_item_last, get_item_matching}; +use crate::modes::common::{format_size, get_format_box_chars_no_border_line_separator}; // Add function import use chrono::prelude::*; +use is_terminal::IsTerminal; use prettytable::format; use prettytable::{Attr, Cell, Row, Table}; diff --git a/src/modes/list.rs b/src/modes/list.rs index 82de955..f343a7f 100644 --- a/src/modes/list.rs +++ b/src/modes/list.rs @@ -1,18 +1,18 @@ use anyhow::{anyhow, Result}; -use log::debug; use chrono::Local; -use prettytable::format::consts; use clap::Command; +use log::debug; +use prettytable::format::consts; use std::collections::HashMap; use std::path::PathBuf; -use crate::db::{get_item, get_item_last, get_items, get_items_matching, Item, Tag, Meta}; -use std::io::{ErrorKind}; +use crate::db::{get_item, get_item_last, get_items, get_items_matching, Item, Meta, Tag}; use crate::modes::common::{format_size, get_format_box_chars_no_border_line_separator}; -use rusqlite::Connection; use crate::modes::common::{size_column, string_column}; use prettytable::row; use prettytable::{Attr, Cell, Row, Table}; +use rusqlite::Connection; +use std::io::ErrorKind; pub fn mode_list( cmd: &mut Command, diff --git a/src/modes/save.rs b/src/modes/save.rs index ca11eb0..4f74e6f 100644 --- a/src/modes/save.rs +++ b/src/modes/save.rs @@ -1,8 +1,8 @@ use anyhow::{anyhow, Context, Result}; +use is_terminal::IsTerminal; use std::collections::HashMap; use std::io::{self, Read}; use std::path::PathBuf; -use is_terminal::IsTerminal; use std::str::FromStr; use clap::error::ErrorKind; @@ -12,7 +12,7 @@ use rusqlite::Connection; use crate::compression::CompressionType; use crate::db::{self}; -use crate::modes::common::{get_meta_from_env}; +use crate::modes::common::get_meta_from_env; use chrono::Utc; pub fn mode_save( @@ -40,7 +40,7 @@ pub fn mode_save( .compression .unwrap_or(compression::default_type().to_string()); -use gethostname::gethostname; + use gethostname::gethostname; use std::io::Write; let compression_type_opt = CompressionType::from_str(&compression_name); if compression_type_opt.is_err() { @@ -119,7 +119,7 @@ use gethostname::gethostname; let mut stdout = io::stdout().lock(); let mut buffer = [0; libc::BUFSIZ as usize]; -use crate::compression; + use crate::compression; let compression_engine = compression::get_engine(compression_type.clone()) .expect("Unable to get compression engine"); let mut item_out: Box =