From 8ef1cb293434c7b9e1fda4a6963368e0435920a9 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sat, 25 Feb 2023 11:48:13 +0100 Subject: [PATCH] make fmt --- .../src/changelog/section/from_history.rs | 1 - cargo-smart-release/src/changelog/write.rs | 3 +- .../src/command/release/git.rs | 1 - cargo-smart-release/src/git/history.rs | 3 +- cargo-smart-release/src/git/mod.rs | 1 - cargo-smart-release/src/utils.rs | 1 - gitoxide-core/src/hours/mod.rs | 1 - gitoxide-core/src/index/checkout.rs | 1 - gitoxide-core/src/pack/create.rs | 1 - gitoxide-core/src/pack/multi_index.rs | 1 - gitoxide-core/src/pack/receive.rs | 1 - gitoxide-core/src/pack/verify.rs | 1 - gitoxide-core/src/query/engine/command.rs | 21 ++++++++------ gitoxide-core/src/query/engine/update.rs | 28 +++++++++++-------- gitoxide-core/src/repository/clone.rs | 1 - gitoxide-core/src/repository/config.rs | 1 - gitoxide-core/src/repository/exclude.rs | 1 - gitoxide-core/src/repository/fetch.rs | 1 - gitoxide-core/src/repository/remote.rs | 1 - .../src/repository/revision/explain.rs | 1 - gitoxide-core/src/repository/revision/list.rs | 1 - gitoxide-core/src/repository/tree.rs | 4 +-- gix-config/src/file/write.rs | 3 +- .../from_paths/includes/conditional/mod.rs | 1 - .../includes/conditional/onbranch.rs | 1 - gix-config/tests/file/write.rs | 3 +- gix-diff/src/tree/changes.rs | 6 ++-- gix-diff/src/tree/mod.rs | 3 +- gix-diff/src/tree/visit.rs | 3 +- gix-diff/tests/tree/mod.rs | 9 ++++-- gix-features/src/progress.rs | 2 +- gix-index/tests/index/init.rs | 3 +- gix-traverse/tests/tree/mod.rs | 3 +- gix/examples/init-repo-and-commit.rs | 1 - gix/src/clone/fetch/util.rs | 3 +- gix/src/clone/mod.rs | 3 +- gix/src/config/tree/sections/core.rs | 15 +++++++--- gix/src/config/tree/sections/diff.rs | 14 ++++++---- gix/src/config/tree/sections/http.rs | 12 ++++---- gix/src/config/tree/sections/remote.rs | 8 ++++-- gix/src/config/tree/sections/ssh.rs | 3 +- gix/src/config/tree/traits.rs | 6 ++-- gix/src/object/tree/diff/change.rs | 4 +-- gix/src/object/tree/diff/for_each.rs | 12 ++++++-- gix/src/object/tree/diff/mod.rs | 3 +- gix/src/object/tree/diff/rewrites.rs | 9 +++--- gix/src/object/tree/diff/tracked.rs | 26 ++++++++++------- gix/src/repository/config/transport.rs | 3 +- gix/tests/clone/mod.rs | 3 +- gix/tests/config/tree.rs | 12 ++++---- gix/tests/id/mod.rs | 3 +- gix/tests/object/tree/diff.rs | 25 +++++++++++------ gix/tests/remote/connect.rs | 3 +- gix/tests/remote/fetch.rs | 3 +- gix/tests/remote/ref_map.rs | 3 +- gix/tests/repository/config/identity.rs | 1 - gix/tests/repository/open.rs | 1 - gix/tests/repository/reference.rs | 3 +- gix/tests/repository/remote.rs | 3 +- src/porcelain/options.rs | 3 +- 60 files changed, 157 insertions(+), 141 deletions(-) diff --git a/cargo-smart-release/src/changelog/section/from_history.rs b/cargo-smart-release/src/changelog/section/from_history.rs index 9d510fe0b04..e7662c0dc21 100644 --- a/cargo-smart-release/src/changelog/section/from_history.rs +++ b/cargo-smart-release/src/changelog/section/from_history.rs @@ -1,7 +1,6 @@ use std::{collections::BTreeMap, ops::Sub}; use cargo_metadata::Package; - use gix::prelude::ObjectIdExt; use time::OffsetDateTime; diff --git a/cargo-smart-release/src/changelog/write.rs b/cargo-smart-release/src/changelog/write.rs index bfe1328b083..4311f30b385 100644 --- a/cargo-smart-release/src/changelog/write.rs +++ b/cargo-smart-release/src/changelog/write.rs @@ -1,6 +1,7 @@ -use gix::{bstr::ByteSlice, url::Scheme, Url}; use std::borrow::Cow; +use gix::{bstr::ByteSlice, url::Scheme, Url}; + use crate::{ changelog, changelog::{ diff --git a/cargo-smart-release/src/command/release/git.rs b/cargo-smart-release/src/command/release/git.rs index e6216dac8a1..c5aa7da77b6 100644 --- a/cargo-smart-release/src/command/release/git.rs +++ b/cargo-smart-release/src/command/release/git.rs @@ -2,7 +2,6 @@ use std::{convert::TryInto, process::Command}; use anyhow::{anyhow, bail}; use cargo_metadata::Package; - use gix::{bstr::ByteSlice, refs, refs::transaction::PreviousValue, Id}; use super::{tag_name, Options}; diff --git a/cargo-smart-release/src/git/history.rs b/cargo-smart-release/src/git/history.rs index 2ce00e2802b..96a6342046a 100644 --- a/cargo-smart-release/src/git/history.rs +++ b/cargo-smart-release/src/git/history.rs @@ -1,5 +1,5 @@ -use std::borrow::Cow; use std::{ + borrow::Cow, collections::{BTreeMap, HashMap}, iter::FromIterator, path::PathBuf, @@ -7,7 +7,6 @@ use std::{ use anyhow::bail; use cargo_metadata::Package; - use gix::{ bstr::ByteSlice, head, diff --git a/cargo-smart-release/src/git/mod.rs b/cargo-smart-release/src/git/mod.rs index 02ec1654980..23a738e7803 100644 --- a/cargo-smart-release/src/git/mod.rs +++ b/cargo-smart-release/src/git/mod.rs @@ -2,7 +2,6 @@ use std::process::Command; use anyhow::{anyhow, bail}; use cargo_metadata::{camino::Utf8Path, Package}; - use gix::{ bstr::{BStr, ByteSlice}, object, diff --git a/cargo-smart-release/src/utils.rs b/cargo-smart-release/src/utils.rs index da8563a0266..9b777a4e9f8 100644 --- a/cargo-smart-release/src/utils.rs +++ b/cargo-smart-release/src/utils.rs @@ -5,7 +5,6 @@ use cargo_metadata::{ camino::{Utf8Component, Utf8Path}, Dependency, DependencyKind, Metadata, Package, PackageId, }; - use gix::bstr::{BStr, ByteSlice}; use semver::{Version, VersionReq}; use time::OffsetDateTime; diff --git a/gitoxide-core/src/hours/mod.rs b/gitoxide-core/src/hours/mod.rs index ef914fe3624..444230db0d8 100644 --- a/gitoxide-core/src/hours/mod.rs +++ b/gitoxide-core/src/hours/mod.rs @@ -1,7 +1,6 @@ use std::{collections::BTreeSet, convert::Infallible, io, path::Path, sync::atomic::Ordering, time::Instant}; use anyhow::{anyhow, bail}; - use gix::{ actor, bstr::{BStr, ByteSlice}, diff --git a/gitoxide-core/src/index/checkout.rs b/gitoxide-core/src/index/checkout.rs index 0bccdf127bf..7b3ed28ea04 100644 --- a/gitoxide-core/src/index/checkout.rs +++ b/gitoxide-core/src/index/checkout.rs @@ -4,7 +4,6 @@ use std::{ }; use anyhow::bail; - use gix::{odb::FindExt, worktree::index::checkout, Progress}; use crate::{ diff --git a/gitoxide-core/src/pack/create.rs b/gitoxide-core/src/pack/create.rs index 098cca5df58..5853312452c 100644 --- a/gitoxide-core/src/pack/create.rs +++ b/gitoxide-core/src/pack/create.rs @@ -1,7 +1,6 @@ use std::{ffi::OsStr, io, path::Path, str::FromStr, time::Instant}; use anyhow::anyhow; - use gix::{ hash, hash::ObjectId, diff --git a/gitoxide-core/src/pack/multi_index.rs b/gitoxide-core/src/pack/multi_index.rs index eb847870e9d..5dc8c6da014 100644 --- a/gitoxide-core/src/pack/multi_index.rs +++ b/gitoxide-core/src/pack/multi_index.rs @@ -1,7 +1,6 @@ use std::{io::BufWriter, path::PathBuf, sync::atomic::AtomicBool}; use anyhow::bail; - use gix::Progress; use crate::OutputFormat; diff --git a/gitoxide-core/src/pack/receive.rs b/gitoxide-core/src/pack/receive.rs index fa512bba534..e202ba42ed5 100644 --- a/gitoxide-core/src/pack/receive.rs +++ b/gitoxide-core/src/pack/receive.rs @@ -195,7 +195,6 @@ mod async_io { use async_trait::async_trait; use futures_io::AsyncBufRead; - use gix::{ bstr::{BString, ByteSlice}, odb::pack, diff --git a/gitoxide-core/src/pack/verify.rs b/gitoxide-core/src/pack/verify.rs index c56afcefc38..5b3a079c40b 100644 --- a/gitoxide-core/src/pack/verify.rs +++ b/gitoxide-core/src/pack/verify.rs @@ -2,7 +2,6 @@ use std::{io, path::Path, str::FromStr, sync::atomic::AtomicBool}; use anyhow::{anyhow, Context as AnyhowContext, Result}; use bytesize::ByteSize; - use gix::{ object, odb, odb::{pack, pack::index}, diff --git a/gitoxide-core/src/query/engine/command.rs b/gitoxide-core/src/query/engine/command.rs index 1e13cbcddad..af73a7318c1 100644 --- a/gitoxide-core/src/query/engine/command.rs +++ b/gitoxide-core/src/query/engine/command.rs @@ -1,12 +1,13 @@ -use crate::query; -use crate::query::engine::update::FileMode; -use crate::query::Command; +use std::collections::HashMap; + use anyhow::Context; -use gix::bstr::ByteSlice; -use gix::prelude::ObjectIdExt; -use gix::Progress; +use gix::{bstr::ByteSlice, prelude::ObjectIdExt, Progress}; use rusqlite::{params, OptionalExtension}; -use std::collections::HashMap; + +use crate::{ + query, + query::{engine::update::FileMode, Command}, +}; impl query::Engine { pub fn run( @@ -110,10 +111,12 @@ impl query::Engine { } mod trace_path { - use crate::query::engine::update::FileMode; - use gix::prelude::ObjectIdExt; use std::collections::HashMap; + use gix::prelude::ObjectIdExt; + + use crate::query::engine::update::FileMode; + #[derive(Debug, Default, Copy, Clone)] pub struct Diff { pub lines_added: usize, diff --git a/gitoxide-core/src/query/engine/update.rs b/gitoxide-core/src/query/engine/update.rs index 5abc83f8cd5..be62bed73c0 100644 --- a/gitoxide-core/src/query/engine/update.rs +++ b/gitoxide-core/src/query/engine/update.rs @@ -1,16 +1,22 @@ -use crate::query::Options; +use std::{ + convert::Infallible, + sync::atomic::{AtomicUsize, Ordering}, + time::Instant, +}; + use anyhow::{anyhow, bail}; -use gix::bstr::{BStr, BString, ByteSlice}; -use gix::features::progress; -use gix::object::tree::diff::rewrites::CopySource; -use gix::odb::FindExt; -use gix::parallel::{InOrderIter, SequenceId}; -use gix::prelude::ObjectIdExt; -use gix::Progress; +use gix::{ + bstr::{BStr, BString, ByteSlice}, + features::progress, + object::tree::diff::rewrites::CopySource, + odb::FindExt, + parallel::{InOrderIter, SequenceId}, + prelude::ObjectIdExt, + Progress, +}; use rusqlite::{params, Statement, Transaction}; -use std::convert::Infallible; -use std::sync::atomic::{AtomicUsize, Ordering}; -use std::time::Instant; + +use crate::query::Options; pub fn update( repo: &gix::Repository, diff --git a/gitoxide-core/src/repository/clone.rs b/gitoxide-core/src/repository/clone.rs index 59d521b3f19..e5a0bc55d0b 100644 --- a/gitoxide-core/src/repository/clone.rs +++ b/gitoxide-core/src/repository/clone.rs @@ -13,7 +13,6 @@ pub(crate) mod function { use std::ffi::OsStr; use anyhow::{bail, Context}; - use gix::{bstr::BString, remote::fetch::Status, Progress}; use super::Options; diff --git a/gitoxide-core/src/repository/config.rs b/gitoxide-core/src/repository/config.rs index efeb2c53ef8..5ec1bedba6e 100644 --- a/gitoxide-core/src/repository/config.rs +++ b/gitoxide-core/src/repository/config.rs @@ -1,5 +1,4 @@ use anyhow::{bail, Result}; - use gix::bstr::{BStr, BString}; use crate::OutputFormat; diff --git a/gitoxide-core/src/repository/exclude.rs b/gitoxide-core/src/repository/exclude.rs index c6f620b9ff9..86054443bb2 100644 --- a/gitoxide-core/src/repository/exclude.rs +++ b/gitoxide-core/src/repository/exclude.rs @@ -1,7 +1,6 @@ use std::io; use anyhow::{bail, Context}; - use gix::prelude::FindExt; use crate::OutputFormat; diff --git a/gitoxide-core/src/repository/fetch.rs b/gitoxide-core/src/repository/fetch.rs index 1b980965487..580cc4d9193 100644 --- a/gitoxide-core/src/repository/fetch.rs +++ b/gitoxide-core/src/repository/fetch.rs @@ -15,7 +15,6 @@ pub const PROGRESS_RANGE: std::ops::RangeInclusive = 1..=3; pub(crate) mod function { use anyhow::bail; - use gix::{prelude::ObjectIdExt, refspec::match_group::validate::Fix, remote::fetch::Status}; use super::Options; diff --git a/gitoxide-core/src/repository/remote.rs b/gitoxide-core/src/repository/remote.rs index a10f63d7122..78df7112424 100644 --- a/gitoxide-core/src/repository/remote.rs +++ b/gitoxide-core/src/repository/remote.rs @@ -1,7 +1,6 @@ #[cfg(any(feature = "blocking-client", feature = "async-client"))] mod refs_impl { use anyhow::bail; - use gix::{ protocol::handshake, refspec::{match_group::validate::Fix, RefSpec}, diff --git a/gitoxide-core/src/repository/revision/explain.rs b/gitoxide-core/src/repository/revision/explain.rs index 05c8b283352..eb061f8bc27 100644 --- a/gitoxide-core/src/repository/revision/explain.rs +++ b/gitoxide-core/src/repository/revision/explain.rs @@ -1,5 +1,4 @@ use anyhow::bail; - use gix::{ bstr::{BStr, BString}, revision::plumbing::{ diff --git a/gitoxide-core/src/repository/revision/list.rs b/gitoxide-core/src/repository/revision/list.rs index e87590f5d9d..cce6c5bbc2d 100644 --- a/gitoxide-core/src/repository/revision/list.rs +++ b/gitoxide-core/src/repository/revision/list.rs @@ -1,7 +1,6 @@ use std::ffi::OsString; use anyhow::{bail, Context}; - use gix::prelude::ObjectIdExt; use crate::OutputFormat; diff --git a/gitoxide-core/src/repository/tree.rs b/gitoxide-core/src/repository/tree.rs index 0f5aec74a72..7a1a22c8154 100644 --- a/gitoxide-core/src/repository/tree.rs +++ b/gitoxide-core/src/repository/tree.rs @@ -1,7 +1,6 @@ use std::{borrow::Cow, io}; use anyhow::bail; - use gix::Tree; use crate::OutputFormat; @@ -9,9 +8,8 @@ use crate::OutputFormat; mod entries { use std::collections::VecDeque; - use gix::bstr::{ByteSlice, ByteVec}; use gix::{ - bstr::{BStr, BString}, + bstr::{BStr, BString, ByteSlice, ByteVec}, objs::tree::EntryRef, traverse::tree::visit::Action, }; diff --git a/gix-config/src/file/write.rs b/gix-config/src/file/write.rs index 6570a11df7e..29024170d8e 100644 --- a/gix-config/src/file/write.rs +++ b/gix-config/src/file/write.rs @@ -1,7 +1,6 @@ use bstr::{BStr, BString, ByteSlice}; -use crate::file::Section; -use crate::{parse::Event, File}; +use crate::{file::Section, parse::Event, File}; impl File<'_> { /// Serialize this type into a `BString` for convenience. diff --git a/gix-config/tests/file/init/from_paths/includes/conditional/mod.rs b/gix-config/tests/file/init/from_paths/includes/conditional/mod.rs index e82222e7ead..02799d7a17b 100644 --- a/gix-config/tests/file/init/from_paths/includes/conditional/mod.rs +++ b/gix-config/tests/file/init/from_paths/includes/conditional/mod.rs @@ -4,7 +4,6 @@ use gix_config::{ file::{includes, init}, path, File, }; - use tempfile::tempdir; use crate::file::{cow_str, init::from_paths::escape_backslashes}; diff --git a/gix-config/tests/file/init/from_paths/includes/conditional/onbranch.rs b/gix-config/tests/file/init/from_paths/includes/conditional/onbranch.rs index 82b756363b9..b83783c116f 100644 --- a/gix-config/tests/file/init/from_paths/includes/conditional/onbranch.rs +++ b/gix-config/tests/file/init/from_paths/includes/conditional/onbranch.rs @@ -13,7 +13,6 @@ use gix_ref::{ transaction::{Change, PreviousValue, RefEdit}, FullName, Target, }; - use tempfile::tempdir; use crate::file::{cow_str, init::from_paths::includes::conditional::git_init}; diff --git a/gix-config/tests/file/write.rs b/gix-config/tests/file/write.rs index 8d76a533c1a..3ae71d313ff 100644 --- a/gix-config/tests/file/write.rs +++ b/gix-config/tests/file/write.rs @@ -110,10 +110,11 @@ fn complex_lossless_roundtrip() { } mod to_filter { - use crate::file::cow_str; use bstr::ByteSlice; use gix_config::file::Metadata; + use crate::file::cow_str; + #[test] fn allows_only_selected_sections() -> crate::Result { let mut config = gix_config::File::new(Metadata::api()); diff --git a/gix-diff/src/tree/changes.rs b/gix-diff/src/tree/changes.rs index d7d8d38bfef..f0b3e82aba2 100644 --- a/gix-diff/src/tree/changes.rs +++ b/gix-diff/src/tree/changes.rs @@ -357,10 +357,12 @@ fn peekable(iter: I) -> IteratorType { #[cfg(test)] mod tests { - use super::*; - use gix_object::tree::EntryMode; use std::cmp::Ordering; + use gix_object::tree::EntryMode; + + use super::*; + #[test] fn compare_select_samples() { let null = gix_hash::ObjectId::null(gix_hash::Kind::Sha1); diff --git a/gix-diff/src/tree/mod.rs b/gix-diff/src/tree/mod.rs index 90e0dec9bf5..fea4550f648 100644 --- a/gix-diff/src/tree/mod.rs +++ b/gix-diff/src/tree/mod.rs @@ -1,8 +1,7 @@ use std::collections::VecDeque; use gix_hash::ObjectId; -use gix_object::bstr::BString; -use gix_object::TreeRefIter; +use gix_object::{bstr::BString, TreeRefIter}; /// The state required to visit [Changes] to be instantiated with `State::default()`. #[derive(Default, Clone)] diff --git a/gix-diff/src/tree/visit.rs b/gix-diff/src/tree/visit.rs index ad6c36e0872..e94c432ae04 100644 --- a/gix-diff/src/tree/visit.rs +++ b/gix-diff/src/tree/visit.rs @@ -1,6 +1,5 @@ use gix_hash::ObjectId; -use gix_object::tree::EntryMode; -use gix_object::{bstr::BStr, tree}; +use gix_object::{bstr::BStr, tree, tree::EntryMode}; /// Represents any possible change in order to turn one tree into another. #[derive(Debug, Clone, PartialOrd, PartialEq, Ord, Eq, Hash)] diff --git a/gix-diff/tests/tree/mod.rs b/gix-diff/tests/tree/mod.rs index 370dd0d6fd2..836269a4543 100644 --- a/gix-diff/tests/tree/mod.rs +++ b/gix-diff/tests/tree/mod.rs @@ -1,11 +1,14 @@ mod changes { mod to_obtain_tree { - use gix_diff::tree::recorder::Location; - use gix_diff::tree::{recorder, recorder::Change::*}; + use std::collections::HashMap; + + use gix_diff::tree::{ + recorder, + recorder::{Change::*, Location}, + }; use gix_hash::{oid, ObjectId}; use gix_object::{bstr::ByteSlice, tree::EntryMode, TreeRefIter}; use gix_odb::pack::Find; - use std::collections::HashMap; use crate::hex_to_id; diff --git a/gix-features/src/progress.rs b/gix-features/src/progress.rs index 38778609bf7..1b804eb280d 100644 --- a/gix-features/src/progress.rs +++ b/gix-features/src/progress.rs @@ -1,8 +1,8 @@ //! Various `prodash` types along with various utilities for comfort. use std::io; -pub use prodash; pub use prodash::{ + self, messages::MessageLevel, progress::{Discard, DoOrDiscard, Either, Id, Step, StepShared, Task, ThroughputOnDrop, Value, UNKNOWN}, unit, Progress, Unit, diff --git a/gix-index/tests/index/init.rs b/gix-index/tests/index/init.rs index cc87a43a9a9..9d9e3bfc763 100644 --- a/gix-index/tests/index/init.rs +++ b/gix-index/tests/index/init.rs @@ -1,8 +1,7 @@ +use gix::prelude::FindExt; use gix_index::{verify::extensions::no_find, State}; use gix_testtools::scripted_fixture_read_only_standalone; -use gix::prelude::FindExt; - #[test] fn from_tree() -> crate::Result { let fixtures = [ diff --git a/gix-traverse/tests/tree/mod.rs b/gix-traverse/tests/tree/mod.rs index d7ea8462fcd..a7d94c8788f 100644 --- a/gix-traverse/tests/tree/mod.rs +++ b/gix-traverse/tests/tree/mod.rs @@ -1,7 +1,6 @@ use gix_object::bstr::BString; use gix_odb::pack::FindExt; -use gix_traverse::tree; -use gix_traverse::tree::recorder::Location; +use gix_traverse::{tree, tree::recorder::Location}; use crate::hex_to_id; diff --git a/gix/examples/init-repo-and-commit.rs b/gix/examples/init-repo-and-commit.rs index aad2db75908..7b43a639ff8 100644 --- a/gix/examples/init-repo-and-commit.rs +++ b/gix/examples/init-repo-and-commit.rs @@ -2,7 +2,6 @@ // adds initial commit with empty tree use anyhow::Context; - use gix::objs::tree; fn main() -> anyhow::Result<()> { diff --git a/gix/src/clone/fetch/util.rs b/gix/src/clone/fetch/util.rs index 07426943d38..ac8943f6e8a 100644 --- a/gix/src/clone/fetch/util.rs +++ b/gix/src/clone/fetch/util.rs @@ -1,5 +1,4 @@ -use std::io::Write; -use std::{borrow::Cow, convert::TryInto}; +use std::{borrow::Cow, convert::TryInto, io::Write}; use gix_odb::Find; use gix_ref::{ diff --git a/gix/src/clone/mod.rs b/gix/src/clone/mod.rs index cdc9d29aded..249a66a42f0 100644 --- a/gix/src/clone/mod.rs +++ b/gix/src/clone/mod.rs @@ -1,8 +1,7 @@ #![allow(clippy::result_large_err)] use std::convert::TryInto; -use crate::bstr::BString; -use crate::config::tree::gitoxide; +use crate::{bstr::BString, config::tree::gitoxide}; type ConfigureRemoteFn = Box) -> Result, Box>>; diff --git a/gix/src/config/tree/sections/core.rs b/gix/src/config/tree/sections/core.rs index eda669484ff..6ea0580e175 100644 --- a/gix/src/config/tree/sections/core.rs +++ b/gix/src/config/tree/sections/core.rs @@ -111,8 +111,12 @@ pub type Disambiguate = keys::Any; mod disambiguate { use std::borrow::Cow; - use crate::bstr::ByteSlice; - use crate::{bstr::BStr, config, config::tree::core::Disambiguate, revision::spec::parse::ObjectKindHint}; + use crate::{ + bstr::{BStr, ByteSlice}, + config, + config::tree::core::Disambiguate, + revision::spec::parse::ObjectKindHint, + }; impl Disambiguate { /// Convert a disambiguation marker into the respective enum. @@ -167,8 +171,11 @@ mod log_all_ref_updates { mod check_stat { use std::borrow::Cow; - use crate::bstr::ByteSlice; - use crate::{bstr::BStr, config, config::tree::core::CheckStat}; + use crate::{ + bstr::{BStr, ByteSlice}, + config, + config::tree::core::CheckStat, + }; impl CheckStat { /// Returns true if the full set of stat entries should be checked, and it's just as lenient as git. diff --git a/gix/src/config/tree/sections/diff.rs b/gix/src/config/tree/sections/diff.rs index 5e9e0040cf2..103bb7001f7 100644 --- a/gix/src/config/tree/sections/diff.rs +++ b/gix/src/config/tree/sections/diff.rs @@ -70,12 +70,13 @@ mod algorithm { mod renames { use std::borrow::Cow; - use crate::bstr::ByteSlice; - use crate::config::tree::{keys, Section}; - use crate::diff::rename::Tracking; use crate::{ - bstr::BStr, - config::{key::GenericError, tree::sections::diff::Renames}, + bstr::{BStr, ByteSlice}, + config::{ + key::GenericError, + tree::{keys, sections::diff::Renames, Section}, + }, + diff::rename::Tracking, }; impl Renames { @@ -106,11 +107,12 @@ mod renames { } mod validate { + use std::borrow::Cow; + use crate::{ bstr::BStr, config::tree::{keys, Diff}, }; - use std::borrow::Cow; pub struct Algorithm; impl keys::Validate for Algorithm { diff --git a/gix/src/config/tree/sections/http.rs b/gix/src/config/tree/sections/http.rs index 8f36d244fe2..f45c3707616 100644 --- a/gix/src/config/tree/sections/http.rs +++ b/gix/src/config/tree/sections/http.rs @@ -124,8 +124,7 @@ mod key_impls { crate::protocol::transport::client::http::options::FollowRedirects, crate::config::key::GenericErrorWithValue, > { - use crate::bstr::ByteSlice; - use crate::protocol::transport::client::http::options::FollowRedirects; + use crate::{bstr::ByteSlice, protocol::transport::client::http::options::FollowRedirects}; Ok(if value.as_ref().as_bytes() == b"initial" { FollowRedirects::Initial } else if let Some(value) = boolean().map_err(|err| { @@ -172,8 +171,9 @@ mod key_impls { gix_protocol::transport::client::http::options::HttpVersion, crate::config::key::GenericErrorWithValue, > { - use crate::bstr::ByteSlice; use gix_protocol::transport::client::http::options::HttpVersion; + + use crate::bstr::ByteSlice; Ok(match value.as_ref().as_bytes() { b"HTTP/1.1" => HttpVersion::V1_1, b"HTTP/2" => HttpVersion::V2, @@ -199,8 +199,9 @@ mod key_impls { gix_protocol::transport::client::http::options::ProxyAuthMethod, crate::config::key::GenericErrorWithValue, > { - use crate::bstr::ByteSlice; use gix_protocol::transport::client::http::options::ProxyAuthMethod; + + use crate::bstr::ByteSlice; Ok(match value.as_ref().as_bytes() { b"anyauth" => ProxyAuthMethod::AnyAuth, b"basic" => ProxyAuthMethod::Basic, @@ -227,8 +228,9 @@ mod key_impls { value: std::borrow::Cow<'_, crate::bstr::BStr>, ) -> Result { - use crate::bstr::ByteSlice; use gix_protocol::transport::client::http::options::SslVersion::*; + + use crate::bstr::ByteSlice; Ok(match value.as_ref().as_bytes() { b"default" | b"" => Default, b"tlsv1" => TlsV1, diff --git a/gix/src/config/tree/sections/remote.rs b/gix/src/config/tree/sections/remote.rs index c6f93af41a2..b242c9c14e6 100644 --- a/gix/src/config/tree/sections/remote.rs +++ b/gix/src/config/tree/sections/remote.rs @@ -58,8 +58,12 @@ pub type TagOpt = keys::Any; mod tag_opts { use std::borrow::Cow; - use crate::bstr::ByteSlice; - use crate::{bstr::BStr, config, config::tree::remote::TagOpt, remote}; + use crate::{ + bstr::{BStr, ByteSlice}, + config, + config::tree::remote::TagOpt, + remote, + }; impl TagOpt { /// Try to interpret `value` as tag option. diff --git a/gix/src/config/tree/sections/ssh.rs b/gix/src/config/tree/sections/ssh.rs index 0c967b83bfa..600ee663b59 100644 --- a/gix/src/config/tree/sections/ssh.rs +++ b/gix/src/config/tree/sections/ssh.rs @@ -25,8 +25,9 @@ mod variant { value: Cow<'_, BStr>, ) -> Result, config::key::GenericErrorWithValue> { - use crate::bstr::ByteSlice; use gix_protocol::transport::client::ssh::ProgramKind; + + use crate::bstr::ByteSlice; Ok(Some(match value.as_ref().as_bytes() { b"auto" => return Ok(None), b"ssh" => ProgramKind::Ssh, diff --git a/gix/src/config/tree/traits.rs b/gix/src/config/tree/traits.rs index 3d9e4392bf1..7cfd7aac495 100644 --- a/gix/src/config/tree/traits.rs +++ b/gix/src/config/tree/traits.rs @@ -1,5 +1,7 @@ -use crate::bstr::{BStr, BString, ByteVec}; -use crate::config::tree::key::validate_assignment; +use crate::{ + bstr::{BStr, BString, ByteVec}, + config::tree::key::validate_assignment, +}; /// Provide information about a configuration section. pub trait Section { diff --git a/gix/src/object/tree/diff/change.rs b/gix/src/object/tree/diff/change.rs index 3b0c58ed03e..e6826d6ed32 100644 --- a/gix/src/object/tree/diff/change.rs +++ b/gix/src/object/tree/diff/change.rs @@ -1,6 +1,4 @@ -use crate::bstr::BStr; - -use crate::Id; +use crate::{bstr::BStr, Id}; /// Information about the diff performed to detect similarity of a [Rewrite][Event::Rewrite]. #[derive(Debug, Default, Clone, Copy, Eq, PartialEq)] diff --git a/gix/src/object/tree/diff/for_each.rs b/gix/src/object/tree/diff/for_each.rs index 009feae54ce..5cae4cf2fae 100644 --- a/gix/src/object/tree/diff/for_each.rs +++ b/gix/src/object/tree/diff/for_each.rs @@ -2,9 +2,15 @@ use gix_object::TreeRefIter; use gix_odb::FindExt; use super::{change, Action, Change, Platform}; -use crate::object::tree::diff; -use crate::object::tree::diff::{rewrites, tracked}; -use crate::{bstr::BStr, ext::ObjectIdExt, Repository, Tree}; +use crate::{ + bstr::BStr, + ext::ObjectIdExt, + object::tree::{ + diff, + diff::{rewrites, tracked}, + }, + Repository, Tree, +}; /// The error return by methods on the [diff platform][Platform]. #[derive(Debug, thiserror::Error)] diff --git a/gix/src/object/tree/diff/mod.rs b/gix/src/object/tree/diff/mod.rs index 54c58d88780..5a3bf6ddf6a 100644 --- a/gix/src/object/tree/diff/mod.rs +++ b/gix/src/object/tree/diff/mod.rs @@ -1,6 +1,7 @@ -use crate::{bstr::BStr, Tree}; use gix_diff::tree::recorder::Location; +use crate::{bstr::BStr, Tree}; + /// Returned by the `for_each` function to control flow. #[derive(Clone, Copy, PartialOrd, PartialEq, Ord, Eq, Hash)] pub enum Action { diff --git a/gix/src/object/tree/diff/rewrites.rs b/gix/src/object/tree/diff/rewrites.rs index 4c338a76989..304894d159d 100644 --- a/gix/src/object/tree/diff/rewrites.rs +++ b/gix/src/object/tree/diff/rewrites.rs @@ -1,7 +1,8 @@ -use crate::config::cache::util::ApplyLeniency; -use crate::config::tree::Diff; -use crate::diff::rename::Tracking; -use crate::object::tree::diff::Rewrites; +use crate::{ + config::{cache::util::ApplyLeniency, tree::Diff}, + diff::rename::Tracking, + object::tree::diff::Rewrites, +}; /// From where to source copies #[derive(Debug, Copy, Clone, Eq, PartialEq)] diff --git a/gix/src/object/tree/diff/tracked.rs b/gix/src/object/tree/diff/tracked.rs index c980d81340c..3bbe0162402 100644 --- a/gix/src/object/tree/diff/tracked.rs +++ b/gix/src/object/tree/diff/tracked.rs @@ -1,12 +1,18 @@ -use crate::bstr::BStr; -use crate::ext::ObjectIdExt; -use crate::object::tree::diff::change::DiffLineStats; -use crate::object::tree::diff::rewrites::CopySource; -use crate::object::tree::diff::{rewrites::Outcome, Rewrites}; -use crate::{Repository, Tree}; +use std::ops::Range; + use gix_diff::tree::visit::Change; use gix_object::tree::EntryMode; -use std::ops::Range; + +use crate::{ + bstr::BStr, + ext::ObjectIdExt, + object::tree::diff::{ + change::DiffLineStats, + rewrites::{CopySource, Outcome}, + Rewrites, + }, + Repository, Tree, +}; /// A set of tracked items allows to figure out their relations by figuring out their similarity. pub struct Item { @@ -49,8 +55,7 @@ pub struct State { } pub mod visit { - use crate::bstr::BStr; - use crate::object::tree::diff::change::DiffLineStats; + use crate::{bstr::BStr, object::tree::diff::change::DiffLineStats}; pub struct Source<'a> { pub mode: gix_object::tree::EntryMode, @@ -422,10 +427,11 @@ mod diff { } mod tree_to_events { - use crate::bstr::BStr; use gix_diff::tree::visit::Change; use gix_object::tree::EntryRef; + use crate::bstr::BStr; + pub struct Delegate<'a> { parent: &'a mut super::State, recorder: gix_traverse::tree::Recorder, diff --git a/gix/src/repository/config/transport.rs b/gix/src/repository/config/transport.rs index 3d1302caff7..dcfbc0bf658 100644 --- a/gix/src/repository/config/transport.rs +++ b/gix/src/repository/config/transport.rs @@ -53,12 +53,11 @@ impl crate::Repository { http::options::{ProxyAuthMethod, SslVersion, SslVersionRangeInclusive}, }; - use crate::config::tree::Key; use crate::{ config, config::{ cache::util::ApplyLeniency, - tree::{gitoxide, Remote}, + tree::{gitoxide, Key, Remote}, }, }; fn try_cow_to_string( diff --git a/gix/tests/clone/mod.rs b/gix/tests/clone/mod.rs index 93899df0406..821b8d8f618 100644 --- a/gix/tests/clone/mod.rs +++ b/gix/tests/clone/mod.rs @@ -2,11 +2,10 @@ use crate::{remote, util::restricted}; #[cfg(feature = "blocking-network-client")] mod blocking_io { + use gix::remote::fetch::SpecIndex; use gix_object::bstr::ByteSlice; use gix_ref::TargetRef; - use gix::remote::fetch::SpecIndex; - use crate::{remote, util::restricted}; #[test] diff --git a/gix/tests/config/tree.rs b/gix/tests/config/tree.rs index fa386a60fed..720f0b69f87 100644 --- a/gix/tests/config/tree.rs +++ b/gix/tests/config/tree.rs @@ -9,9 +9,8 @@ fn bcow(input: &str) -> Cow<'_, BStr> { mod keys { use std::borrow::Cow; - use gix_object::bstr::ByteSlice; - use gix::config::tree::{Key, Section}; + use gix_object::bstr::ByteSlice; use crate::config::tree::bcow; @@ -119,8 +118,10 @@ mod ssh { } mod diff { - use gix::config::tree::{Diff, Key}; - use gix::diff::rename::Tracking; + use gix::{ + config::tree::{Diff, Key}, + diff::rename::Tracking, + }; use gix_diff::blob::Algorithm; use crate::config::tree::bcow; @@ -468,9 +469,10 @@ mod protocol { mod gitoxide { mod http { - use gix::config::tree::{gitoxide, Key}; use std::time::Duration; + use gix::config::tree::{gitoxide, Key}; + #[test] fn connect_timeout() -> crate::Result { assert_eq!( diff --git a/gix/tests/id/mod.rs b/gix/tests/id/mod.rs index f0d08867333..2535077aaf8 100644 --- a/gix/tests/id/mod.rs +++ b/gix/tests/id/mod.rs @@ -1,11 +1,10 @@ use std::cmp::Ordering; -use gix_object::bstr::BString; - use gix::{ config::tree::{Core, Key}, prelude::ObjectIdExt, }; +use gix_object::bstr::BString; /// Convert a hexadecimal hash into its corresponding `ObjectId` or _panic_. fn hex_to_id(hex: &str) -> gix_hash::ObjectId { diff --git a/gix/tests/object/tree/diff.rs b/gix/tests/object/tree/diff.rs index 085d1333822..936ed3b0e72 100644 --- a/gix/tests/object/tree/diff.rs +++ b/gix/tests/object/tree/diff.rs @@ -1,10 +1,11 @@ -use gix::bstr::BString; use std::convert::Infallible; +use gix::{ + bstr::BString, + object::{blob::diff::line::Change, tree::diff::change::Event}, +}; use gix_object::{bstr::ByteSlice, tree::EntryMode}; -use gix::object::{blob::diff::line::Change, tree::diff::change::Event}; - use crate::named_repo; #[test] @@ -100,14 +101,20 @@ fn tree_named(repo: &gix::Repository, rev_spec: impl AsRef) -> gix::Tree { } mod track_rewrites { - use crate::object::tree::diff::{added, deleted, modified, store, tree_named}; - use crate::util::named_repo; - use gix::object::tree::diff::change::{DiffLineStats, Event}; - use gix::object::tree::diff::rewrites::{Copies, CopySource}; - use gix::object::tree::diff::Rewrites; - use gix_ref::bstr::BStr; use std::convert::Infallible; + use gix::object::tree::diff::{ + change::{DiffLineStats, Event}, + rewrites::{Copies, CopySource}, + Rewrites, + }; + use gix_ref::bstr::BStr; + + use crate::{ + object::tree::diff::{added, deleted, modified, store, tree_named}, + util::named_repo, + }; + #[test] fn renames_by_identity() -> crate::Result { let repo = named_repo("make_diff_repo.sh")?; diff --git a/gix/tests/remote/connect.rs b/gix/tests/remote/connect.rs index 9a8b6ffb3dc..2ceefd9baac 100644 --- a/gix/tests/remote/connect.rs +++ b/gix/tests/remote/connect.rs @@ -1,9 +1,8 @@ #[cfg(feature = "blocking-network-client")] mod blocking_io { mod protocol_allow { - use gix_features::progress; - use gix::remote::Direction::Fetch; + use gix_features::progress; use serial_test::serial; use crate::remote; diff --git a/gix/tests/remote/fetch.rs b/gix/tests/remote/fetch.rs index 6ab5bc5affa..240c158686f 100644 --- a/gix/tests/remote/fetch.rs +++ b/gix/tests/remote/fetch.rs @@ -2,11 +2,10 @@ mod blocking_and_async_io { use std::sync::atomic::AtomicBool; + use gix::remote::{fetch, Direction::Fetch}; use gix_features::progress; use gix_protocol::maybe_async; - use gix::remote::{fetch, Direction::Fetch}; - use crate::{ remote::{into_daemon_remote_if_async, spawn_git_daemon_if_async}, util::hex_to_id, diff --git a/gix/tests/remote/ref_map.rs b/gix/tests/remote/ref_map.rs index a41b7bcd745..cab1c94ff41 100644 --- a/gix/tests/remote/ref_map.rs +++ b/gix/tests/remote/ref_map.rs @@ -1,10 +1,9 @@ #[cfg(any(feature = "blocking-network-client", feature = "async-network-client-async-std"))] mod blocking_and_async_io { + use gix::remote::Direction::Fetch; use gix_features::progress; use gix_protocol::maybe_async; - use gix::remote::Direction::Fetch; - use crate::{ remote, remote::{into_daemon_remote_if_async, spawn_git_daemon_if_async}, diff --git a/gix/tests/repository/config/identity.rs b/gix/tests/repository/config/identity.rs index f1fe95ce74f..f49c8ae7d75 100644 --- a/gix/tests/repository/config/identity.rs +++ b/gix/tests/repository/config/identity.rs @@ -2,7 +2,6 @@ use std::path::Path; use gix_sec::Permission; use gix_testtools::Env; - use serial_test::serial; use crate::named_repo; diff --git a/gix/tests/repository/open.rs b/gix/tests/repository/open.rs index ba45cd4f362..b0da3a2d022 100644 --- a/gix/tests/repository/open.rs +++ b/gix/tests/repository/open.rs @@ -157,7 +157,6 @@ mod with_overrides { use gix_object::bstr::BStr; use gix_sec::Permission; use gix_testtools::Env; - use serial_test::serial; use crate::util::named_subrepo_opts; diff --git a/gix/tests/repository/reference.rs b/gix/tests/repository/reference.rs index 596049d7e29..dad967ec3d0 100644 --- a/gix/tests/repository/reference.rs +++ b/gix/tests/repository/reference.rs @@ -1,7 +1,6 @@ mod set_namespace { - use gix_testtools::tempfile; - use gix::refs::transaction::PreviousValue; + use gix_testtools::tempfile; fn easy_repo_rw() -> crate::Result<(gix::Repository, tempfile::TempDir)> { crate::repo_rw("make_references_repo.sh") diff --git a/gix/tests/repository/remote.rs b/gix/tests/repository/remote.rs index 8f16b43f423..044ceeb0b4e 100644 --- a/gix/tests/repository/remote.rs +++ b/gix/tests/repository/remote.rs @@ -103,9 +103,8 @@ mod remote_at { mod find_remote { use std::io::BufRead; - use gix_object::bstr::BString; - use gix::{remote::Direction, Repository}; + use gix_object::bstr::BString; use crate::remote; diff --git a/src/porcelain/options.rs b/src/porcelain/options.rs index 6167afb0f27..1ae734bf8c0 100644 --- a/src/porcelain/options.rs +++ b/src/porcelain/options.rs @@ -86,9 +86,10 @@ pub enum ToolCommands { #[cfg(feature = "gitoxide-core-tools")] pub mod tools { - use gix::bstr::BString; use std::path::PathBuf; + use gix::bstr::BString; + #[cfg(feature = "gitoxide-core-tools-query")] #[derive(Debug, clap::Parser)] #[command(