Skip to content

Commit

Permalink
make fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Feb 5, 2023
1 parent 7bba270 commit e22080e
Show file tree
Hide file tree
Showing 84 changed files with 433 additions and 305 deletions.
3 changes: 1 addition & 2 deletions git-discover/src/upwards/types.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::ffi::OsStr;
use std::{env, path::PathBuf};
use std::{env, ffi::OsStr, path::PathBuf};

/// The error returned by [git_discover::upwards()][crate::upwards()].
#[derive(Debug, thiserror::Error)]
Expand Down
3 changes: 1 addition & 2 deletions git-features/src/progress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ use std::io;

pub use prodash::{
messages::MessageLevel,
progress::Id,
progress::{Discard, DoOrDiscard, Either, Step, StepShared, ThroughputOnDrop, UNKNOWN},
progress::{Discard, DoOrDiscard, Either, Id, Step, StepShared, ThroughputOnDrop, UNKNOWN},
unit, Progress, Unit,
};

Expand Down
3 changes: 2 additions & 1 deletion git-index/src/access/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use bstr::{BStr, ByteSlice, ByteVec};
use std::cmp::Ordering;

use bstr::{BStr, ByteSlice, ByteVec};

use crate::{entry, extension, Entry, PathStorage, State, Version};

// TODO: integrate this somehow, somewhere, depending on later usage.
Expand Down
7 changes: 2 additions & 5 deletions git-index/src/entry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,11 @@ mod access {
}

