Skip to content

Commit

Permalink
make fmt (#427)
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Aug 3, 2022
1 parent e972aad commit 4b320e7
Show file tree
Hide file tree
Showing 45 changed files with 165 additions and 122 deletions.
6 changes: 4 additions & 2 deletions git-attributes/src/match_group.rs
@@ -1,11 +1,13 @@
use crate::{Assignment, MatchGroup, PatternList, PatternMapping};
use bstr::{BStr, BString, ByteSlice, ByteVec};
use std::{
ffi::OsString,
io::Read,
path::{Path, PathBuf},
};

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

use crate::{Assignment, MatchGroup, PatternList, PatternMapping};

fn into_owned_assignments<'a>(
attrs: impl Iterator<Item = Result<crate::AssignmentRef<'a>, crate::name::Error>>,
) -> Result<Vec<Assignment>, crate::name::Error> {
Expand Down
3 changes: 2 additions & 1 deletion git-attributes/src/name.rs
@@ -1,6 +1,7 @@
use crate::{Name, NameRef};
use bstr::BString;

use crate::{Name, NameRef};

impl<'a> NameRef<'a> {
/// Turn this ref into its owned counterpart.
pub fn to_owned(self) -> Name {
Expand Down
6 changes: 4 additions & 2 deletions git-attributes/src/parse/attribute.rs
@@ -1,7 +1,9 @@
use crate::{name, AssignmentRef, Name, NameRef, StateRef};
use bstr::{BStr, ByteSlice};
use std::borrow::Cow;

use bstr::{BStr, ByteSlice};

use crate::{name, AssignmentRef, Name, NameRef, StateRef};

/// The kind of attribute that was parsed.
#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)]
#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
Expand Down
3 changes: 2 additions & 1 deletion git-attributes/src/state.rs
@@ -1,6 +1,7 @@
use crate::{State, StateRef};
use bstr::ByteSlice;

use crate::{State, StateRef};

impl<'a> StateRef<'a> {
/// Turn ourselves into our owned counterpart.
pub fn to_owned(self) -> State {
Expand Down
3 changes: 2 additions & 1 deletion git-date/src/time.rs
@@ -1,6 +1,7 @@
use bstr::BString;
use std::{convert::TryInto, io, ops::Sub};

use bstr::BString;

use crate::Time;

/// Indicates if a number is positive or negative for use in [`Time`].
Expand Down
3 changes: 2 additions & 1 deletion git-discover/src/upwards.rs
Expand Up @@ -117,9 +117,10 @@ mod parse_ceiling_dirs {
#[test]
#[cfg(unix)]
fn from_environment_format() -> std::io::Result<()> {
use super::*;
use std::{fs, os::unix::fs::symlink};

use super::*;

// Setup filesystem
let dir = tempfile::tempdir().expect("success creating temp dir");
let direct_path = dir.path().join("direct");
Expand Down
3 changes: 2 additions & 1 deletion git-features/src/fs.rs
Expand Up @@ -72,9 +72,10 @@ pub fn open_options_no_follow() -> std::fs::OpenOptions {
}

mod snapshot {
use crate::threading::{get_mut, get_ref, MutableOnDemand, OwnShared};
use std::ops::Deref;

use crate::threading::{get_mut, get_ref, MutableOnDemand, OwnShared};

/// A structure holding enough information to reload a value if its on-disk representation changes as determined by its modified time.
#[derive(Debug)]
pub struct Snapshot<T: std::fmt::Debug> {
Expand Down
6 changes: 4 additions & 2 deletions git-index/src/write.rs
@@ -1,10 +1,12 @@
use crate::{extension, State, Version};
use bstr::ByteVec;
use std::{
collections::{hash_map, HashMap},
ops::Range,
};

use bstr::ByteVec;

use crate::{extension, State, Version};

impl State {
pub fn write_to(&self, options: Options) -> Vec<u8> {
let mut writer = Writer::new(self, options);
Expand Down
3 changes: 1 addition & 2 deletions git-odb/src/store_impls/dynamic/find.rs
@@ -1,5 +1,4 @@
use std::collections::HashSet;
use std::{convert::TryInto, ops::Deref};
use std::{collections::HashSet, convert::TryInto, ops::Deref};

use git_hash::{oid, ObjectId};
use git_pack::{cache::DecodeEntry, data::entry::Location};
Expand Down
3 changes: 1 addition & 2 deletions git-odb/src/store_impls/dynamic/handle.rs
Expand Up @@ -69,8 +69,7 @@ pub struct IndexForObjectInPack {
}

pub(crate) mod index_lookup {
use std::collections::HashSet;
use std::sync::Arc;
use std::{collections::HashSet, sync::Arc};

use git_hash::oid;

Expand Down
3 changes: 1 addition & 2 deletions git-odb/src/store_impls/loose/find.rs
@@ -1,5 +1,4 @@
use std::collections::HashSet;
use std::{cmp::Ordering, fs, io::Read, path::PathBuf};
use std::{cmp::Ordering, collections::HashSet, fs, io::Read, path::PathBuf};

use git_features::zlib;

Expand Down
3 changes: 2 additions & 1 deletion git-odb/tests/odb/store/dynamic.rs
Expand Up @@ -553,9 +553,10 @@ mod disambiguate_prefix {
}

mod lookup_prefix {
use std::collections::HashSet;

use git_testtools::hex_to_id;
use maplit::hashset;
use std::collections::HashSet;

use crate::store::dynamic::{assert_all_indices_loaded, db_with_all_object_sources};

Expand Down
3 changes: 2 additions & 1 deletion git-odb/tests/odb/store/loose.rs
Expand Up @@ -85,9 +85,10 @@ mod contains {
}

mod lookup_prefix {
use std::collections::HashSet;

use git_testtools::{fixture_path, hex_to_id};
use maplit::hashset;
use std::collections::HashSet;

use crate::store::loose::ldb;

Expand Down
3 changes: 1 addition & 2 deletions git-pack/src/index/access.rs
@@ -1,5 +1,4 @@
use std::mem::size_of;
use std::ops::Range;
use std::{mem::size_of, ops::Range};

use crate::{
data,
Expand Down
6 changes: 4 additions & 2 deletions git-pack/src/multi_index/access.rs
@@ -1,5 +1,7 @@
use std::ops::Range;
use std::path::{Path, PathBuf};
use std::{
ops::Range,
path::{Path, PathBuf},
};

use crate::{
data,
Expand Down
6 changes: 4 additions & 2 deletions git-pathspec/src/parse.rs
@@ -1,7 +1,9 @@
use crate::{MagicSignature, MatchMode, Pattern};
use bstr::{BStr, BString, ByteSlice, ByteVec};
use std::borrow::Cow;

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

use crate::{MagicSignature, MatchMode, Pattern};

/// The error returned by [parse()][crate::parse()].
#[derive(thiserror::Error, Debug)]
#[allow(missing_docs)]
Expand Down
11 changes: 7 additions & 4 deletions git-pathspec/tests/pathspec.rs
@@ -1,11 +1,12 @@
pub use git_testtools::Result;

mod parse {
use std::collections::HashMap;

use bstr::{BStr, BString, ByteSlice};
use git_attributes::State;
use git_pathspec::{MagicSignature, MatchMode, Pattern};
use once_cell::sync::Lazy;
use std::collections::HashMap;

#[derive(Debug, Clone, PartialEq, Eq)]
struct PatternForTesting {
Expand Down Expand Up @@ -59,12 +60,13 @@ mod parse {
}

mod succeed {
use git_attributes::State;
use git_pathspec::{MagicSignature, MatchMode};

use crate::parse::{
check_valid_inputs, pat, pat_with_attrs, pat_with_path, pat_with_path_and_sig, pat_with_search_mode,
pat_with_sig,
};
use git_attributes::State;
use git_pathspec::{MagicSignature, MatchMode};

#[test]
fn there_is_no_pathspec_pathspec() {
Expand Down Expand Up @@ -256,9 +258,10 @@ mod parse {
}

mod fail {
use crate::parse::check_against_baseline;
use git_pathspec::parse::Error;

use crate::parse::check_against_baseline;

#[test]
fn empty_input() {
let input = "";
Expand Down
3 changes: 1 addition & 2 deletions git-ref/src/store/file/transaction/prepare.rs
Expand Up @@ -432,7 +432,6 @@ mod error {
}
}

use crate::packed::transaction::buffer_into_transaction;
pub use error::Error;

use crate::transaction::PreviousValue;
use crate::{packed::transaction::buffer_into_transaction, transaction::PreviousValue};
3 changes: 1 addition & 2 deletions git-repository/src/config/cache.rs
Expand Up @@ -3,8 +3,7 @@ use std::{convert::TryFrom, path::PathBuf};
use git_config::{Boolean, Integer};

use super::{Cache, Error};
use crate::revision::spec::parse::ObjectKindHint;
use crate::{bstr::ByteSlice, repository, repository::identity};
use crate::{bstr::ByteSlice, repository, repository::identity, revision::spec::parse::ObjectKindHint};

/// A utility to deal with the cyclic dependency between the ref store and the configuration. The ref-store needs the
/// object hash kind, and the configuration needs the current branch name to resolve conditional includes with `onbranch`.
Expand Down
3 changes: 1 addition & 2 deletions git-repository/src/config/mod.rs
@@ -1,8 +1,7 @@
pub use git_config::*;
use git_features::threading::OnceCell;

use crate::revision::spec;
use crate::{bstr::BString, permission, repository::identity, Repository};
use crate::{bstr::BString, permission, repository::identity, revision::spec, Repository};

pub(crate) mod cache;
mod snapshot;
Expand Down
9 changes: 6 additions & 3 deletions git-repository/src/head.rs
Expand Up @@ -83,11 +83,14 @@ impl<'repo> Head<'repo> {
}
///
pub mod log {
use crate::bstr::{BString, ByteSlice};
use git_hash::ObjectId;
use std::convert::TryInto;

use crate::Head;
use git_hash::ObjectId;

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

impl<'repo> Head<'repo> {
/// Return a platform for obtaining iterators on the reference log associated with the `HEAD` reference.
Expand Down
3 changes: 2 additions & 1 deletion git-repository/src/repository/location.rs
@@ -1,6 +1,7 @@
use git_path::realpath::MAX_SYMLINKS;
use std::path::PathBuf;

use git_path::realpath::MAX_SYMLINKS;

impl crate::Repository {
/// Return the path to the repository itself, containing objects, references, configuration, and more.
///
Expand Down
3 changes: 1 addition & 2 deletions git-repository/src/repository/revision.rs
@@ -1,5 +1,4 @@
use crate::bstr::BStr;
use crate::revision;
use crate::{bstr::BStr, revision};

/// Methods for resolving revisions by spec or working with the commit graph.
impl crate::Repository {
Expand Down
6 changes: 3 additions & 3 deletions git-repository/src/revision/spec/mod.rs
@@ -1,13 +1,13 @@
use crate::ext::ReferenceExt;
use crate::{revision::Spec, Id, Reference};
use crate::{ext::ReferenceExt, revision::Spec, Id, Reference};

///
pub mod parse;

mod impls {
use crate::revision::Spec;
use std::ops::{Deref, DerefMut};

use crate::revision::Spec;

impl<'repo> Deref for Spec<'repo> {
type Target = git_revision::Spec;

Expand Down
18 changes: 12 additions & 6 deletions git-repository/src/revision/spec/parse/delegate/mod.rs
@@ -1,11 +1,17 @@
use super::{Delegate, Error, ObjectKindHint};
use crate::ext::{ObjectIdExt, ReferenceExt};
use crate::Repository;
use std::collections::HashSet;

use git_hash::ObjectId;
use git_revision::spec::parse;
use git_revision::spec::parse::delegate::{self};
use git_revision::spec::{
parse,
parse::delegate::{self},
};
use smallvec::SmallVec;
use std::collections::HashSet;

use super::{Delegate, Error, ObjectKindHint};
use crate::{
ext::{ObjectIdExt, ReferenceExt},
Repository,
};

type Replacements = SmallVec<[(ObjectId, ObjectId); 1]>;

Expand Down
25 changes: 16 additions & 9 deletions git-repository/src/revision/spec/parse/delegate/navigate.rs
@@ -1,14 +1,21 @@
use crate::bstr::{BStr, ByteSlice};
use crate::ext::ObjectIdExt;
use crate::object;
use crate::revision::spec::parse::delegate::{handle_errors_and_replacements, peel};
use crate::revision::spec::parse::Delegate;
use crate::revision::spec::parse::{delegate::Replacements, Error};
use std::collections::HashSet;

use git_hash::ObjectId;
use git_revision::spec::parse::delegate;
use git_revision::spec::parse::delegate::{PeelTo, Traversal};
use git_revision::spec::parse::{
delegate,
delegate::{PeelTo, Traversal},
};
use git_traverse::commit::Sorting;
use std::collections::HashSet;

use crate::{
bstr::{BStr, ByteSlice},
ext::ObjectIdExt,
object,
revision::spec::parse::{
delegate::{handle_errors_and_replacements, peel, Replacements},
Delegate, Error,
},
};

impl<'repo> delegate::Navigate for Delegate<'repo> {
fn traverse(&mut self, kind: Traversal) -> Option<()> {
Expand Down
20 changes: 13 additions & 7 deletions git-repository/src/revision/spec/parse/delegate/revision.rs
@@ -1,12 +1,18 @@
use crate::bstr::{BStr, BString, ByteSlice};
use crate::ext::ReferenceExt;
use crate::object;
use crate::revision::spec::parse::{Delegate, Error, RefsHint};
use git_hash::ObjectId;
use git_revision::spec::parse::delegate;
use git_revision::spec::parse::delegate::{ReflogLookup, SiblingBranch};
use std::collections::HashSet;

use git_hash::ObjectId;
use git_revision::spec::parse::{
delegate,
delegate::{ReflogLookup, SiblingBranch},
};

use crate::{
bstr::{BStr, BString, ByteSlice},
ext::ReferenceExt,
object,
revision::spec::parse::{Delegate, Error, RefsHint},
};

impl<'repo> delegate::Revision for Delegate<'repo> {
fn find_ref(&mut self, name: &BStr) -> Option<()> {
self.unset_disambiguate_call();
Expand Down
10 changes: 5 additions & 5 deletions git-repository/src/revision/spec/parse/error.rs
@@ -1,10 +1,10 @@
use super::Error;
use crate::bstr::BString;
use crate::ext::ObjectIdExt;
use crate::{bstr, Repository};
use git_hash::ObjectId;
use std::collections::HashSet;

use git_hash::ObjectId;

use super::Error;
use crate::{bstr, bstr::BString, ext::ObjectIdExt, Repository};

/// Additional information about candidates that caused ambiguity.
#[derive(Debug)]
pub enum CandidateInfo {
Expand Down

0 comments on commit 4b320e7

Please sign in to comment.