From e5b86831d37ed2752909cdc6671863e2a8b90451 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Mon, 21 Feb 2022 18:30:32 -0500 Subject: [PATCH] Format import granularity --- rustfmt.toml | 2 ++ src/main.rs | 15 +++++++-------- src/shuf.rs | 6 ++---- src/sort.rs | 11 +++-------- 4 files changed, 14 insertions(+), 20 deletions(-) create mode 100644 rustfmt.toml diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..5293560 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,2 @@ +unstable_features = true +imports_granularity = "Crate" diff --git a/src/main.rs b/src/main.rs index 8c22fca..1e6c890 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,17 +4,16 @@ mod errors; mod shuf; mod sort; -use clap::Parser; -use clap::Subcommand; +use clap::{Parser, Subcommand}; use errors::KakMessage; use shuf::ShufOptions; use sort::SortOptions; -use std::env; -use std::fs; -use std::fs::File; -use std::fs::OpenOptions; -use std::io::Write; -use std::str::FromStr; +use std::{ + env, fs, + fs::{File, OpenOptions}, + io::Write, + str::FromStr, +}; #[derive(Parser, Debug)] #[clap(about, version, author)] diff --git a/src/shuf.rs b/src/shuf.rs index 483ee1c..a121057 100644 --- a/src/shuf.rs +++ b/src/shuf.rs @@ -1,7 +1,5 @@ -use crate::KakMessage; -use crate::{kak_response, open_command_fifo}; -use rand::seq::SliceRandom; -use rand::thread_rng; +use crate::{kak_response, open_command_fifo, KakMessage}; +use rand::{seq::SliceRandom, thread_rng}; use std::io::Write; #[derive(clap::StructOpt, Debug)] pub struct ShufOptions; diff --git a/src/sort.rs b/src/sort.rs index 9b998cd..5e8ea3b 100644 --- a/src/sort.rs +++ b/src/sort.rs @@ -1,13 +1,8 @@ -use crate::KakMessage; -use crate::SelectionDesc; -use crate::{kak_response, open_command_fifo}; +use crate::{kak_response, open_command_fifo, KakMessage, SelectionDesc}; use alphanumeric_sort::compare_str; -use rand::seq::SliceRandom; -use rand::thread_rng; +use rand::{seq::SliceRandom, thread_rng}; use regex::Regex; -use std::cmp::Ordering; -use std::io::Write; -use std::str::FromStr; +use std::{cmp::Ordering, io::Write, str::FromStr}; #[derive(clap::StructOpt, Debug)] pub struct SortOptions {