Skip to content

Commit

Permalink
just fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Jun 6, 2023
1 parent 8f15cec commit ffc1276
Show file tree
Hide file tree
Showing 40 changed files with 154 additions and 118 deletions.
2 changes: 1 addition & 1 deletion cargo-smart-release/src/changelog/merge.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::bail;
use std::{collections::VecDeque, iter::FromIterator};

use anyhow::bail;
use gix::hash::ObjectId;

use crate::{
Expand Down
10 changes: 7 additions & 3 deletions gitoxide-core/src/repository/attributes/query.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
use crate::OutputFormat;
use gix::odb::FindExt;

use crate::OutputFormat;

pub struct Options {
pub format: OutputFormat,
pub statistics: bool,
}

pub(crate) mod function {
use crate::repository::attributes::query::{attributes_cache, Options};
use crate::OutputFormat;
use std::io;

use anyhow::bail;
use gix::prelude::FindExt;

use crate::{
repository::attributes::query::{attributes_cache, Options},
OutputFormat,
};

pub fn query(
repo: gix::Repository,
pathspecs: impl Iterator<Item = gix::path::Spec>,
Expand Down
32 changes: 18 additions & 14 deletions gitoxide-core/src/repository/attributes/validate_baseline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,26 @@ pub struct Options {
}

pub(crate) mod function {
use std::collections::BTreeSet;
use std::io;
use std::io::{BufRead, Write};
use std::iter::Peekable;
use std::ops::Sub;
use std::path::PathBuf;
use std::sync::atomic::Ordering;
use std::{
collections::BTreeSet,
io,
io::{BufRead, Write},
iter::Peekable,
ops::Sub,
path::PathBuf,
sync::atomic::Ordering,
};

use anyhow::{anyhow, bail};
use gix::odb::FindExt;
use gix::Progress;
use gix::{odb::FindExt, Progress};

use crate::repository::attributes::query::{attributes_cache, index_on_demand};
use crate::repository::attributes::validate_baseline::Options;
use crate::OutputFormat;
use crate::{
repository::attributes::{
query::{attributes_cache, index_on_demand},
validate_baseline::Options,
},
OutputFormat,
};

pub fn validate_baseline(
repo: gix::Repository,
Expand Down Expand Up @@ -350,8 +355,7 @@ pub(crate) mod function {
}

fn parse_attribute_line(line: &str) -> Option<(&str, gix::attrs::AssignmentRef<'_>)> {
use gix::attrs::StateRef;
use gix::bstr::ByteSlice;
use gix::{attrs::StateRef, bstr::ByteSlice};

let mut prev = None;
let mut tokens = line.splitn(3, |b| {
Expand Down
14 changes: 10 additions & 4 deletions gitoxide-core/src/repository/index/entries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@ pub enum Attributes {
}

pub(crate) mod function {
use crate::repository::attributes::query::index_on_demand;
use crate::repository::index::entries::{Attributes, Options};
use std::{
borrow::Cow,
io::{BufWriter, Write},
};

use gix::odb::FindExt;
use std::borrow::Cow;
use std::io::{BufWriter, Write};

use crate::repository::{
attributes::query::index_on_demand,
index::entries::{Attributes, Options},
};

pub fn entries(
repo: gix::Repository,
Expand Down
2 changes: 1 addition & 1 deletion gitoxide-core/src/repository/index/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::bail;
use std::{ffi::OsString, path::PathBuf};

use anyhow::bail;
use gix::prelude::FindExt;

pub fn from_tree(
Expand Down
7 changes: 3 additions & 4 deletions gix-actor/src/identity.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::signature::decode;
use crate::{Identity, IdentityRef};
use bstr::ByteSlice;

use crate::{signature::decode, Identity, IdentityRef};

impl<'a> IdentityRef<'a> {
/// Deserialize an identity from the given `data`.
pub fn from_bytes<E>(data: &'a [u8]) -> Result<Self, nom::Err<E>>
Expand Down Expand Up @@ -29,8 +29,7 @@ impl<'a> IdentityRef<'a> {
}

mod write {
use crate::signature::write::validated_token;
use crate::{Identity, IdentityRef};
use crate::{signature::write::validated_token, Identity, IdentityRef};

/// Output
impl Identity {
Expand Down
6 changes: 4 additions & 2 deletions gix-attributes/src/assignment.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use crate::{Assignment, AssignmentRef, NameRef, StateRef};
use bstr::ByteSlice;
use std::fmt::Write;

use bstr::ByteSlice;

use crate::{Assignment, AssignmentRef, NameRef, StateRef};

impl<'a> AssignmentRef<'a> {
pub(crate) fn new(name: NameRef<'a>, state: StateRef<'a>) -> AssignmentRef<'a> {
AssignmentRef { name, state }
Expand Down
5 changes: 2 additions & 3 deletions gix-attributes/src/search/outcome.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ use bstr::{BString, ByteSlice};
use gix_glob::Pattern;
use kstring::{KString, KStringRef};

use crate::search::refmap::RefMapKey;
use crate::{
search::{
Assignments, AttributeId, Attributes, MatchKind, Metadata, MetadataCollection, Outcome, TrackedAssignment,
Value,
refmap::RefMapKey, Assignments, AttributeId, Attributes, MatchKind, Metadata, MetadataCollection, Outcome,
TrackedAssignment, Value,
},
AssignmentRef, NameRef, StateRef,
};
Expand Down
8 changes: 4 additions & 4 deletions gix-attributes/src/search/refmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
//!
//! We chose to use hashing/identity over pointers as it's possible that different objects end up in the same memory location,
//! which would create obscure bugs. The same could happen with hash collisions, but they these are designed to be less likely.
use std::collections::btree_map::Entry;
use std::collections::hash_map::DefaultHasher;
use std::collections::BTreeMap;
use std::hash::{Hash, Hasher};
use std::{
collections::{btree_map::Entry, hash_map::DefaultHasher, BTreeMap},
hash::{Hash, Hasher},
};

pub(crate) type RefMapKey = u64;
pub(crate) struct RefMap<T>(BTreeMap<RefMapKey, T>);
Expand Down
3 changes: 2 additions & 1 deletion gix-attributes/tests/search/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,10 @@ fn assignments<'a>(
}

mod baseline {
use std::path::PathBuf;

use bstr::{BStr, ByteSlice};
use gix_attributes::{search::MetadataCollection, AssignmentRef, StateRef};
use std::path::PathBuf;

/// Read user-attributes and baseline in one go.
pub fn user_attributes_named_baseline(
Expand Down
3 changes: 1 addition & 2 deletions gix-discover/src/upwards/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ pub use types::{Error, Options};
mod util;

pub(crate) mod function {
use std::ffi::OsStr;
use std::{borrow::Cow, path::Path};
use std::{borrow::Cow, ffi::OsStr, path::Path};

use gix_sec::Trust;

Expand Down
3 changes: 2 additions & 1 deletion gix-negotiate/src/consecutive.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use crate::{Error, Flags, Negotiator};
use gix_hash::ObjectId;
use gix_revision::graph::CommitterTimestamp;

use crate::{Error, Flags, Negotiator};

pub(crate) struct Algorithm {
revs: gix_revision::PriorityQueue<CommitterTimestamp, ObjectId>,
non_common_revs: usize,
Expand Down
3 changes: 2 additions & 1 deletion gix-negotiate/src/noop.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::{Error, Negotiator};
use gix_hash::ObjectId;

use crate::{Error, Negotiator};

pub(crate) struct Noop;

impl Negotiator for Noop {
Expand Down
3 changes: 2 additions & 1 deletion gix-negotiate/src/skipping.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use crate::{Error, Flags, Metadata, Negotiator};
use gix_hash::ObjectId;
use gix_revision::graph::CommitterTimestamp;

use crate::{Error, Flags, Metadata, Negotiator};

pub(crate) struct Algorithm {
revs: gix_revision::PriorityQueue<CommitterTimestamp, ObjectId>,
non_common_revs: usize,
Expand Down
18 changes: 9 additions & 9 deletions gix-negotiate/tests/baseline/mod.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
use gix_negotiate::Algorithm;
use gix_object::bstr;
use gix_object::bstr::ByteSlice;
use gix_odb::Find;
use gix_odb::FindExt;
use gix_ref::file::ReferenceExt;
use gix_ref::store::WriteReflog;
use std::cell::RefCell;

use gix_negotiate::Algorithm;
use gix_object::{bstr, bstr::ByteSlice};
use gix_odb::{Find, FindExt};
use gix_ref::{file::ReferenceExt, store::WriteReflog};

#[test]
fn run() -> crate::Result {
let root = gix_testtools::scripted_fixture_read_only("make_repos.sh")?;
Expand Down Expand Up @@ -185,8 +183,10 @@ struct Round {
}

mod parse {
use gix_object::bstr;
use gix_object::bstr::{BStr, ByteSlice};
use gix_object::{
bstr,
bstr::{BStr, ByteSlice},
};

#[derive(Debug, Eq, PartialEq, Copy, Clone)]
pub enum Command {
Expand Down
4 changes: 2 additions & 2 deletions gix-object/tests/object.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use gix_hash::ObjectId;

use std::path::PathBuf;

use gix_hash::ObjectId;

mod commit;
mod encode;
mod object_ref;
Expand Down
2 changes: 1 addition & 1 deletion gix-pack/src/cache/delta/traverse/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::sync::atomic::{AtomicBool, Ordering};

use gix_features::threading::{Mutable, OwnShared};
use gix_features::{
parallel::in_parallel_with_slice,
progress::{self, Progress},
threading,
threading::{Mutable, OwnShared},
};

use crate::{
Expand Down
9 changes: 5 additions & 4 deletions gix-pack/src/cache/delta/traverse/resolve.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use std::sync::atomic::{AtomicBool, AtomicIsize};
use std::{collections::BTreeMap, sync::atomic::Ordering};
use std::{
collections::BTreeMap,
sync::atomic::{AtomicBool, AtomicIsize, Ordering},
};

use gix_features::progress::Progress;
use gix_features::{threading, zlib};
use gix_features::{progress::Progress, threading, zlib};

use crate::{
cache::delta::{
Expand Down
6 changes: 4 additions & 2 deletions gix-revision/src/describe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,10 @@ pub(crate) mod function {
use gix_hash::oid;

use super::{Error, Outcome};
use crate::describe::{CommitTime, Flags, Options, MAX_CANDIDATES};
use crate::{Graph, PriorityQueue};
use crate::{
describe::{CommitTime, Flags, Options, MAX_CANDIDATES},
Graph, PriorityQueue,
};

/// Given a `commit` id, traverse the commit `graph` and collect candidate names from the `name_by_oid` mapping to produce
/// an `Outcome`, which converted [`into_format()`][Outcome::into_format()] will produce a typical `git describe` string.
Expand Down
3 changes: 2 additions & 1 deletion gix-revision/src/graph/commit.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use smallvec::SmallVec;

use super::LazyCommit;
use crate::graph::{Commit, CommitterTimestamp, Either, Generation};
use smallvec::SmallVec;

impl<'graph> LazyCommit<'graph> {
/// Return an iterator over the parents of this commit.
Expand Down
3 changes: 1 addition & 2 deletions gix-revision/src/graph/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ pub mod lookup {

///
pub mod insert_parents {
use crate::graph::commit::iter_parents;
use crate::graph::lookup;
use crate::graph::{commit::iter_parents, lookup};

/// The error returned by [`insert_parents()`][crate::Graph::insert_parents()].
#[derive(Debug, thiserror::Error)]
Expand Down
7 changes: 4 additions & 3 deletions gix-revision/src/graph/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use crate::Graph;
use std::{fmt::Formatter, ops::Index};

use gix_hash::oid;
use smallvec::SmallVec;
use std::fmt::Formatter;
use std::ops::Index;

use crate::Graph;

///
pub mod commit;
Expand Down
4 changes: 2 additions & 2 deletions gix-revision/src/queue.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{cmp::Ordering, collections::BinaryHeap};

use crate::PriorityQueue;
use std::cmp::Ordering;
use std::collections::BinaryHeap;

pub(crate) struct Item<K, T> {
key: K,
Expand Down
9 changes: 5 additions & 4 deletions gix-revision/tests/describe/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use std::borrow::Cow;
use std::path::PathBuf;
use std::{borrow::Cow, path::PathBuf};

use gix_object::bstr::ByteSlice;
use gix_odb::Find;
use gix_revision::describe;
use gix_revision::describe::{Error, Outcome};
use gix_revision::{
describe,
describe::{Error, Outcome},
};

use crate::hex_to_id;

Expand Down
3 changes: 1 addition & 2 deletions gix-worktree/src/cache/delegate.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::cache::State;
use crate::PathIdMapping;
use crate::{cache::State, PathIdMapping};

/// Various aggregate numbers related to the stack delegate itself.
#[derive(Default, Clone, Copy, Debug)]
Expand Down
8 changes: 5 additions & 3 deletions gix-worktree/src/cache/state/attributes.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
use std::path::{Path, PathBuf};

use crate::{Cache, PathIdMapping};
use bstr::{BStr, ByteSlice};
use gix_glob::pattern::Case;

use crate::cache::state::{AttributeMatchGroup, Attributes};
use bstr::{BStr, ByteSlice};
use crate::{
cache::state::{AttributeMatchGroup, Attributes},
Cache, PathIdMapping,
};

/// Various aggregate numbers related [`Attributes`].
#[derive(Default, Clone, Copy, Debug)]
Expand Down

0 comments on commit ffc1276

Please sign in to comment.