mod _impls {
use std::cmp::Ordering;
use std::ops::Add;
use std::time::SystemTime;
use std::{cmp::Ordering, ops::Add, time::SystemTime};

use bstr::BStr;

use crate::entry::Time;
use crate::{Entry, State};
use crate::{entry::Time, Entry, State};

impl From<SystemTime> for Time {
fn from(s: SystemTime) -> Self {
Expand Down
6 changes: 4 additions & 2 deletions git-index/src/file/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ mod impls {
}

mod impl_ {
use crate::{File, State};
use std::fmt::Formatter;

use crate::{File, State};

impl std::fmt::Debug for File {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
f.debug_struct("File")
Expand Down Expand Up @@ -66,9 +67,10 @@ mod access {
}

mod mutation {
use crate::File;
use std::path::PathBuf;

use crate::File;

/// Mutating access
impl File {
/// Set the path at which we think we are located to the given `path`.
Expand Down
4 changes: 2 additions & 2 deletions git-index/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use std::{ops::Range, path::PathBuf};

use filetime::FileTime;

pub use git_hash as hash;

///
Expand Down Expand Up @@ -110,9 +109,10 @@ pub struct State {
}

mod impls {
use crate::State;
use std::fmt::{Debug, Formatter};

use crate::State;

impl Debug for State {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
for entry in &self.entries {
Expand Down
3 changes: 2 additions & 1 deletion git-index/tests/index/entry.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
mod time {
use git_index::entry;
use std::time::SystemTime;

use git_index::entry;

#[test]
fn conversion_roundtrip() {
for sample in [entry::Time::default(), entry::Time { secs: 42, nsecs: 150 }] {
Expand Down
3 changes: 1 addition & 2 deletions git-index/tests/index/file/read.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
use std::path::{Path, PathBuf};

use crate::hex_to_id;
use bstr::ByteSlice;
use git_index::{
entry::{self, Flags, Mode},
Version,
};

use crate::loose_file_path;
use crate::{hex_to_id, loose_file_path};

fn verify(index: git_index::File) -> git_index::File {
index.verify_integrity().unwrap();
Expand Down
3 changes: 2 additions & 1 deletion git-index/tests/index/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use git_hash::ObjectId;
use std::path::{Path, PathBuf};

use git_hash::ObjectId;

mod access;
mod entry;
mod file;
Expand Down
3 changes: 1 addition & 2 deletions git-odb/src/store_impls/dynamic/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ use crate::{

///
pub mod integrity {
use std::marker::PhantomData;
use std::path::PathBuf;
use std::{marker::PhantomData, path::PathBuf};

use crate::pack;

Expand Down
3 changes: 1 addition & 2 deletions git-odb/tests/odb/store/dynamic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use git_hash::ObjectId;
use git_odb::{store, store::iter::Ordering, Find, FindExt, Header, Write};
use git_testtools::fixture_path;

use crate::hex_to_id;
use crate::odb::db;
use crate::{hex_to_id, odb::db};

fn all_orderings() -> [Ordering; 2] {
[
Expand Down
6 changes: 2 additions & 4 deletions git-odb/tests/odb/store/loose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ mod lookup_prefix {
use git_testtools::fixture_path;
use maplit::hashset;

use crate::odb::hex_to_id;
use crate::store::loose::ldb;
use crate::{odb::hex_to_id, store::loose::ldb};

#[test]
fn returns_none_for_prefixes_without_any_match() {
Expand Down Expand Up @@ -330,8 +329,7 @@ cjHJZXWmV4CcRfmLsXzU8s2cR9A0DBvOxhPD1TlKC2JhBFXigjuL9U4Rbq9tdegB
}

mod header {
use crate::odb::hex_to_id;
use crate::odb::store::loose::ldb;
use crate::odb::{hex_to_id, store::loose::ldb};

#[test]
fn existing() -> crate::Result {
Expand Down
2 changes: 1 addition & 1 deletion git-pack/src/bundle/write/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::marker::PhantomData;
use std::{
io,
io::Write,
marker::PhantomData,
path::{Path, PathBuf},
sync::{atomic::AtomicBool, Arc},
};
Expand Down
3 changes: 1 addition & 2 deletions git-pack/src/index/traverse/types.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::collections::BTreeMap;
use std::marker::PhantomData;
use std::{collections::BTreeMap, marker::PhantomData};

/// Statistics regarding object encountered during execution of the [`traverse()`][crate::index::File::traverse()] method.
#[derive(Debug, PartialEq, Eq, Hash, Ord, PartialOrd, Clone)]
Expand Down
9 changes: 5 additions & 4 deletions git-pack/src/index/traverse/with_lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ use std::sync::atomic::{AtomicBool, Ordering};
use git_features::{
parallel::{self, in_parallel_if},
progress::{self, unit, Progress},
threading::{lock, Mutable, OwnShared},
};

use super::{Error, Reducer};
use crate::{data, index, index::util};

use crate::index::traverse::Outcome;
use git_features::threading::{lock, Mutable, OwnShared};
use crate::{
data, index,
index::{traverse::Outcome, util},
};

/// Traversal options for [`index::File::traverse_with_lookup()`]
pub struct Options<F> {
Expand Down
3 changes: 2 additions & 1 deletion git-pack/src/index/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ use crate::index;

///
pub mod integrity {
use git_object::bstr::BString;
use std::marker::PhantomData;

use git_object::bstr::BString;

/// Returned by [`index::File::verify_integrity()`][crate::index::File::verify_integrity()].
#[derive(thiserror::Error, Debug)]
#[allow(missing_docs)]
Expand Down
6 changes: 4 additions & 2 deletions git-pack/tests/pack/data/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ fn pack_at(at: &str) -> pack::data::File {
mod method {
use std::sync::atomic::AtomicBool;

use crate::hex_to_id;
use git_features::progress;

use crate::pack::{data::file::pack_at, SMALL_PACK};
use crate::{
hex_to_id,
pack::{data::file::pack_at, SMALL_PACK},
};

#[test]
fn checksum() {
Expand Down
3 changes: 1 addition & 2 deletions git-pack/tests/pack/multi_index/access.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use std::path::PathBuf;

use crate::hex_to_id;

use super::multi_index;
use crate::hex_to_id;

#[test]
fn lookup_with_ambiguity() {
Expand Down
3 changes: 2 additions & 1 deletion git-pack/tests/pack/multi_index/write.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use std::{path::PathBuf, sync::atomic::AtomicBool};

use crate::hex_to_id;
use git_features::progress;
use git_testtools::fixture_path_standalone;

use crate::hex_to_id;

#[test]
fn from_paths() -> crate::Result {
let dir = tempfile::TempDir::new()?;
Expand Down
6 changes: 3 additions & 3 deletions git-ref/tests/file/reference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@ mod reflog {
}

mod peel {
use crate::util::hex_to_id;
use git_odb::pack::Find;
use git_ref::{file::ReferenceExt, peel, Reference};

use crate::{file, file::store_with_packed_refs};
use crate::{file, file::store_with_packed_refs, util::hex_to_id};

#[test]
fn one_level() -> crate::Result {
Expand Down Expand Up @@ -180,10 +179,11 @@ mod parse {
mktest!(ref_tag, b"reff: hello", "\"reff: hello\" could not be parsed");
}
mod valid {
use crate::util::hex_to_id;
use git_object::bstr::ByteSlice;
use git_ref::file::loose::Reference;

use crate::util::hex_to_id;

macro_rules! mktest {
($name:ident, $input:literal, $kind:path, $id:expr, $ref:expr) => {
#[test]
Expand Down
3 changes: 1 addition & 2 deletions git-ref/tests/file/store/find.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ mod existing {

use git_ref::{PartialName, PartialNameRef};

use crate::file::store_at;
use crate::util::hex_to_id;
use crate::{file::store_at, util::hex_to_id};

#[test]
fn with_packed_refs() -> crate::Result {
Expand Down
6 changes: 4 additions & 2 deletions git-ref/tests/file/store/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ use std::convert::TryInto;

use git_object::bstr::ByteSlice;

use crate::file::{store, store_at, store_with_packed_refs};
use crate::util::hex_to_id;
use crate::{
file::{store, store_at, store_with_packed_refs},
util::hex_to_id,
};

mod with_namespace {
use git_object::bstr::{BString, ByteSlice};
Expand Down
10 changes: 6 additions & 4 deletions git-ref/tests/file/transaction/prepare_and_commit/delete.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
use std::convert::TryInto;

use crate::util::hex_to_id;
use git_lock::acquire::Fail;
use git_ref::{
file::ReferenceExt,
transaction::{Change, PreviousValue, RefEdit, RefLog},
Reference, Target,
};

use crate::file::{
store_writable,
transaction::prepare_and_commit::{committer, empty_store},
use crate::{
file::{
store_writable,
transaction::prepare_and_commit::{committer, empty_store},
},
util::hex_to_id,
};

#[test]
Expand Down
10 changes: 6 additions & 4 deletions git-ref/tests/file/worktree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,17 +193,19 @@ mod read_only {
mod writable {
use std::convert::TryInto;

use crate::util::hex_to_id;
use git_lock::acquire::Fail;
use git_ref::{
file::{transaction::PackedRefs, Store},
transaction::{Change, LogChange, PreviousValue, RefEdit},
FullName, FullNameRef, Target,
};

use crate::file::{
transaction::prepare_and_commit::committer,
worktree::{main_store, worktree_store, Mode},
use crate::{
file::{
transaction::prepare_and_commit::committer,
worktree::{main_store, worktree_store, Mode},
},
util::hex_to_id,
};

fn change_with_id(id: git_hash::ObjectId) -> Change {
Expand Down
3 changes: 1 addition & 2 deletions git-ref/tests/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,12 @@ mod refedit_ext {
mod splitting {
use std::{cell::Cell, convert::TryInto};

use crate::util::hex_to_id;
use git_ref::{
transaction::{Change, LogChange, PreviousValue, RefEdit, RefEditsExt, RefLog},
FullNameRef, PartialNameRef, Target,
};

use crate::transaction::refedit_ext::MockStore;
use crate::{transaction::refedit_ext::MockStore, util::hex_to_id};

fn find<'a>(edits: &'a [RefEdit], name: &str) -> &'a RefEdit {
let name: &FullNameRef = name.try_into().unwrap();
Expand Down
9 changes: 6 additions & 3 deletions git-repository/src/config/cache/access.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ use std::{borrow::Cow, path::PathBuf, time::Duration};

use git_lock::acquire::Fail;

use crate::config::cache::util::ApplyLeniency;
use crate::config::tree::{Checkout, Core, Key};
use crate::{
bstr::BStr,
config,
config::{cache::util::ApplyLeniencyDefault, checkout_options, Cache},
config::{
cache::util::{ApplyLeniency, ApplyLeniencyDefault},
checkout_options,
tree::{Checkout, Core, Key},
Cache,
},
remote,
repository::identity,
};
Expand Down
7 changes: 5 additions & 2 deletions git-repository/src/config/cache/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ use std::borrow::Cow;
use git_sec::Permission;

use super::{interpolate_context, util, Error, StageOne};
use crate::config::tree::{gitoxide, Core, Http};
use crate::{
bstr::BString,
config,
config::{cache::util::ApplyLeniency, Cache},
config::{
cache::util::ApplyLeniency,
tree::{gitoxide, Core, Http},
Cache,
},
repository,
};

Expand Down

0 comments on commit e22080e

Please sign in to comment.