From 535e967666c6da657ff1b7eff7c64ab27cafb182 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 5 Sep 2022 18:52:14 +0800 Subject: [PATCH] make fmt --- cargo-smart-release/src/changelog/tests.rs | 3 ++- git-command/src/lib.rs | 6 +++-- git-config-value/src/boolean.rs | 3 +-- git-config-value/tests/value/boolean.rs | 6 +++-- git-config-value/tests/value/color.rs | 3 ++- git-config-value/tests/value/integer.rs | 4 +-- git-config-value/tests/value/main.rs | 3 ++- git-config-value/tests/value/path.rs | 3 ++- git-config/src/file/access/comfort.rs | 3 +-- git-config/src/file/access/raw.rs | 3 +-- git-credentials/src/helper/cascade.rs | 4 +-- git-credentials/src/helper/invoke.rs | 4 +-- git-credentials/src/helper/mod.rs | 7 ++--- git-credentials/src/program/main.rs | 14 +++++----- git-credentials/src/program/mod.rs | 6 +++-- git-credentials/src/protocol/context/mod.rs | 7 ++--- git-credentials/src/protocol/context/serde.rs | 15 ++++++----- git-credentials/src/protocol/mod.rs | 3 ++- git-credentials/tests/helper/cascade.rs | 13 ++++++---- git-credentials/tests/helper/invoke.rs | 6 ++--- git-credentials/tests/helper/mod.rs | 3 +-- .../tests/program/from_custom_definition.rs | 3 +-- git-date/src/parse.rs | 26 +++++++++++-------- git-date/src/time/format.rs | 10 +++---- git-date/src/time/init.rs | 7 +++-- git-date/src/time/mod.rs | 3 +-- git-date/src/time/write.rs | 4 +-- git-date/tests/time/format.rs | 6 +++-- git-date/tests/time/parse.rs | 12 ++++----- git-discover/src/upwards/mod.rs | 7 +++-- git-discover/src/upwards/types.rs | 7 ++--- git-discover/src/upwards/util.rs | 3 ++- git-discover/tests/is_git/mod.rs | 3 ++- git-hash/src/kind.rs | 4 +-- git-hash/tests/prefix/mod.rs | 3 +-- git-index/src/entry/flags.rs | 3 ++- git-index/src/entry/write.rs | 3 ++- .../extension/end_of_index_entry/decode.rs | 10 ++++--- .../src/extension/end_of_index_entry/write.rs | 3 +-- git-index/src/extension/tree/decode.rs | 10 ++++--- git-index/src/extension/tree/verify.rs | 6 +++-- git-index/src/extension/tree/write.rs | 3 ++- git-index/src/file/write.rs | 3 ++- git-index/src/write.rs | 7 +++-- git-index/tests/index/file/write.rs | 8 +++--- git-prompt/examples/use-askpass.rs | 3 ++- git-prompt/src/types.rs | 4 +-- git-prompt/src/unix.rs | 17 ++++++------ git-prompt/tests/options/mod.rs | 4 +-- git-protocol/src/fetch/error.rs | 3 +-- git-protocol/src/fetch/handshake.rs | 19 +++++++------- git-protocol/src/fetch/mod.rs | 3 +-- git-protocol/src/fetch/refs/blocking_io.rs | 3 +-- git-protocol/src/fetch/refs/function.rs | 12 +++++---- git-protocol/src/fetch_fn.rs | 3 +-- git-protocol/src/lib.rs | 3 +-- git-refspec/src/instruction.rs | 3 ++- git-refspec/src/parse.rs | 8 ++++-- git-refspec/src/spec.rs | 15 ++++++++--- git-refspec/tests/impls/mod.rs | 10 ++++--- git-refspec/tests/parse/fetch.rs | 7 ++++- git-refspec/tests/parse/invalid.rs | 3 ++- git-refspec/tests/parse/mod.rs | 3 ++- git-refspec/tests/parse/push.rs | 7 ++++- git-repository/src/config/cache/init.rs | 6 ++--- git-repository/src/config/cache/util.rs | 3 ++- .../config/snapshot/apply_cli_overrides.rs | 7 +++-- .../src/config/snapshot/credential_helpers.rs | 11 +++++--- git-repository/src/config/snapshot/mod.rs | 7 +++-- git-repository/src/env.rs | 6 +++-- git-repository/src/reference/edits.rs | 10 +++---- git-repository/src/reference/remote.rs | 7 +++-- git-repository/src/remote/access.rs | 3 ++- git-repository/src/remote/build.rs | 4 +-- git-repository/src/remote/connect.rs | 7 +++-- .../src/remote/connection/list_refs.rs | 4 +-- git-repository/src/remote/connection/mod.rs | 7 ++--- git-repository/src/remote/errors.rs | 3 +-- git-repository/src/remote/init.rs | 6 +++-- git-repository/src/remote/url/rewrite.rs | 7 +++-- .../src/remote/url/scheme_permission.rs | 11 ++++---- git-repository/src/repository/config.rs | 14 +++++----- git-repository/src/repository/identity.rs | 3 +-- git-repository/src/repository/remote.rs | 4 +-- git-repository/tests/head/mod.rs | 3 ++- git-repository/tests/reference/remote.rs | 3 ++- git-repository/tests/remote/connect.rs | 3 ++- git-repository/tests/remote/list_refs.rs | 3 ++- git-repository/tests/remote/mod.rs | 4 +-- .../config_snapshot/credential_helpers.rs | 6 +++-- .../tests/repository/config/identity.rs | 6 +++-- .../tests/repository/config/remote.rs | 4 +-- git-repository/tests/repository/object.rs | 9 ++++--- git-repository/tests/repository/open.rs | 3 ++- git-repository/tests/repository/remote.rs | 12 +++++---- git-repository/tests/repository/worktree.rs | 6 +++-- git-revision/src/spec/parse/function.rs | 3 +-- git-transport/src/client/async_io/connect.rs | 4 +-- .../src/client/blocking_io/connect.rs | 4 +-- git-transport/src/client/git/async_io.rs | 7 ++--- git-transport/src/lib.rs | 3 +-- git-url/src/impls.rs | 7 ++--- git-url/src/parse.rs | 8 +++--- gitoxide-core/src/repository/credential.rs | 3 ++- gitoxide-core/src/repository/remote.rs | 3 ++- gitoxide-core/src/repository/revision/list.rs | 3 ++- .../src/repository/revision/resolve.rs | 5 ++-- src/plumbing/main.rs | 5 ++-- src/plumbing/options.rs | 4 +-- tests/tools/src/lib.rs | 2 +- 110 files changed, 369 insertions(+), 287 deletions(-) diff --git a/cargo-smart-release/src/changelog/tests.rs b/cargo-smart-release/src/changelog/tests.rs index c5b3c1522b5..b60464b73aa 100644 --- a/cargo-smart-release/src/changelog/tests.rs +++ b/cargo-smart-release/src/changelog/tests.rs @@ -1,7 +1,8 @@ mod repository_url { - use crate::changelog::write::RepositoryUrl; use git_repository as git; + use crate::changelog::write::RepositoryUrl; + #[test] fn github_https_url() { for input in [ diff --git a/git-command/src/lib.rs b/git-command/src/lib.rs index 8ac48bfd082..0038f7f07d0 100644 --- a/git-command/src/lib.rs +++ b/git-command/src/lib.rs @@ -15,10 +15,12 @@ pub struct Prepare { } mod prepare { - use crate::Prepare; - use git_testtools::bstr::ByteSlice; use std::process::{Command, Stdio}; + use git_testtools::bstr::ByteSlice; + + use crate::Prepare; + /// Builder impl Prepare { /// If called, the command will not be executed directly, but with `sh`. diff --git a/git-config-value/src/boolean.rs b/git-config-value/src/boolean.rs index 43019e156e3..3e86f8e1255 100644 --- a/git-config-value/src/boolean.rs +++ b/git-config-value/src/boolean.rs @@ -1,5 +1,4 @@ -use std::ffi::OsString; -use std::{borrow::Cow, convert::TryFrom, fmt::Display}; +use std::{borrow::Cow, convert::TryFrom, ffi::OsString, fmt::Display}; use bstr::{BStr, BString, ByteSlice}; diff --git a/git-config-value/tests/value/boolean.rs b/git-config-value/tests/value/boolean.rs index e9e7ec28ed8..c6b886df289 100644 --- a/git-config-value/tests/value/boolean.rs +++ b/git-config-value/tests/value/boolean.rs @@ -1,7 +1,9 @@ -use crate::b; -use git_config_value::Boolean; use std::convert::TryFrom; +use git_config_value::Boolean; + +use crate::b; + #[test] fn from_str_false() -> crate::Result { assert!(!Boolean::try_from(b("no"))?.0); diff --git a/git-config-value/tests/value/color.rs b/git-config-value/tests/value/color.rs index 463297cc531..e7b27c18cea 100644 --- a/git-config-value/tests/value/color.rs +++ b/git-config-value/tests/value/color.rs @@ -1,7 +1,8 @@ mod name { - use git_config_value::color::Name; use std::str::FromStr; + use git_config_value::color::Name; + #[test] fn non_bright() { assert_eq!(Name::from_str("normal"), Ok(Name::Normal)); diff --git a/git-config-value/tests/value/integer.rs b/git-config-value/tests/value/integer.rs index ee95f13282a..04e2439f842 100644 --- a/git-config-value/tests/value/integer.rs +++ b/git-config-value/tests/value/integer.rs @@ -1,8 +1,8 @@ use std::convert::TryFrom; +use git_config_value::{integer::Suffix, Integer}; + use crate::b; -use git_config_value::integer::Suffix; -use git_config_value::Integer; #[test] fn from_str_no_suffix() { diff --git a/git-config-value/tests/value/main.rs b/git-config-value/tests/value/main.rs index 0097b112e55..13a33c9d8f6 100644 --- a/git-config-value/tests/value/main.rs +++ b/git-config-value/tests/value/main.rs @@ -1,6 +1,7 @@ -use bstr::{BStr, ByteSlice}; use std::borrow::Cow; +use bstr::{BStr, ByteSlice}; + type Result = std::result::Result>; fn b(s: &str) -> &bstr::BStr { s.into() diff --git a/git-config-value/tests/value/path.rs b/git-config-value/tests/value/path.rs index a075dd5496b..83279bfca49 100644 --- a/git-config-value/tests/value/path.rs +++ b/git-config-value/tests/value/path.rs @@ -1,10 +1,11 @@ mod interpolate { - use git_config_value::path; use std::{ borrow::Cow, path::{Path, PathBuf}, }; + use git_config_value::path; + use crate::{b, cow_str}; #[test] diff --git a/git-config/src/file/access/comfort.rs b/git-config/src/file/access/comfort.rs index b50a0f8f07c..e9ac2c13ca9 100644 --- a/git-config/src/file/access/comfort.rs +++ b/git-config/src/file/access/comfort.rs @@ -2,8 +2,7 @@ use std::{borrow::Cow, convert::TryFrom}; use bstr::BStr; -use crate::parse::section; -use crate::{file::MetadataFilter, lookup, value, File}; +use crate::{file::MetadataFilter, lookup, parse::section, value, File}; /// Comfortable API for accessing values impl<'event> File<'event> { diff --git a/git-config/src/file/access/raw.rs b/git-config/src/file/access/raw.rs index e2b84da6a38..2b4fc6da944 100644 --- a/git-config/src/file/access/raw.rs +++ b/git-config/src/file/access/raw.rs @@ -1,5 +1,4 @@ -use std::convert::TryInto; -use std::{borrow::Cow, collections::HashMap}; +use std::{borrow::Cow, collections::HashMap, convert::TryInto}; use bstr::BStr; use smallvec::ToSmallVec; diff --git a/git-credentials/src/helper/cascade.rs b/git-credentials/src/helper/cascade.rs index 9cdae70a22a..de5896b789d 100644 --- a/git-credentials/src/helper/cascade.rs +++ b/git-credentials/src/helper/cascade.rs @@ -1,6 +1,4 @@ -use crate::helper::Cascade; -use crate::protocol::Context; -use crate::{helper, protocol, Program}; +use crate::{helper, helper::Cascade, protocol, protocol::Context, Program}; impl Default for Cascade { fn default() -> Self { diff --git a/git-credentials/src/helper/invoke.rs b/git-credentials/src/helper/invoke.rs index 9d6bdac7610..a543ec761d5 100644 --- a/git-credentials/src/helper/invoke.rs +++ b/git-credentials/src/helper/invoke.rs @@ -1,7 +1,7 @@ -use crate::helper::{Action, NextAction}; -use crate::helper::{Context, Error, Outcome, Result}; use std::io::Read; +use crate::helper::{Action, Context, Error, NextAction, Outcome, Result}; + impl Action { /// Send ourselves to the given `write` which is expected to be credentials-helper compatible pub fn send(&self, mut write: impl std::io::Write) -> std::io::Result<()> { diff --git a/git-credentials/src/helper/mod.rs b/git-credentials/src/helper/mod.rs index 743e2dedda3..b86d2c8360d 100644 --- a/git-credentials/src/helper/mod.rs +++ b/git-credentials/src/helper/mod.rs @@ -1,8 +1,9 @@ -use crate::protocol::Context; -use crate::{protocol, Program}; -use bstr::{BStr, BString}; use std::convert::TryFrom; +use bstr::{BStr, BString}; + +use crate::{protocol, protocol::Context, Program}; + /// A list of helper programs to run in order to obtain credentials. #[allow(dead_code)] #[derive(Debug)] diff --git a/git-credentials/src/program/main.rs b/git-credentials/src/program/main.rs index ea67ee7a2aa..062bcfc99a3 100644 --- a/git-credentials/src/program/main.rs +++ b/git-credentials/src/program/main.rs @@ -1,6 +1,6 @@ +use std::{convert::TryFrom, ffi::OsString}; + use bstr::BString; -use std::convert::TryFrom; -use std::ffi::OsString; /// The action passed to the credential helper implementation in [`main()`][crate::program::main()]. #[derive(Debug, Copy, Clone)] @@ -60,10 +60,12 @@ pub enum Error { } pub(crate) mod function { - use crate::program::main::{Action, Error}; - use crate::protocol::Context; - use std::convert::TryInto; - use std::ffi::OsString; + use std::{convert::TryInto, ffi::OsString}; + + use crate::{ + program::main::{Action, Error}, + protocol::Context, + }; /// Invoke a custom credentials helper which receives program `args`, with the first argument being the /// action to perform (as opposed to the program name). diff --git a/git-credentials/src/program/mod.rs b/git-credentials/src/program/mod.rs index c60cd45fe61..fa34cb4c252 100644 --- a/git-credentials/src/program/mod.rs +++ b/git-credentials/src/program/mod.rs @@ -1,7 +1,9 @@ -use crate::{helper, Program}; -use bstr::{BString, ByteSlice, ByteVec}; use std::process::{Command, Stdio}; +use bstr::{BString, ByteSlice, ByteVec}; + +use crate::{helper, Program}; + /// The kind of helper program to use. #[derive(Debug, Clone, Eq, PartialEq)] pub enum Kind { diff --git a/git-credentials/src/protocol/context/mod.rs b/git-credentials/src/protocol/context/mod.rs index d8b9079669c..1d20c6dc11c 100644 --- a/git-credentials/src/protocol/context/mod.rs +++ b/git-credentials/src/protocol/context/mod.rs @@ -9,9 +9,10 @@ pub enum Error { } mod access { - use crate::protocol::Context; use bstr::BString; + use crate::protocol::Context; + impl Context { /// Convert all relevant fields into a URL for consumption. pub fn to_url(&self) -> Option { @@ -44,10 +45,10 @@ mod access { } mod mutate { - use crate::protocol; - use crate::protocol::Context; use bstr::ByteSlice; + use crate::{protocol, protocol::Context}; + /// In-place mutation impl Context { /// Destructure the url at our `url` field into parts like protocol, host, username and path and store diff --git a/git-credentials/src/protocol/context/serde.rs b/git-credentials/src/protocol/context/serde.rs index 13c7fb7f165..d64bdca6ccb 100644 --- a/git-credentials/src/protocol/context/serde.rs +++ b/git-credentials/src/protocol/context/serde.rs @@ -1,11 +1,12 @@ -use crate::protocol::context::Error; use bstr::BStr; +use crate::protocol::context::Error; + mod write { - use crate::protocol::context::serde::validate; - use crate::protocol::Context; use bstr::{BStr, BString}; + use crate::protocol::{context::serde::validate, Context}; + impl Context { /// Write ourselves to `out` such that [`from_bytes()`][Self::from_bytes()] can decode it losslessly. pub fn write_to(&self, mut out: impl std::io::Write) -> std::io::Result<()> { @@ -49,12 +50,12 @@ mod write { /// pub mod decode { - use crate::protocol::context; - use crate::protocol::context::serde::validate; - use crate::protocol::Context; - use bstr::{BString, ByteSlice}; use std::convert::TryFrom; + use bstr::{BString, ByteSlice}; + + use crate::protocol::{context, context::serde::validate, Context}; + /// The error returned by [`from_bytes()`][Context::from_bytes()]. #[derive(Debug, thiserror::Error)] #[allow(missing_docs)] diff --git a/git-credentials/src/protocol/mod.rs b/git-credentials/src/protocol/mod.rs index e1996313f7a..794382493f7 100644 --- a/git-credentials/src/protocol/mod.rs +++ b/git-credentials/src/protocol/mod.rs @@ -1,6 +1,7 @@ -use crate::helper; use bstr::BString; +use crate::helper; + /// The outcome of the credentials top-level functions to obtain a complete identity. #[derive(Debug, Clone, Eq, PartialEq)] pub struct Outcome { diff --git a/git-credentials/tests/helper/cascade.rs b/git-credentials/tests/helper/cascade.rs index 8ec8cdd8b99..97f2bb9c5c6 100644 --- a/git-credentials/tests/helper/cascade.rs +++ b/git-credentials/tests/helper/cascade.rs @@ -1,12 +1,15 @@ mod invoke { + use std::convert::TryInto; + use bstr::{ByteSlice, ByteVec}; - use git_credentials::helper::Action; - use git_credentials::helper::Cascade; - use git_credentials::protocol::Context; - use git_credentials::{program, protocol, Program}; + use git_credentials::{ + helper::{Action, Cascade}, + program, protocol, + protocol::Context, + Program, + }; use git_sec::identity::Account; use git_testtools::fixture_path; - use std::convert::TryInto; #[test] fn credentials_are_filled_in_one_by_one_and_stop_when_complete() { diff --git a/git-credentials/tests/helper/invoke.rs b/git-credentials/tests/helper/invoke.rs index 557f963e6b4..e01dd4647ba 100644 --- a/git-credentials/tests/helper/invoke.rs +++ b/git-credentials/tests/helper/invoke.rs @@ -1,6 +1,5 @@ use bstr::{BString, ByteVec}; -use git_credentials::protocol::Context; -use git_credentials::{helper, Program}; +use git_credentials::{helper, protocol::Context, Program}; use git_testtools::fixture_path; #[test] @@ -45,9 +44,10 @@ fn store_and_reject() { } mod program { - use crate::helper::invoke::script_helper; use git_credentials::{helper, program::Kind, Program}; + use crate::helper::invoke::script_helper; + #[test] fn builtin() { assert!( diff --git a/git-credentials/tests/helper/mod.rs b/git-credentials/tests/helper/mod.rs index 4ea65fc4d67..c86db16affe 100644 --- a/git-credentials/tests/helper/mod.rs +++ b/git-credentials/tests/helper/mod.rs @@ -3,8 +3,7 @@ mod context; mod invoke; mod invoke_outcome_to_helper_result { - use git_credentials::protocol::helper_outcome_to_result; - use git_credentials::{helper, protocol}; + use git_credentials::{helper, protocol, protocol::helper_outcome_to_result}; #[test] fn missing_username_or_password_causes_failure_with_get_action() { diff --git a/git-credentials/tests/program/from_custom_definition.rs b/git-credentials/tests/program/from_custom_definition.rs index df27927f205..a29c75ab11d 100644 --- a/git-credentials/tests/program/from_custom_definition.rs +++ b/git-credentials/tests/program/from_custom_definition.rs @@ -1,5 +1,4 @@ -use git_credentials::program::Kind; -use git_credentials::Program; +use git_credentials::{program::Kind, Program}; #[test] fn script() { diff --git a/git-date/src/parse.rs b/git-date/src/parse.rs index 1c88b26734b..814cacd2c30 100644 --- a/git-date/src/parse.rs +++ b/git-date/src/parse.rs @@ -12,15 +12,19 @@ pub enum Error { } pub(crate) mod function { - use crate::parse::{relative, Error}; - use crate::time::format::{DEFAULT, ISO8601, ISO8601_STRICT, RFC2822, SHORT}; - use crate::time::Sign; - use crate::Time; - use std::convert::TryInto; - use std::str::FromStr; - use std::time::SystemTime; + use std::{convert::TryInto, str::FromStr, time::SystemTime}; + use time::{Date, OffsetDateTime}; + use crate::{ + parse::{relative, Error}, + time::{ + format::{DEFAULT, ISO8601, ISO8601_STRICT, RFC2822, SHORT}, + Sign, + }, + Time, + }; + #[allow(missing_docs)] pub fn parse(input: &str, now: Option) -> Result { // TODO: actual implementation, this is just to not constantly fail @@ -82,12 +86,12 @@ pub(crate) mod function { } mod relative { - use crate::parse::Error; - use std::convert::TryInto; - use std::str::FromStr; - use std::time::SystemTime; + use std::{convert::TryInto, str::FromStr, time::SystemTime}; + use time::{Duration, OffsetDateTime}; + use crate::parse::Error; + fn parse_inner(input: &str) -> Option { let mut split = input.split_whitespace(); let multiplier = i64::from_str(split.next()?).ok()?; diff --git a/git-date/src/time/format.rs b/git-date/src/time/format.rs index ad382e29b83..825ba8c0f52 100644 --- a/git-date/src/time/format.rs +++ b/git-date/src/time/format.rs @@ -1,7 +1,6 @@ -use crate::time::Format; -use crate::Time; -use time::format_description::FormatItem; -use time::macros::format_description; +use time::{format_description::FormatItem, macros::format_description}; + +use crate::{time::Format, Time}; /// E.g. `2018-12-24` pub const SHORT: &[FormatItem<'_>] = format_description!("[year]-[month]-[day]"); @@ -31,9 +30,10 @@ pub const DEFAULT: &[FormatItem<'_>] = format_description!( ); mod format_impls { - use crate::time::Format; use time::format_description::FormatItem; + use crate::time::Format; + impl<'a> From<&'a [FormatItem<'a>]> for Format<'a> { fn from(f: &'a [FormatItem<'a>]) -> Self { Format::Custom(f) diff --git a/git-date/src/time/init.rs b/git-date/src/time/init.rs index 075112db842..70a3cf8a10f 100644 --- a/git-date/src/time/init.rs +++ b/git-date/src/time/init.rs @@ -1,7 +1,6 @@ -use crate::time::Sign; -use crate::Time; -use std::convert::TryInto; -use std::ops::Sub; +use std::{convert::TryInto, ops::Sub}; + +use crate::{time::Sign, Time}; /// Instantiation impl Time { diff --git a/git-date/src/time/mod.rs b/git-date/src/time/mod.rs index d93aad0c575..d82b01d8f46 100644 --- a/git-date/src/time/mod.rs +++ b/git-date/src/time/mod.rs @@ -53,8 +53,7 @@ mod sign { } mod impls { - use crate::time::Sign; - use crate::Time; + use crate::{time::Sign, Time}; impl Default for Time { fn default() -> Self { diff --git a/git-date/src/time/write.rs b/git-date/src/time/write.rs index 556c7f56c66..7442fc07e02 100644 --- a/git-date/src/time/write.rs +++ b/git-date/src/time/write.rs @@ -1,7 +1,7 @@ -use crate::time::Sign; -use crate::Time; use bstr::BString; +use crate::{time::Sign, Time}; + /// Serialization with standard `git` format impl Time { /// Serialize this instance into memory, similar to what [`write_to()`][Self::write_to()] would do with arbitrary `Write` implementations. diff --git a/git-date/tests/time/format.rs b/git-date/tests/time/format.rs index 759021a9b7b..46965627aa6 100644 --- a/git-date/tests/time/format.rs +++ b/git-date/tests/time/format.rs @@ -1,5 +1,7 @@ -use git_date::time::{format, Format, Sign}; -use git_date::Time; +use git_date::{ + time::{format, Format, Sign}, + Time, +}; use time::macros::format_description; #[test] diff --git a/git-date/tests/time/parse.rs b/git-date/tests/time/parse.rs index 5ac0fa56614..f8eb67f0fda 100644 --- a/git-date/tests/time/parse.rs +++ b/git-date/tests/time/parse.rs @@ -1,10 +1,8 @@ +use std::{collections::HashMap, str::FromStr, time::SystemTime}; + use bstr::{BString, ByteSlice}; -use git_date::time::Sign; -use git_date::Time; +use git_date::{time::Sign, Time}; use once_cell::sync::Lazy; -use std::collections::HashMap; -use std::str::FromStr; -use std::time::SystemTime; type Result = std::result::Result>; @@ -89,9 +87,9 @@ fn invalid_dates_can_be_produced_without_current_time() { } mod relative { - use git_date::parse::Error; - use git_date::time::Sign; use std::time::SystemTime; + + use git_date::{parse::Error, time::Sign}; use time::{Duration, OffsetDateTime}; #[test] diff --git a/git-discover/src/upwards/mod.rs b/git-discover/src/upwards/mod.rs index 3dd36b32774..5919f887613 100644 --- a/git-discover/src/upwards/mod.rs +++ b/git-discover/src/upwards/mod.rs @@ -11,8 +11,11 @@ pub(crate) mod function { use super::{Error, Options}; #[cfg(unix)] use crate::upwards::util::device_id; - use crate::upwards::util::{find_ceiling_height, shorten_path_with_cwd}; - use crate::{is_git, DOT_GIT_DIR}; + use crate::{ + is_git, + upwards::util::{find_ceiling_height, shorten_path_with_cwd}, + DOT_GIT_DIR, + }; /// Find the location of the git repository directly in `directory` or in any of its parent directories and provide /// an associated Trust level by looking at the git directory's ownership, and control discovery using `options`. diff --git a/git-discover/src/upwards/types.rs b/git-discover/src/upwards/types.rs index 09e3c22b88f..88a16a1e69e 100644 --- a/git-discover/src/upwards/types.rs +++ b/git-discover/src/upwards/types.rs @@ -1,9 +1,6 @@ -use bstr::ByteSlice; -use std::borrow::Cow; +use std::{borrow::Cow, env, path::PathBuf}; -use std::{env, path::PathBuf}; - -use bstr::ByteVec; +use bstr::{ByteSlice, ByteVec}; /// The error returned by [git_discover::upwards()][crate::upwards()]. #[derive(Debug, thiserror::Error)] diff --git a/git-discover/src/upwards/util.rs b/git-discover/src/upwards/util.rs index d25077cbbae..de84dfe3513 100644 --- a/git-discover/src/upwards/util.rs +++ b/git-discover/src/upwards/util.rs @@ -1,6 +1,7 @@ -use crate::DOT_GIT_DIR; use std::path::{Path, PathBuf}; +use crate::DOT_GIT_DIR; + pub(crate) fn shorten_path_with_cwd(cursor: PathBuf, cwd: Option<&Path>) -> PathBuf { fn comp_len(c: std::path::Component<'_>) -> usize { use std::path::Component::*; diff --git a/git-discover/tests/is_git/mod.rs b/git-discover/tests/is_git/mod.rs index 161b9a7773c..70717e56ac5 100644 --- a/git-discover/tests/is_git/mod.rs +++ b/git-discover/tests/is_git/mod.rs @@ -1,9 +1,10 @@ #[cfg(target_os = "macos")] #[test] fn verify_on_exfat() -> crate::Result<()> { - use git_discover::repository::Kind; use std::process::Command; + use git_discover::repository::Kind; + let fixtures = git_testtools::scripted_fixture_repo_read_only("make_exfat_repo_darwin.sh")?; let mount_point = tempfile::tempdir()?; diff --git a/git-hash/src/kind.rs b/git-hash/src/kind.rs index 0b66889b226..86faddda261 100644 --- a/git-hash/src/kind.rs +++ b/git-hash/src/kind.rs @@ -1,6 +1,6 @@ +use std::{convert::TryFrom, str::FromStr}; + use crate::{oid, Kind, ObjectId}; -use std::convert::TryFrom; -use std::str::FromStr; impl Default for Kind { fn default() -> Self { diff --git a/git-hash/tests/prefix/mod.rs b/git-hash/tests/prefix/mod.rs index fed8874a631..d7a3a9fdd0e 100644 --- a/git-hash/tests/prefix/mod.rs +++ b/git-hash/tests/prefix/mod.rs @@ -74,8 +74,7 @@ mod new { mod try_from { use std::{cmp::Ordering, convert::TryFrom}; - use git_hash::prefix::from_hex::Error; - use git_hash::Prefix; + use git_hash::{prefix::from_hex::Error, Prefix}; use git_testtools::hex_to_id; #[test] diff --git a/git-index/src/entry/flags.rs b/git-index/src/entry/flags.rs index 7d690c06fea..ec00a78db26 100644 --- a/git-index/src/entry/flags.rs +++ b/git-index/src/entry/flags.rs @@ -1,6 +1,7 @@ -use crate::entry::Stage; use bitflags::bitflags; +use crate::entry::Stage; + bitflags! { /// In-memory flags pub struct Flags: u32 { diff --git a/git-index/src/entry/write.rs b/git-index/src/entry/write.rs index 8a8b00bd987..2a6ad55884c 100644 --- a/git-index/src/entry/write.rs +++ b/git-index/src/entry/write.rs @@ -1,6 +1,7 @@ -use crate::{entry, Entry, State}; use std::convert::TryInto; +use crate::{entry, Entry, State}; + impl Entry { /// Serialize ourselves to `out` with path access via `state`, without padding. pub fn write_to(&self, mut out: impl std::io::Write, state: &State) -> std::io::Result<()> { diff --git a/git-index/src/extension/end_of_index_entry/decode.rs b/git-index/src/extension/end_of_index_entry/decode.rs index 282091dbed2..4ada0995f5f 100644 --- a/git-index/src/extension/end_of_index_entry/decode.rs +++ b/git-index/src/extension/end_of_index_entry/decode.rs @@ -1,7 +1,9 @@ -use crate::decode::header; -use crate::extension; -use crate::extension::end_of_index_entry::{MIN_SIZE, MIN_SIZE_WITH_HEADER, SIGNATURE}; -use crate::util::from_be_u32; +use crate::{ + decode::header, + extension, + extension::end_of_index_entry::{MIN_SIZE, MIN_SIZE_WITH_HEADER, SIGNATURE}, + util::from_be_u32, +}; /// Decode the end of index entry extension, which is no more than a glorified offset to the first byte of all extensions to allow /// loading entries and extensions in parallel. diff --git a/git-index/src/extension/end_of_index_entry/write.rs b/git-index/src/extension/end_of_index_entry/write.rs index fa6339b1fcc..c47af282f71 100644 --- a/git-index/src/extension/end_of_index_entry/write.rs +++ b/git-index/src/extension/end_of_index_entry/write.rs @@ -1,5 +1,4 @@ -use crate::extension::end_of_index_entry::SIGNATURE; -use crate::extension::Signature; +use crate::extension::{end_of_index_entry::SIGNATURE, Signature}; /// Write this extension to out and generate a hash of `hash_kind` over all `prior_extensions` which are specified as `(signature, size)` /// pair. `one_past_entries` is the offset to the first byte past the entries, which is also the first byte of the signature of the diff --git a/git-index/src/extension/tree/decode.rs b/git-index/src/extension/tree/decode.rs index 09f5dc267d6..1153ab09d7f 100644 --- a/git-index/src/extension/tree/decode.rs +++ b/git-index/src/extension/tree/decode.rs @@ -1,8 +1,12 @@ -use crate::extension::Tree; -use crate::util::{split_at_byte_exclusive, split_at_pos}; -use git_hash::ObjectId; use std::convert::TryInto; +use git_hash::ObjectId; + +use crate::{ + extension::Tree, + util::{split_at_byte_exclusive, split_at_pos}, +}; + /// A recursive data structure pub fn decode(data: &[u8], object_hash: git_hash::Kind) -> Option { let (tree, data) = one_recursive(data, object_hash.len_in_bytes())?; diff --git a/git-index/src/extension/tree/verify.rs b/git-index/src/extension/tree/verify.rs index 15ff4565365..38a0293d3a0 100644 --- a/git-index/src/extension/tree/verify.rs +++ b/git-index/src/extension/tree/verify.rs @@ -1,7 +1,9 @@ -use crate::extension::Tree; -use bstr::{BString, ByteSlice}; use std::cmp::Ordering; +use bstr::{BString, ByteSlice}; + +use crate::extension::Tree; + /// The error returned by [Tree::verify()][crate::extension::Tree::verify()]. #[derive(Debug, thiserror::Error)] #[allow(missing_docs)] diff --git a/git-index/src/extension/tree/write.rs b/git-index/src/extension/tree/write.rs index 08dc47b4d32..2b1e3d94950 100644 --- a/git-index/src/extension/tree/write.rs +++ b/git-index/src/extension/tree/write.rs @@ -1,6 +1,7 @@ -use crate::extension::{tree, Tree}; use std::convert::TryFrom; +use crate::extension::{tree, Tree}; + impl Tree { /// Serialize this instance to `out`. pub fn write_to(&self, mut out: impl std::io::Write) -> Result<(), std::io::Error> { diff --git a/git-index/src/file/write.rs b/git-index/src/file/write.rs index 599d075e4cc..305f9d65e75 100644 --- a/git-index/src/file/write.rs +++ b/git-index/src/file/write.rs @@ -1,6 +1,7 @@ -use crate::{write, File, Version}; use git_features::hash; +use crate::{write, File, Version}; + impl File { /// Write the index to `out` with `options`, to be readable by [`File::at()`], returning the version that was actually written /// to retain all information of this index. diff --git a/git-index/src/write.rs b/git-index/src/write.rs index dc1a081b104..9412d56bcab 100644 --- a/git-index/src/write.rs +++ b/git-index/src/write.rs @@ -1,7 +1,6 @@ -use crate::write::util::CountBytes; -use crate::{entry, extension, State, Version}; -use std::convert::TryInto; -use std::io::Write; +use std::{convert::TryInto, io::Write}; + +use crate::{entry, extension, write::util::CountBytes, State, Version}; /// A way to specify which extensions to write. #[derive(Debug, Copy, Clone)] diff --git a/git-index/tests/index/file/write.rs b/git-index/tests/index/file/write.rs index af92eda56fd..f4dead30d83 100644 --- a/git-index/tests/index/file/write.rs +++ b/git-index/tests/index/file/write.rs @@ -1,9 +1,7 @@ -use crate::fixture_index_path; -use crate::index::file::read::loose_file_path; use filetime::FileTime; -use git_index::verify::extensions::no_find; -use git_index::write::Options; -use git_index::{decode, entry, extension, write, State, Version}; +use git_index::{decode, entry, extension, verify::extensions::no_find, write, write::Options, State, Version}; + +use crate::{fixture_index_path, index::file::read::loose_file_path}; /// Round-trips should eventually be possible for all files we have, as we write them back exactly as they were read. #[test] diff --git a/git-prompt/examples/use-askpass.rs b/git-prompt/examples/use-askpass.rs index 3c399ebc8c2..cde4fdf0443 100644 --- a/git-prompt/examples/use-askpass.rs +++ b/git-prompt/examples/use-askpass.rs @@ -1,6 +1,7 @@ -use git_prompt::{Mode, Options}; use std::borrow::Cow; +use git_prompt::{Mode, Options}; + fn main() -> Result<(), Box> { let pass = git_prompt::ask( "Password: ", diff --git a/git-prompt/src/types.rs b/git-prompt/src/types.rs index 02254f20629..49ea309f399 100644 --- a/git-prompt/src/types.rs +++ b/git-prompt/src/types.rs @@ -1,6 +1,4 @@ -use std::borrow::Cow; -use std::convert::TryFrom; -use std::path::Path; +use std::{borrow::Cow, convert::TryFrom, path::Path}; /// The error returned by [ask()][crate::ask()]. #[derive(Debug, thiserror::Error)] diff --git a/git-prompt/src/unix.rs b/git-prompt/src/unix.rs index 9b98925f76b..f48f7d269b8 100644 --- a/git-prompt/src/unix.rs +++ b/git-prompt/src/unix.rs @@ -3,14 +3,15 @@ pub const TTY_PATH: &str = "/dev/tty"; #[cfg(unix)] pub(crate) mod imp { - use crate::unix::TTY_PATH; - use crate::{Error, Mode, Options}; - use nix::sys::termios; - use nix::sys::termios::Termios; - use parking_lot::lock_api::MutexGuard; - use parking_lot::{Mutex, RawMutex}; - use std::io::{BufRead, Write}; - use std::os::unix::io::{AsRawFd, RawFd}; + use std::{ + io::{BufRead, Write}, + os::unix::io::{AsRawFd, RawFd}, + }; + + use nix::sys::{termios, termios::Termios}; + use parking_lot::{lock_api::MutexGuard, Mutex, RawMutex}; + + use crate::{unix::TTY_PATH, Error, Mode, Options}; static TERM_STATE: Mutex> = Mutex::new(None); diff --git a/git-prompt/tests/options/mod.rs b/git-prompt/tests/options/mod.rs index e8ea7078292..eb47d75e7a7 100644 --- a/git-prompt/tests/options/mod.rs +++ b/git-prompt/tests/options/mod.rs @@ -1,9 +1,9 @@ mod apply_environment { + use std::{borrow::Cow, path::Path}; + use git_prompt::{Mode, Options}; use git_testtools::Env; use serial_test::serial; - use std::borrow::Cow; - use std::path::Path; #[test] #[serial] diff --git a/git-protocol/src/fetch/error.rs b/git-protocol/src/fetch/error.rs index bb7bce749af..00db99c7d26 100644 --- a/git-protocol/src/fetch/error.rs +++ b/git-protocol/src/fetch/error.rs @@ -2,8 +2,7 @@ use std::io; use git_transport::client; -use crate::fetch::handshake; -use crate::fetch::{refs, response}; +use crate::fetch::{handshake, refs, response}; /// The error used in [`fetch()`][crate::fetch()]. #[derive(Debug, thiserror::Error)] diff --git a/git-protocol/src/fetch/handshake.rs b/git-protocol/src/fetch/handshake.rs index a6b63a587af..292094cfa48 100644 --- a/git-protocol/src/fetch/handshake.rs +++ b/git-protocol/src/fetch/handshake.rs @@ -1,6 +1,7 @@ -use crate::fetch::Ref; use git_transport::client::Capabilities; +use crate::fetch::Ref; + /// The result of the [`handshake()`][super::handshake()] function. pub struct Outcome { /// The protocol version the server responded with. It might have downgraded the desired version. @@ -12,10 +13,10 @@ pub struct Outcome { } mod error { - use crate::credentials; - use crate::fetch::refs; use git_transport::client; + use crate::{credentials, fetch::refs}; + /// The error returned by [`handshake()`][crate::fetch::handshake()]. #[derive(Debug, thiserror::Error)] #[allow(missing_docs)] @@ -33,15 +34,13 @@ mod error { pub use error::Error; pub(crate) mod function { - use super::{Error, Outcome}; - use crate::credentials; - use crate::fetch::refs; - use git_features::progress; - use git_features::progress::Progress; - use git_transport::client::SetServiceResponse; - use git_transport::{client, Service}; + use git_features::{progress, progress::Progress}; + use git_transport::{client, client::SetServiceResponse, Service}; use maybe_async::maybe_async; + use super::{Error, Outcome}; + use crate::{credentials, fetch::refs}; + /// Perform a handshake with the server on the other side of `transport`, with `authenticate` being used if authentication /// turns out to be required. `extra_parameters` are the parameters `(name, optional value)` to add to the handshake, /// each time it is performed in case authentication is required. diff --git a/git-protocol/src/fetch/mod.rs b/git-protocol/src/fetch/mod.rs index effa154c6c1..080e05cb390 100644 --- a/git-protocol/src/fetch/mod.rs +++ b/git-protocol/src/fetch/mod.rs @@ -20,8 +20,7 @@ mod error; pub use error::Error; /// pub mod refs; -pub use refs::function::refs; -pub use refs::Ref; +pub use refs::{function::refs, Ref}; /// pub mod response; pub use response::Response; diff --git a/git-protocol/src/fetch/refs/blocking_io.rs b/git-protocol/src/fetch/refs/blocking_io.rs index af2130bdc0c..bc1e3250087 100644 --- a/git-protocol/src/fetch/refs/blocking_io.rs +++ b/git-protocol/src/fetch/refs/blocking_io.rs @@ -1,7 +1,6 @@ use std::io; -use crate::fetch::refs::parse::Error; -use crate::fetch::{refs, Ref}; +use crate::fetch::{refs, refs::parse::Error, Ref}; /// Parse refs from the given input line by line. Protocol V2 is required for this to succeed. pub fn from_v2_refs(in_refs: &mut dyn io::BufRead) -> Result, Error> { diff --git a/git-protocol/src/fetch/refs/function.rs b/git-protocol/src/fetch/refs/function.rs index 5e2d979f187..39f2d039294 100644 --- a/git-protocol/src/fetch/refs/function.rs +++ b/git-protocol/src/fetch/refs/function.rs @@ -1,12 +1,14 @@ -use super::Error; -use crate::fetch::refs::from_v2_refs; -use crate::fetch::{indicate_end_of_interaction, Command, LsRefsAction, Ref}; use bstr::BString; use git_features::progress::Progress; -use git_transport::client::{Capabilities, Transport, TransportV2Ext}; -use git_transport::Protocol; +use git_transport::{ + client::{Capabilities, Transport, TransportV2Ext}, + Protocol, +}; use maybe_async::maybe_async; +use super::Error; +use crate::fetch::{indicate_end_of_interaction, refs::from_v2_refs, Command, LsRefsAction, Ref}; + /// Invoke an ls-refs command on `transport` (assuming `protocol_version` 2 or panic), which requires a prior handshake that yielded /// server `capabilities`. `prepare_ls_refs(arguments, features)` can be used to alter the _ls-refs_. `progress` is used to provide feedback. #[maybe_async] diff --git a/git-protocol/src/fetch_fn.rs b/git-protocol/src/fetch_fn.rs index 91dfde1d18c..e19d78deca8 100644 --- a/git-protocol/src/fetch_fn.rs +++ b/git-protocol/src/fetch_fn.rs @@ -2,10 +2,9 @@ use git_features::progress::Progress; use git_transport::client; use maybe_async::maybe_async; -use crate::fetch::{handshake, indicate_end_of_interaction}; use crate::{ credentials, - fetch::{Action, Arguments, Command, Delegate, Error, Response}, + fetch::{handshake, indicate_end_of_interaction, Action, Arguments, Command, Delegate, Error, Response}, }; /// A way to indicate how to treat the connection underlying the transport, potentially allowing to reuse it. diff --git a/git-protocol/src/lib.rs b/git-protocol/src/lib.rs index 136c8cdf4a9..12c69e87471 100644 --- a/git-protocol/src/lib.rs +++ b/git-protocol/src/lib.rs @@ -14,11 +14,10 @@ pub use async_trait; #[cfg(feature = "futures-io")] pub use futures_io; -pub use maybe_async; - pub use git_credentials as credentials; /// A convenience export allowing users of git-protocol to use the transport layer without their own cargo dependency. pub use git_transport as transport; +pub use maybe_async; /// #[cfg(any(feature = "blocking-client", feature = "async-client"))] diff --git a/git-refspec/src/instruction.rs b/git-refspec/src/instruction.rs index b2caa699f86..cde4a09fc27 100644 --- a/git-refspec/src/instruction.rs +++ b/git-refspec/src/instruction.rs @@ -1,6 +1,7 @@ -use crate::{parse::Operation, Instruction}; use bstr::BStr; +use crate::{parse::Operation, Instruction}; + impl Instruction<'_> { /// Derive the mode of operation from this instruction. pub fn operation(&self) -> Operation { diff --git a/git-refspec/src/parse.rs b/git-refspec/src/parse.rs index 9c48178de41..02cb5dc10c7 100644 --- a/git-refspec/src/parse.rs +++ b/git-refspec/src/parse.rs @@ -36,10 +36,14 @@ pub enum Operation { } pub(crate) mod function { - use crate::parse::Error; - use crate::{parse::Operation, types::Mode, RefSpecRef}; use bstr::{BStr, ByteSlice}; + use crate::{ + parse::{Error, Operation}, + types::Mode, + RefSpecRef, + }; + /// Parse `spec` for use in `operation` and return it if it is valid. pub fn parse(mut spec: &BStr, operation: Operation) -> Result, Error> { fn fetch_head_only(mode: Mode) -> RefSpecRef<'static> { diff --git a/git-refspec/src/spec.rs b/git-refspec/src/spec.rs index f118b92a484..f99ead73250 100644 --- a/git-refspec/src/spec.rs +++ b/git-refspec/src/spec.rs @@ -1,5 +1,9 @@ -use crate::instruction::{Fetch, Push}; -use crate::{parse::Operation, types::Mode, Instruction, RefSpec, RefSpecRef}; +use crate::{ + instruction::{Fetch, Push}, + parse::Operation, + types::Mode, + Instruction, RefSpec, RefSpecRef, +}; /// Conversion. Use the [RefSpecRef][RefSpec::to_ref()] type for more usage options. impl RefSpec { @@ -15,9 +19,12 @@ impl RefSpec { } mod impls { + use std::{ + cmp::Ordering, + hash::{Hash, Hasher}, + }; + use crate::{RefSpec, RefSpecRef}; - use std::cmp::Ordering; - use std::hash::{Hash, Hasher}; impl From> for RefSpec { fn from(v: RefSpecRef<'_>) -> Self { diff --git a/git-refspec/tests/impls/mod.rs b/git-refspec/tests/impls/mod.rs index 97f200ae86b..db058635fa3 100644 --- a/git-refspec/tests/impls/mod.rs +++ b/git-refspec/tests/impls/mod.rs @@ -1,7 +1,9 @@ -use git_refspec::parse::Operation; -use git_refspec::RefSpec; -use std::collections::{BTreeSet, HashSet}; -use std::iter::FromIterator; +use std::{ + collections::{BTreeSet, HashSet}, + iter::FromIterator, +}; + +use git_refspec::{parse::Operation, RefSpec}; fn pair() -> Vec { let lhs = git_refspec::parse("refs/heads/foo".into(), Operation::Push).unwrap(); diff --git a/git-refspec/tests/parse/fetch.rs b/git-refspec/tests/parse/fetch.rs index b844fc2d403..b83d7d1ed30 100644 --- a/git-refspec/tests/parse/fetch.rs +++ b/git-refspec/tests/parse/fetch.rs @@ -1,5 +1,10 @@ +use git_refspec::{ + instruction::Fetch, + parse::{Error, Operation}, + Instruction, +}; + use crate::parse::{assert_parse, b, try_parse}; -use git_refspec::{instruction::Fetch, parse::Error, parse::Operation, Instruction}; #[test] fn revspecs_are_disallowed() { diff --git a/git-refspec/tests/parse/invalid.rs b/git-refspec/tests/parse/invalid.rs index b56aec4df6f..436d4a21f1c 100644 --- a/git-refspec/tests/parse/invalid.rs +++ b/git-refspec/tests/parse/invalid.rs @@ -1,5 +1,6 @@ +use git_refspec::parse::{Error, Operation}; + use crate::parse::try_parse; -use git_refspec::{parse::Error, parse::Operation}; #[test] fn empty() { diff --git a/git-refspec/tests/parse/mod.rs b/git-refspec/tests/parse/mod.rs index 597359f9b9e..d6c022f6d8e 100644 --- a/git-refspec/tests/parse/mod.rs +++ b/git-refspec/tests/parse/mod.rs @@ -1,7 +1,8 @@ +use std::panic::catch_unwind; + use bstr::ByteSlice; use git_refspec::parse::Operation; use git_testtools::scripted_fixture_repo_read_only; -use std::panic::catch_unwind; #[test] fn baseline() { diff --git a/git-refspec/tests/parse/push.rs b/git-refspec/tests/parse/push.rs index 93b414223ef..9d99121303a 100644 --- a/git-refspec/tests/parse/push.rs +++ b/git-refspec/tests/parse/push.rs @@ -1,5 +1,10 @@ +use git_refspec::{ + instruction::Push, + parse::{Error, Operation}, + Instruction, +}; + use crate::parse::{assert_parse, b, try_parse}; -use git_refspec::{instruction::Push, parse::Error, parse::Operation, Instruction}; #[test] fn negative_unsupported() { diff --git a/git-repository/src/config/cache/init.rs b/git-repository/src/config/cache/init.rs index a3e3c61d312..aa184cb3b79 100644 --- a/git-repository/src/config/cache/init.rs +++ b/git-repository/src/config/cache/init.rs @@ -1,8 +1,8 @@ -use super::{interpolate_context, util, Error, StageOne}; -use crate::config::Cache; -use crate::{repository, revision::spec::parse::ObjectKindHint}; use std::path::PathBuf; +use super::{interpolate_context, util, Error, StageOne}; +use crate::{config::Cache, repository, revision::spec::parse::ObjectKindHint}; + /// Initialization impl Cache { #[allow(clippy::too_many_arguments)] diff --git a/git-repository/src/config/cache/util.rs b/git-repository/src/config/cache/util.rs index 8f1b4f65637..a440cf8d58e 100644 --- a/git-repository/src/config/cache/util.rs +++ b/git-repository/src/config/cache/util.rs @@ -1,6 +1,7 @@ +use std::convert::TryFrom; + use super::Error; use crate::bstr::ByteSlice; -use std::convert::TryFrom; pub(crate) fn interpolate_context<'a>( git_install_dir: Option<&'a std::path::Path>, diff --git a/git-repository/src/config/snapshot/apply_cli_overrides.rs b/git-repository/src/config/snapshot/apply_cli_overrides.rs index a8debb1918f..7c775776e93 100644 --- a/git-repository/src/config/snapshot/apply_cli_overrides.rs +++ b/git-repository/src/config/snapshot/apply_cli_overrides.rs @@ -1,7 +1,10 @@ -use crate::bstr::{BStr, BString, ByteSlice}; -use crate::config::SnapshotMut; use std::convert::TryFrom; +use crate::{ + bstr::{BStr, BString, ByteSlice}, + config::SnapshotMut, +}; + /// The error returned by [SnapshotMut::apply_cli_overrides()][crate::config::SnapshotMut::apply_cli_overrides()]. #[derive(Debug, thiserror::Error)] #[allow(missing_docs)] diff --git a/git-repository/src/config/snapshot/credential_helpers.rs b/git-repository/src/config/snapshot/credential_helpers.rs index 78c206e644d..4429c7361f4 100644 --- a/git-repository/src/config/snapshot/credential_helpers.rs +++ b/git-repository/src/config/snapshot/credential_helpers.rs @@ -1,8 +1,11 @@ -use crate::bstr::{ByteSlice, ByteVec}; -use crate::config::Snapshot; +use std::{borrow::Cow, convert::TryFrom}; + pub use error::Error; -use std::borrow::Cow; -use std::convert::TryFrom; + +use crate::{ + bstr::{ByteSlice, ByteVec}, + config::Snapshot, +}; mod error { use crate::bstr::BString; diff --git a/git-repository/src/config/snapshot/mod.rs b/git-repository/src/config/snapshot/mod.rs index 97a11278f9a..6fc03e002e1 100644 --- a/git-repository/src/config/snapshot/mod.rs +++ b/git-repository/src/config/snapshot/mod.rs @@ -7,9 +7,12 @@ pub mod apply_cli_overrides; pub mod credential_helpers; mod _impls { + use std::{ + fmt::{Debug, Formatter}, + ops::{Deref, DerefMut}, + }; + use crate::config::{Snapshot, SnapshotMut}; - use std::fmt::{Debug, Formatter}; - use std::ops::{Deref, DerefMut}; impl Debug for Snapshot<'_> { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { diff --git a/git-repository/src/env.rs b/git-repository/src/env.rs index 868ccc83a27..f2b95f1f5d8 100644 --- a/git-repository/src/env.rs +++ b/git-repository/src/env.rs @@ -1,6 +1,7 @@ -use crate::bstr::{BString, ByteVec}; use std::ffi::{OsStr, OsString}; +use crate::bstr::{BString, ByteVec}; + /// Equivalent to `std::env::args_os()`, but with precomposed unicode on MacOS and other apple platforms. #[cfg(not(target_vendor = "apple"))] pub fn args_os() -> impl Iterator { @@ -28,9 +29,10 @@ pub fn os_str_to_bstring(input: &OsStr) -> Result { /// Environment information involving the `git` program itself. pub mod git { - use crate::bstr::{BStr, BString, ByteSlice}; use std::process::{Command, Stdio}; + use crate::bstr::{BStr, BString, ByteSlice}; + /// Returns the file that contains git configuration coming with the installation of the `git` file in the current `PATH`, or `None` /// if no `git` executable was found or there were other errors during execution. pub fn install_config_path() -> Option<&'static BStr> { diff --git a/git-repository/src/reference/edits.rs b/git-repository/src/reference/edits.rs index 8569f5c957e..3e39822af51 100644 --- a/git-repository/src/reference/edits.rs +++ b/git-repository/src/reference/edits.rs @@ -1,9 +1,8 @@ /// pub mod set_target_id { - use crate::bstr::BString; - use crate::Reference; - use git_ref::transaction::PreviousValue; - use git_ref::Target; + use git_ref::{transaction::PreviousValue, Target}; + + use crate::{bstr::BString, Reference}; mod error { use git_ref::FullName; @@ -52,9 +51,10 @@ pub mod set_target_id { /// pub mod delete { - use crate::Reference; use git_ref::transaction::{Change, PreviousValue, RefEdit, RefLog}; + use crate::Reference; + mod error { /// The error returned by [`Reference::delete()`][super::Reference::delete()]. #[derive(Debug, thiserror::Error)] diff --git a/git-repository/src/reference/remote.rs b/git-repository/src/reference/remote.rs index 79f8bc130a9..c6a4f6193d5 100644 --- a/git-repository/src/reference/remote.rs +++ b/git-repository/src/reference/remote.rs @@ -1,7 +1,10 @@ -use crate::bstr::{BStr, ByteSlice, ByteVec}; -use crate::{remote, Reference}; use std::borrow::Cow; +use crate::{ + bstr::{BStr, ByteSlice, ByteVec}, + remote, Reference, +}; + /// The name of a remote, either interpreted as symbol like `origin` or as url as returned by [`Reference::remote_name()`]. #[derive(Debug, PartialEq, Eq, Clone)] pub enum Name<'repo> { diff --git a/git-repository/src/remote/access.rs b/git-repository/src/remote/access.rs index 277f9c5f6b0..6d6e18aa45a 100644 --- a/git-repository/src/remote/access.rs +++ b/git-repository/src/remote/access.rs @@ -1,6 +1,7 @@ -use crate::{remote, Remote}; use git_refspec::RefSpec; +use crate::{remote, Remote}; + /// Access impl Remote<'_> { /// Return the name of this remote or `None` if it wasn't persisted to disk yet. diff --git a/git-repository/src/remote/build.rs b/git-repository/src/remote/build.rs index 08404cfaa52..6778c24158b 100644 --- a/git-repository/src/remote/build.rs +++ b/git-repository/src/remote/build.rs @@ -1,7 +1,7 @@ -use crate::bstr::BStr; -use crate::{remote, Remote}; use std::convert::TryInto; +use crate::{bstr::BStr, remote, Remote}; + /// Builder methods impl Remote<'_> { /// Set the `url` to be used when pushing data to a remote. diff --git a/git-repository/src/remote/connect.rs b/git-repository/src/remote/connect.rs index 6b0f1abff84..38aa61cb0b7 100644 --- a/git-repository/src/remote/connect.rs +++ b/git-repository/src/remote/connect.rs @@ -1,11 +1,10 @@ -use crate::remote::Connection; -use crate::{Progress, Remote}; use git_protocol::transport::client::Transport; +use crate::{remote::Connection, Progress, Remote}; + #[cfg(any(feature = "blocking-network-client", feature = "async-network-client-async-std"))] mod error { - use crate::bstr::BString; - use crate::remote; + use crate::{bstr::BString, remote}; /// The error returned by [connect()][crate::Remote::connect()]. #[derive(Debug, thiserror::Error)] diff --git a/git-repository/src/remote/connection/list_refs.rs b/git-repository/src/remote/connection/list_refs.rs index 5b8014d93a4..aa07edead5a 100644 --- a/git-repository/src/remote/connection/list_refs.rs +++ b/git-repository/src/remote/connection/list_refs.rs @@ -1,8 +1,8 @@ -use crate::remote::connection::HandshakeWithRefs; -use crate::remote::{Connection, Direction}; use git_features::progress::Progress; use git_protocol::transport::client::Transport; +use crate::remote::{connection::HandshakeWithRefs, Connection, Direction}; + mod error { #[derive(Debug, thiserror::Error)] pub enum Error { diff --git a/git-repository/src/remote/connection/mod.rs b/git-repository/src/remote/connection/mod.rs index f5e191ca6c9..53dc83ef558 100644 --- a/git-repository/src/remote/connection/mod.rs +++ b/git-repository/src/remote/connection/mod.rs @@ -20,9 +20,10 @@ pub struct Connection<'a, 'repo, T, P> { } mod access { - use crate::remote::connection::CredentialsFn; - use crate::remote::Connection; - use crate::Remote; + use crate::{ + remote::{connection::CredentialsFn, Connection}, + Remote, + }; /// Builder impl<'a, 'repo, T, P> Connection<'a, 'repo, T, P> { diff --git a/git-repository/src/remote/errors.rs b/git-repository/src/remote/errors.rs index f0a32553750..d6a29963fe5 100644 --- a/git-repository/src/remote/errors.rs +++ b/git-repository/src/remote/errors.rs @@ -1,7 +1,6 @@ /// pub mod find { - use crate::bstr::BString; - use crate::remote; + use crate::{bstr::BString, remote}; /// The error returned by [`Repository::find_remote(…)`][crate::Repository::find_remote()]. #[derive(Debug, thiserror::Error)] diff --git a/git-repository/src/remote/init.rs b/git-repository/src/remote/init.rs index 6ad08423382..85dbf43d89d 100644 --- a/git-repository/src/remote/init.rs +++ b/git-repository/src/remote/init.rs @@ -1,7 +1,9 @@ -use crate::{config, remote, Remote, Repository}; -use git_refspec::RefSpec; use std::convert::TryInto; +use git_refspec::RefSpec; + +use crate::{config, remote, Remote, Repository}; + mod error { use crate::bstr::BString; diff --git a/git-repository/src/remote/url/rewrite.rs b/git-repository/src/remote/url/rewrite.rs index bdc9988d097..8f2e9320c09 100644 --- a/git-repository/src/remote/url/rewrite.rs +++ b/git-repository/src/remote/url/rewrite.rs @@ -1,7 +1,10 @@ -use crate::bstr::{BStr, BString, ByteVec}; -use crate::remote::Direction; use git_features::threading::OwnShared; +use crate::{ + bstr::{BStr, BString, ByteVec}, + remote::Direction, +}; + #[derive(Debug, Clone)] struct Replace { find: BString, diff --git a/git-repository/src/remote/url/scheme_permission.rs b/git-repository/src/remote/url/scheme_permission.rs index 6f9d4c31c89..b3d09c3c0da 100644 --- a/git-repository/src/remote/url/scheme_permission.rs +++ b/git-repository/src/remote/url/scheme_permission.rs @@ -1,10 +1,11 @@ #![allow(dead_code, unused_variables)] -use crate::bstr::{BStr, BString, ByteSlice}; -use crate::permission; -use std::borrow::Cow; -use std::collections::BTreeMap; -use std::convert::TryFrom; +use std::{borrow::Cow, collections::BTreeMap, convert::TryFrom}; + +use crate::{ + bstr::{BStr, BString, ByteSlice}, + permission, +}; /// pub mod init { diff --git a/git-repository/src/repository/config.rs b/git-repository/src/repository/config.rs index 120fc16fdbf..5f963c114e6 100644 --- a/git-repository/src/repository/config.rs +++ b/git-repository/src/repository/config.rs @@ -1,7 +1,7 @@ -use crate::bstr::ByteSlice; -use crate::config; use std::collections::BTreeSet; +use crate::{bstr::ByteSlice, config}; + /// General Configuration impl crate::Repository { /// Return a snapshot of the configuration as seen upon opening the repository. @@ -27,10 +27,9 @@ impl crate::Repository { } mod remote { - use crate::bstr::ByteSlice; - use crate::remote; - use std::borrow::Cow; - use std::collections::BTreeSet; + use std::{borrow::Cow, collections::BTreeSet}; + + use crate::{bstr::ByteSlice, remote}; impl crate::Repository { /// Returns a sorted list unique of symbolic names of remotes that @@ -72,8 +71,7 @@ mod remote { } mod branch { - use std::collections::BTreeSet; - use std::{borrow::Cow, convert::TryInto}; + use std::{borrow::Cow, collections::BTreeSet, convert::TryInto}; use git_ref::FullNameRef; use git_validate::reference::name::Error as ValidateNameError; diff --git a/git-repository/src/repository/identity.rs b/git-repository/src/repository/identity.rs index b54a1996888..db2e3662099 100644 --- a/git-repository/src/repository/identity.rs +++ b/git-repository/src/repository/identity.rs @@ -1,5 +1,4 @@ -use std::borrow::Cow; -use std::time::SystemTime; +use std::{borrow::Cow, time::SystemTime}; use crate::{bstr::BString, permission}; diff --git a/git-repository/src/repository/remote.rs b/git-repository/src/repository/remote.rs index ef6af86f9b2..e9d53e1ca45 100644 --- a/git-repository/src/repository/remote.rs +++ b/git-repository/src/repository/remote.rs @@ -1,7 +1,7 @@ -use crate::remote::find; -use crate::{remote, Remote}; use std::convert::TryInto; +use crate::{remote, remote::find, Remote}; + impl crate::Repository { /// Create a new remote available at the given `url`. pub fn remote_at(&self, url: Url) -> Result, remote::init::Error> diff --git a/git-repository/tests/head/mod.rs b/git-repository/tests/head/mod.rs index 8bd1534d86d..5940a9c4871 100644 --- a/git-repository/tests/head/mod.rs +++ b/git-repository/tests/head/mod.rs @@ -1,7 +1,8 @@ mod remote { - use crate::remote; use git_repository as git; + use crate::remote; + #[test] fn unborn_is_none() -> crate::Result { let repo = remote::repo("url-rewriting"); diff --git a/git-repository/tests/reference/remote.rs b/git-repository/tests/reference/remote.rs index a6f473723d4..aa0511c4699 100644 --- a/git-repository/tests/reference/remote.rs +++ b/git-repository/tests/reference/remote.rs @@ -1,6 +1,7 @@ -use crate::remote; use git_repository as git; +use crate::remote; + #[test] fn push_defaults_to_fetch() -> crate::Result { let repo = remote::repo("many-fetchspecs"); diff --git a/git-repository/tests/remote/connect.rs b/git-repository/tests/remote/connect.rs index dc4e5d6591e..791ce976bd5 100644 --- a/git-repository/tests/remote/connect.rs +++ b/git-repository/tests/remote/connect.rs @@ -1,12 +1,13 @@ #[cfg(feature = "blocking-network-client")] mod blocking_io { mod protocol_allow { - use crate::remote; use git_features::progress; use git_repository as git; use git_repository::remote::Direction::Fetch; use serial_test::serial; + use crate::remote; + #[test] fn deny() { for name in ["protocol_denied", "protocol_file_denied"] { diff --git a/git-repository/tests/remote/list_refs.rs b/git-repository/tests/remote/list_refs.rs index 9cabdc7c990..01b85ca2fce 100644 --- a/git-repository/tests/remote/list_refs.rs +++ b/git-repository/tests/remote/list_refs.rs @@ -1,10 +1,11 @@ #[cfg(feature = "blocking-network-client")] mod blocking_io { - use crate::remote; use git_features::progress; use git_repository as git; use git_repository::remote::Direction::Fetch; + use crate::remote; + #[test] fn all() -> crate::Result { for version in [ diff --git a/git-repository/tests/remote/mod.rs b/git-repository/tests/remote/mod.rs index 8837b5d62b6..c418f7ed926 100644 --- a/git-repository/tests/remote/mod.rs +++ b/git-repository/tests/remote/mod.rs @@ -1,7 +1,7 @@ +use std::{borrow::Cow, path::PathBuf}; + use git_repository as git; use git_testtools::scripted_fixture_repo_read_only; -use std::borrow::Cow; -use std::path::PathBuf; pub(crate) fn repo_path(name: &str) -> PathBuf { let dir = scripted_fixture_repo_read_only("make_remote_repos.sh").unwrap(); diff --git a/git-repository/tests/repository/config/config_snapshot/credential_helpers.rs b/git-repository/tests/repository/config/config_snapshot/credential_helpers.rs index 74aeec615b1..f6fdc5623eb 100644 --- a/git-repository/tests/repository/config/config_snapshot/credential_helpers.rs +++ b/git-repository/tests/repository/config/config_snapshot/credential_helpers.rs @@ -1,10 +1,12 @@ use git_testtools::Env; mod baseline { - use crate::remote; + use std::collections::HashMap; + use git_object::bstr::BString; use git_testtools::once_cell::sync::Lazy; - use std::collections::HashMap; + + use crate::remote; #[derive(Debug, Eq, PartialEq)] struct Helpers { diff --git a/git-repository/tests/repository/config/identity.rs b/git-repository/tests/repository/config/identity.rs index d95c2027313..43a601878d4 100644 --- a/git-repository/tests/repository/config/identity.rs +++ b/git-repository/tests/repository/config/identity.rs @@ -1,9 +1,11 @@ -use crate::named_repo; +use std::path::Path; + use git_repository as git; use git_sec::{Access, Permission}; use git_testtools::Env; use serial_test::serial; -use std::path::Path; + +use crate::named_repo; #[test] #[serial] diff --git a/git-repository/tests/repository/config/remote.rs b/git-repository/tests/repository/config/remote.rs index f6632969c26..8462a2bbf2a 100644 --- a/git-repository/tests/repository/config/remote.rs +++ b/git-repository/tests/repository/config/remote.rs @@ -1,10 +1,8 @@ -use crate::Result; use std::iter::FromIterator; use git_repository as git; -use crate::remote::cow_str; -use crate::{named_repo, remote}; +use crate::{named_repo, remote, remote::cow_str, Result}; #[test] fn remote_and_branch_names() { diff --git a/git-repository/tests/repository/object.rs b/git-repository/tests/repository/object.rs index c11590f13ad..5b08cbbd0ec 100644 --- a/git-repository/tests/repository/object.rs +++ b/git-repository/tests/repository/object.rs @@ -17,10 +17,12 @@ mod write_object { } mod write_blob { - use crate::repository::object::empty_bare_repo; - use git_testtools::hex_to_id; use std::io::{Seek, SeekFrom}; + use git_testtools::hex_to_id; + + use crate::repository::object::empty_bare_repo; + #[test] fn from_slice() -> crate::Result { let (_tmp, repo) = empty_bare_repo()?; @@ -55,10 +57,11 @@ mod write_blob { } mod find { - use crate::basic_repo; use git_pack::Find; use git_repository as git; + use crate::basic_repo; + #[test] fn find_and_try_find_with_and_without_object_cache() -> crate::Result { let mut repo = basic_repo()?; diff --git a/git-repository/tests/repository/open.rs b/git-repository/tests/repository/open.rs index c6e0244f993..2c74188c52a 100644 --- a/git-repository/tests/repository/open.rs +++ b/git-repository/tests/repository/open.rs @@ -1,7 +1,8 @@ mod submodules { - use git_repository as git; use std::path::Path; + use git_repository as git; + #[test] fn by_their_worktree_checkout_and_git_modules_dir() { let dir = git_testtools::scripted_fixture_repo_read_only("make_submodules.sh").unwrap(); diff --git a/git-repository/tests/repository/remote.rs b/git-repository/tests/repository/remote.rs index a0c8a8bb8c0..d144b6b5fd2 100644 --- a/git-repository/tests/repository/remote.rs +++ b/git-repository/tests/repository/remote.rs @@ -1,7 +1,8 @@ mod remote_at { - use crate::remote; use git_repository::remote::Direction; + use crate::remote; + #[test] fn url_and_push_url() -> crate::Result { let repo = remote::repo("base"); @@ -100,12 +101,13 @@ mod remote_at { } mod find_remote { - use crate::remote; + use std::io::BufRead; + use git_object::bstr::BString; use git_repository as git; - use git_repository::remote::Direction; - use git_repository::Repository; - use std::io::BufRead; + use git_repository::{remote::Direction, Repository}; + + use crate::remote; #[test] fn typical() { diff --git a/git-repository/tests/repository/worktree.rs b/git-repository/tests/repository/worktree.rs index 8f60123d27a..d9e07ac1118 100644 --- a/git-repository/tests/repository/worktree.rs +++ b/git-repository/tests/repository/worktree.rs @@ -2,10 +2,12 @@ use git_ref::bstr; use git_repository as git; mod with_core_worktree_config { - use crate::repository::worktree::Baseline; - use git_repository as git; use std::io::BufRead; + use git_repository as git; + + use crate::repository::worktree::Baseline; + #[test] fn relative() -> crate::Result { for (name, is_relative) in [("absolute-worktree", false), ("relative-worktree", true)] { diff --git a/git-revision/src/spec/parse/function.rs b/git-revision/src/spec/parse/function.rs index d7b9e254aa2..379a7ff097a 100644 --- a/git-revision/src/spec/parse/function.rs +++ b/git-revision/src/spec/parse/function.rs @@ -1,5 +1,4 @@ -use std::time::SystemTime; -use std::{convert::TryInto, str::FromStr}; +use std::{convert::TryInto, str::FromStr, time::SystemTime}; use bstr::{BStr, BString, ByteSlice, ByteVec}; diff --git a/git-transport/src/client/async_io/connect.rs b/git-transport/src/client/async_io/connect.rs index 2ebf347f6f5..40f94af7f79 100644 --- a/git-transport/src/client/async_io/connect.rs +++ b/git-transport/src/client/async_io/connect.rs @@ -2,10 +2,10 @@ pub use crate::client::non_io_types::connect::Error; #[cfg(any(feature = "async-std"))] pub(crate) mod function { - use crate::client::git; - use crate::client::non_io_types::connect::Error; use std::convert::TryInto; + use crate::client::{git, non_io_types::connect::Error}; + /// A general purpose connector connecting to a repository identified by the given `url`. /// /// This includes connections to diff --git a/git-transport/src/client/blocking_io/connect.rs b/git-transport/src/client/blocking_io/connect.rs index 0d135ccdd83..dc4704da7a4 100644 --- a/git-transport/src/client/blocking_io/connect.rs +++ b/git-transport/src/client/blocking_io/connect.rs @@ -1,10 +1,10 @@ pub use crate::client::non_io_types::connect::Error; pub(crate) mod function { - use crate::client::non_io_types::connect::Error; - use crate::client::Transport; use std::convert::TryInto; + use crate::client::{non_io_types::connect::Error, Transport}; + /// A general purpose connector connecting to a repository identified by the given `url`. /// /// This includes connections to diff --git a/git-transport/src/client/git/async_io.rs b/git-transport/src/client/git/async_io.rs index 717ec39aefc..5df5a648f70 100644 --- a/git-transport/src/client/git/async_io.rs +++ b/git-transport/src/client/git/async_io.rs @@ -122,11 +122,12 @@ where #[cfg(feature = "async-std")] mod async_net { - use crate::client::git; - use crate::client::Error; - use async_std::net::TcpStream; use std::time::Duration; + use async_std::net::TcpStream; + + use crate::client::{git, Error}; + impl git::Connection { /// Create a new TCP connection using the `git` protocol of `desired_version`, and make a connection to `host` /// at `port` for accessing the repository at `path` on the server side. diff --git a/git-transport/src/lib.rs b/git-transport/src/lib.rs index 5488ef66132..fa61f882de5 100644 --- a/git-transport/src/lib.rs +++ b/git-transport/src/lib.rs @@ -13,10 +13,9 @@ #[cfg(feature = "async-trait")] pub use async_trait; +pub use bstr; #[cfg(feature = "futures-io")] pub use futures_io; - -pub use bstr; pub use git_packetline as packetline; /// The version of the way client and server communicate. diff --git a/git-url/src/impls.rs b/git-url/src/impls.rs index f065ffbbb59..15881520515 100644 --- a/git-url/src/impls.rs +++ b/git-url/src/impls.rs @@ -1,7 +1,8 @@ -use crate::{parse, Scheme, Url}; +use std::{convert::TryFrom, path::PathBuf}; + use bstr::BStr; -use std::convert::TryFrom; -use std::path::PathBuf; + +use crate::{parse, Scheme, Url}; impl Default for Url { fn default() -> Self { diff --git a/git-url/src/parse.rs b/git-url/src/parse.rs index 264a98b0ccc..2a2f3951cb6 100644 --- a/git-url/src/parse.rs +++ b/git-url/src/parse.rs @@ -1,10 +1,12 @@ -use std::borrow::Cow; -use std::convert::{Infallible, TryFrom}; +use std::{ + borrow::Cow, + convert::{Infallible, TryFrom}, +}; +pub use bstr; use bstr::{BStr, ByteSlice}; use crate::Scheme; -pub use bstr; /// The Error returned by [`parse()`] #[derive(Debug, thiserror::Error)] diff --git a/gitoxide-core/src/repository/credential.rs b/gitoxide-core/src/repository/credential.rs index 95965445c9b..fdbb91a434e 100644 --- a/gitoxide-core/src/repository/credential.rs +++ b/gitoxide-core/src/repository/credential.rs @@ -1,6 +1,7 @@ -use git_repository as git; use std::convert::TryInto; +use git_repository as git; + #[derive(Debug, thiserror::Error)] enum Error { #[error(transparent)] diff --git a/gitoxide-core/src/repository/remote.rs b/gitoxide-core/src/repository/remote.rs index 0270ca624df..5b7ed841376 100644 --- a/gitoxide-core/src/repository/remote.rs +++ b/gitoxide-core/src/repository/remote.rs @@ -1,10 +1,11 @@ #[cfg(any(feature = "blocking-client", feature = "async-client"))] mod net { - use crate::OutputFormat; use anyhow::bail; use git_repository as git; use git_repository::protocol::fetch; + use crate::OutputFormat; + pub mod refs { use crate::OutputFormat; diff --git a/gitoxide-core/src/repository/revision/list.rs b/gitoxide-core/src/repository/revision/list.rs index 964c8c22da8..e80b15cb5a3 100644 --- a/gitoxide-core/src/repository/revision/list.rs +++ b/gitoxide-core/src/repository/revision/list.rs @@ -1,7 +1,8 @@ +use std::ffi::OsString; + use anyhow::{bail, Context}; use git_repository as git; use git_repository::prelude::ObjectIdExt; -use std::ffi::OsString; use crate::OutputFormat; diff --git a/gitoxide-core/src/repository/revision/resolve.rs b/gitoxide-core/src/repository/revision/resolve.rs index e20097f7e79..75e785934fc 100644 --- a/gitoxide-core/src/repository/revision/resolve.rs +++ b/gitoxide-core/src/repository/revision/resolve.rs @@ -7,14 +7,13 @@ pub struct Options { } pub(crate) mod function { - use anyhow::Context; use std::ffi::OsString; + use anyhow::Context; use git_repository as git; use super::Options; - use crate::repository::revision; - use crate::OutputFormat; + use crate::{repository::revision, OutputFormat}; pub fn resolve( mut repo: git::Repository, diff --git a/src/plumbing/main.rs b/src/plumbing/main.rs index 6e74a979837..baf5b6b9201 100644 --- a/src/plumbing/main.rs +++ b/src/plumbing/main.rs @@ -13,9 +13,10 @@ use git_repository::bstr::io::BufReadExt; use gitoxide_core as core; use gitoxide_core::pack::verify; -use crate::plumbing::options::remote; use crate::{ - plumbing::options::{commit, config, credential, exclude, free, mailmap, odb, revision, tree, Args, Subcommands}, + plumbing::options::{ + commit, config, credential, exclude, free, mailmap, odb, remote, revision, tree, Args, Subcommands, + }, shared::pretty::prepare_and_run, }; diff --git a/src/plumbing/options.rs b/src/plumbing/options.rs index 6a7fcc4d683..467cb4ec024 100644 --- a/src/plumbing/options.rs +++ b/src/plumbing/options.rs @@ -1,7 +1,7 @@ -use git_repository as git; -use git_repository::bstr::BString; use std::path::PathBuf; +use git_repository as git; +use git_repository::bstr::BString; use gitoxide_core as core; #[derive(Debug, clap::Parser)] diff --git a/tests/tools/src/lib.rs b/tests/tools/src/lib.rs index 9947bf76e71..5bdc474bbf9 100644 --- a/tests/tools/src/lib.rs +++ b/tests/tools/src/lib.rs @@ -1,13 +1,13 @@ //! Utilities for testing `gitoxide` crates, many of which might be useful for testing programs that use `git` in general. #![deny(missing_docs)] -use std::str::FromStr; use std::{ collections::BTreeMap, convert::Infallible, ffi::OsString, io::Read, path::{Path, PathBuf}, + str::FromStr, time::Duration, };