Skip to content

Commit

Permalink
make fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Nov 2, 2022
1 parent def53b3 commit ea2136b
Show file tree
Hide file tree
Showing 29 changed files with 113 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ use std::{
use bstr::{BString, ByteSlice};
use git_config::file::init::{self};

use crate::file::init::from_paths::includes::conditional::git_init;
use crate::file::{
cow_str,
init::from_paths::{escape_backslashes, includes::conditional::options_with_git_dir},
init::from_paths::{
escape_backslashes,
includes::conditional::{git_init, options_with_git_dir},
},
};

#[derive(Debug)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ use git_ref::{
use git_repository as git;
use tempfile::tempdir;

use crate::file::cow_str;
use crate::file::init::from_paths::includes::conditional::git_init;
use crate::file::{cow_str, init::from_paths::includes::conditional::git_init};

type Result = crate::Result;

Expand Down
3 changes: 2 additions & 1 deletion git-config/tests/file/mutable/section.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,10 @@ mod set {
mod push {
use std::convert::{TryFrom, TryInto};

use crate::file::cow_str;
use git_config::parse::section::Key;

use crate::file::cow_str;

#[test]
fn none_as_value_omits_the_key_value_separator() -> crate::Result {
let mut file = git_config::File::default();
Expand Down
12 changes: 7 additions & 5 deletions git-index/src/init.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
mod from_tree {
use crate::{
entry::{Flags, Mode, Stat},
Entry, PathStorage, State, Version,
};
use std::collections::VecDeque;

use bstr::{BStr, BString, ByteSlice, ByteVec};
use git_object::{
tree::{self, EntryMode},
TreeRefIter,
};
use git_traverse::tree::{breadthfirst, visit::Action, Visit};
use std::collections::VecDeque;

use crate::{
entry::{Flags, Mode, Stat},
Entry, PathStorage, State, Version,
};

/// Initialization
impl State {
Expand Down
3 changes: 2 additions & 1 deletion git-index/tests/index/file/init.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
mod from_state {
use crate::index::Fixture::*;
use git_index::Version::{V2, V3};

use crate::index::Fixture::*;

#[test]
fn writes_data_to_disk_and_is_a_valid_index() -> git_testtools::Result {
let fixtures = [
Expand Down
3 changes: 2 additions & 1 deletion git-index/tests/index/file/read.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use std::path::{Path, PathBuf};

use crate::loose_file_path;
use bstr::ByteSlice;
use git_index::{entry, Version};
use git_testtools::hex_to_id;

use crate::loose_file_path;

fn verify(index: git_index::File) -> git_index::File {
index.verify_integrity().unwrap();
index.verify_entries().unwrap();
Expand Down
3 changes: 1 addition & 2 deletions git-index/tests/index/file/write.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use crate::index::Fixture::*;
use filetime::FileTime;
use git_index::{entry, extension, verify::extensions::no_find, write, write::Options, State, Version};

use crate::{fixture_index_path, loose_file_path};
use crate::{fixture_index_path, index::Fixture::*, 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]
Expand Down
11 changes: 5 additions & 6 deletions git-repository/src/clone/checkout.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
use crate::clone::PrepareCheckout;
use crate::Repository;
use crate::{clone::PrepareCheckout, Repository};

///
pub mod main_worktree {
use crate::clone::PrepareCheckout;
use crate::{Progress, Repository};
use std::{path::PathBuf, sync::atomic::AtomicBool};

use git_odb::FindExt;
use std::path::PathBuf;
use std::sync::atomic::AtomicBool;

use crate::{clone::PrepareCheckout, Progress, Repository};

/// The error returned by [`PrepareCheckout::main_worktree()`].
#[derive(Debug, thiserror::Error)]
Expand Down
3 changes: 1 addition & 2 deletions git-repository/src/clone/fetch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ impl PrepareFetch {
P: crate::Progress,
P::SubProgress: 'static,
{
use crate::bstr::ByteVec;
use crate::remote::fetch::RefLogMessage;
use crate::{bstr::ByteVec, remote::fetch::RefLogMessage};

let repo = self
.repo
Expand Down
25 changes: 16 additions & 9 deletions git-repository/src/clone/fetch/util.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
use super::Error;
use crate::bstr::{BStr, ByteSlice};
use crate::Repository;
use std::{borrow::Cow, convert::TryInto};

use git_odb::Find;
use git_ref::transaction::{LogChange, RefLog};
use git_ref::FullNameRef;
use std::borrow::Cow;
use std::convert::TryInto;
use git_ref::{
transaction::{LogChange, RefLog},
FullNameRef,
};

use super::Error;
use crate::{
bstr::{BStr, ByteSlice},
Repository,
};

pub fn write_remote_to_local_config_file(
remote: &mut crate::Remote<'_>,
Expand Down Expand Up @@ -47,8 +52,10 @@ pub fn update_head(
reflog_message: &BStr,
remote_name: &str,
) -> Result<(), Error> {
use git_ref::transaction::{PreviousValue, RefEdit};
use git_ref::Target;
use git_ref::{
transaction::{PreviousValue, RefEdit},
Target,
};
let (head_peeled_id, head_ref) = match remote_refs.iter().find_map(|r| {
Some(match r {
git_protocol::fetch::Ref::Symbolic {
Expand Down
11 changes: 6 additions & 5 deletions git-repository/src/config/cache/access.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use std::borrow::Cow;
use std::{convert::TryInto, path::PathBuf, time::Duration};
use std::{borrow::Cow, convert::TryInto, path::PathBuf, time::Duration};

use git_lock::acquire::Fail;

use crate::config::cache::util::check_lenient_default;
use crate::config::checkout_options;
use crate::{config::Cache, remote, repository::identity};
use crate::{
config::{cache::util::check_lenient_default, checkout_options, Cache},
remote,
repository::identity,
};

/// Access
impl Cache {
Expand Down
3 changes: 1 addition & 2 deletions git-repository/src/config/cache/init.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use super::{interpolate_context, util, Error, StageOne};
use crate::bstr::BString;
use crate::{config::Cache, repository};
use crate::{bstr::BString, config::Cache, repository};

/// Initialization
impl Cache {
Expand Down
3 changes: 2 additions & 1 deletion git-repository/src/config/overrides.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::bstr::{BStr, BString, ByteSlice};
use std::convert::TryFrom;

use crate::bstr::{BStr, BString, ByteSlice};

/// The error returned by [SnapshotMut::apply_cli_overrides()][crate::config::SnapshotMut::apply_cli_overrides()].
#[derive(Debug, thiserror::Error)]
#[allow(missing_docs)]
Expand Down
16 changes: 8 additions & 8 deletions git-repository/src/init.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use crate::bstr::BString;
use git_ref::store::WriteReflog;
use git_ref::transaction::{PreviousValue, RefEdit};
use git_ref::{FullName, Target};
use std::borrow::Cow;
use std::convert::TryInto;
use std::path::Path;
use std::{borrow::Cow, convert::TryInto, path::Path};

use crate::ThreadSafeRepository;
use git_ref::{
store::WriteReflog,
transaction::{PreviousValue, RefEdit},
FullName, Target,
};

use crate::{bstr::BString, ThreadSafeRepository};

/// The name of the branch to use if non is configured via git configuration.
///
Expand Down
14 changes: 9 additions & 5 deletions git-repository/src/object/tree/diff/for_each.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
use super::{change, Action, Change, Platform, Tracking};
use crate::bstr::{BStr, BString, ByteSlice, ByteVec};
use crate::ext::ObjectIdExt;
use crate::{Repository, Tree};
use std::collections::VecDeque;

use git_object::TreeRefIter;
use git_odb::FindExt;
use std::collections::VecDeque;

use super::{change, Action, Change, Platform, Tracking};
use crate::{
bstr::{BStr, BString, ByteSlice, ByteVec},
ext::ObjectIdExt,
Repository, Tree,
};

/// The error return by methods on the [diff platform][Platform].
#[derive(Debug, thiserror::Error)]
Expand Down
4 changes: 1 addition & 3 deletions git-repository/src/object/tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ pub struct Entry<'repo> {
}

mod entry {
use crate::bstr::BStr;
use crate::ext::ObjectIdExt;
use crate::object::tree::Entry;
use crate::{bstr::BStr, ext::ObjectIdExt, object::tree::Entry};

/// Access
impl<'repo> Entry<'repo> {
Expand Down
6 changes: 4 additions & 2 deletions git-repository/src/open.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ use std::path::PathBuf;

use git_features::threading::OwnShared;

use crate::bstr::BString;
use crate::{config, config::cache::interpolate_context, permission, Permissions, Repository, ThreadSafeRepository};
use crate::{
bstr::BString, config, config::cache::interpolate_context, permission, Permissions, Repository,
ThreadSafeRepository,
};

/// A way to configure the usage of replacement objects, see `git replace`.
#[derive(Debug, Clone)]
Expand Down
3 changes: 1 addition & 2 deletions git-repository/src/reference/remote/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::borrow::Cow;
use std::convert::TryInto;
use std::{borrow::Cow, convert::TryInto};

use crate::{
bstr::{BStr, ByteSlice},
Expand Down
4 changes: 2 additions & 2 deletions git-repository/src/reference/remote/name.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{borrow::Cow, convert::TryFrom};

use super::Name;
use crate::bstr::{BStr, ByteSlice, ByteVec};
use std::borrow::Cow;
use std::convert::TryFrom;

impl Name<'_> {
/// Obtain the name as string representation.
Expand Down
2 changes: 1 addition & 1 deletion git-repository/src/remote/connection/fetch/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::bstr::BString;
use git_protocol::transport::client::Transport;

use crate::{
bstr::BString,
remote,
remote::{
fetch::{DryRun, RefMap},
Expand Down
13 changes: 7 additions & 6 deletions git-repository/src/remote/connection/fetch/receive_pack.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
use crate::remote::connection::fetch::config;
use crate::remote::fetch::{negotiate, refs, Prepare, RefLogMessage};
use std::sync::atomic::AtomicBool;

use git_odb::FindExt;
use git_protocol::transport::client::Transport;

use crate::{
remote,
remote::{
connection::fetch::config,
fetch,
fetch::{Error, Outcome, Status},
fetch::{negotiate, refs, Error, Outcome, Prepare, RefLogMessage, Status},
},
Progress,
};
use git_odb::FindExt;
use git_protocol::transport::client::Transport;
use std::sync::atomic::AtomicBool;

impl<'remote, 'repo, T, P> Prepare<'remote, 'repo, T, P>
where
Expand Down
6 changes: 4 additions & 2 deletions git-repository/src/remote/connection/fetch/update_refs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ use git_ref::{
Target, TargetRef,
};

use crate::remote::fetch::{RefLogMessage, Source};
use crate::{
ext::ObjectIdExt,
remote::{fetch, fetch::refs::update::Mode},
remote::{
fetch,
fetch::{refs::update::Mode, RefLogMessage, Source},
},
Repository,
};

Expand Down
13 changes: 9 additions & 4 deletions git-repository/src/remote/connection/fetch/update_refs/tests.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
mod update {
use git_testtools::{hex_to_id, Result};
use std::convert::TryInto;

use git_testtools::{hex_to_id, Result};

use crate as git;

fn base_repo_path() -> String {
Expand Down Expand Up @@ -30,11 +31,15 @@ mod update {
let repo = git::open_opts(dir.path().join(name), git::open::Options::isolated()).unwrap();
(repo, dir)
}
use crate::bstr::BString;
use git_ref::{transaction::Change, TargetRef};

use crate::remote::fetch;
use crate::remote::fetch::{Mapping, RefLogMessage, Source};
use crate::{
bstr::BString,
remote::{
fetch,
fetch::{Mapping, RefLogMessage, Source},
},
};

#[test]
fn various_valid_updates() {
Expand Down
9 changes: 7 additions & 2 deletions git-transport/src/client/blocking_io/http/reqwest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ pub struct Remote {
}

mod remote {
use std::sync::{Arc, Mutex};
use std::{any::Any, convert::TryFrom, io::Write, str::FromStr};
use std::{
any::Any,
convert::TryFrom,
io::Write,
str::FromStr,
sync::{Arc, Mutex},
};

use git_features::io::pipe;

Expand Down
3 changes: 2 additions & 1 deletion gitoxide-core/src/index/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use git_repository as git;
use std::path::Path;

use git_repository as git;

pub struct Options {
pub object_hash: git::hash::Kind,
pub format: crate::OutputFormat,
Expand Down
10 changes: 4 additions & 6 deletions gitoxide-core/src/repository/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,14 @@ pub struct Options {
pub const PROGRESS_RANGE: std::ops::RangeInclusive<u8> = 1..=3;

pub(crate) mod function {
use std::ffi::OsStr;

use anyhow::bail;
use git_repository as git;
use git_repository::bstr::BString;
use git_repository::remote::fetch::Status;
use git_repository::Progress;
use std::ffi::OsStr;
use git_repository::{bstr::BString, remote::fetch::Status, Progress};

use super::Options;
use crate::repository::fetch::function::print_updates;
use crate::OutputFormat;
use crate::{repository::fetch::function::print_updates, OutputFormat};

pub fn clone<P>(
remote: impl AsRef<OsStr>,
Expand Down

0 comments on commit ea2136b

Please sign in to comment.