Skip to content

Commit

Permalink
j fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Dec 2, 2023
1 parent dfb3f18 commit 51c7abc
Show file tree
Hide file tree
Showing 106 changed files with 317 additions and 275 deletions.
3 changes: 2 additions & 1 deletion gitoxide-core/src/corpus/run.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use gix::progress::DynNestedProgress;
use std::{path::Path, sync::atomic::AtomicBool};

use gix::progress::DynNestedProgress;

use crate::{
corpus,
corpus::{Run, Task},
Expand Down
3 changes: 1 addition & 2 deletions gitoxide-core/src/index/checkout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use std::{
};

use anyhow::bail;
use gix::objs::find::Error;
use gix::{worktree::state::checkout, NestedProgress, Progress};
use gix::{objs::find::Error, worktree::state::checkout, NestedProgress, Progress};

use crate::{
index,
Expand Down
7 changes: 3 additions & 4 deletions gitoxide-core/src/pack/receive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ impl<W> protocol::fetch::DelegateBlocking for CloneDelegate<W> {
mod blocking_io {
use std::{io, io::BufRead, path::PathBuf};

use gix::config::tree::Key;
use gix::{
bstr::BString,
config::tree::Key,
protocol,
protocol::{fetch::Response, handshake::Ref},
NestedProgress,
Expand Down Expand Up @@ -194,18 +194,17 @@ mod blocking_io {

#[cfg(feature = "blocking-client")]
pub use blocking_io::receive;
use gix::protocol::ls_refs;
use gix::NestedProgress;
use gix::{protocol::ls_refs, NestedProgress};

#[cfg(feature = "async-client")]
mod async_io {
use std::{io, io::BufRead, path::PathBuf};

use async_trait::async_trait;
use futures_io::AsyncBufRead;
use gix::config::tree::Key;
use gix::{
bstr::{BString, ByteSlice},
config::tree::Key,
odb::pack,
protocol,
protocol::{fetch::Response, handshake::Ref},
Expand Down
7 changes: 3 additions & 4 deletions gitoxide-core/src/query/engine/update.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
use std::cell::RefCell;
use std::{
cell::RefCell,
convert::Infallible,
sync::atomic::{AtomicUsize, Ordering},
time::Instant,
};

use anyhow::{anyhow, bail};
use gix::diff::blob::platform::prepare_diff::Operation;
use gix::objs::find::Error;
use gix::{
bstr::{BStr, BString, ByteSlice},
diff::rewrites::CopySource,
diff::{blob::platform::prepare_diff::Operation, rewrites::CopySource},
features::progress,
objs::find::Error,
parallel::{InOrderIter, SequenceId},
prelude::ObjectIdExt,
Count, Progress,
Expand Down
3 changes: 1 addition & 2 deletions gitoxide-core/src/repository/attributes/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ pub struct Options {
}

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

use anyhow::{anyhow, bail};
use gix::bstr::BStr;
Expand Down
3 changes: 1 addition & 2 deletions gitoxide-core/src/repository/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ pub struct Options {
pub const PROGRESS_RANGE: std::ops::RangeInclusive<u8> = 1..=3;

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

use anyhow::{bail, Context};
use gix::{bstr::BString, remote::fetch::Status, NestedProgress};
Expand Down
3 changes: 1 addition & 2 deletions gitoxide-core/src/repository/exclude.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::borrow::Cow;
use std::io;
use std::{borrow::Cow, io};

use anyhow::{anyhow, bail};
use gix::bstr::BStr;
Expand Down
6 changes: 4 additions & 2 deletions gitoxide-core/src/repository/revision/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ pub(crate) mod function {
use gix::revision::Spec;

use super::Options;
use crate::repository::revision::resolve::TreeMode;
use crate::{repository::revision, OutputFormat};
use crate::{
repository::{revision, revision::resolve::TreeMode},
OutputFormat,
};

pub fn resolve(
mut repo: gix::Repository,
Expand Down
14 changes: 8 additions & 6 deletions gitoxide-core/src/repository/status.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
use crate::OutputFormat;
use anyhow::{bail, Context};
use gix::bstr::{BStr, BString};
use gix::index::Entry;
use gix::Progress;
use gix_status::index_as_worktree::traits::FastEq;
use gix_status::index_as_worktree::{Change, Conflict, EntryStatus};
use gix::{
bstr::{BStr, BString},
index::Entry,
Progress,
};
use gix_status::index_as_worktree::{traits::FastEq, Change, Conflict, EntryStatus};

use crate::OutputFormat;

pub enum Submodules {
/// display all information about submodules, including ref changes, modifications and untracked files.
Expand Down
7 changes: 3 additions & 4 deletions gitoxide-core/src/repository/submodule.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use crate::OutputFormat;
use anyhow::bail;
use gix::commit::describe::SelectRef;
use gix::prelude::ObjectIdExt;
use gix::{Repository, Submodule};
use gix::{commit::describe::SelectRef, prelude::ObjectIdExt, Repository, Submodule};

use crate::OutputFormat;

pub fn list(repo: Repository, mut out: impl std::io::Write, format: OutputFormat) -> anyhow::Result<()> {
if format != OutputFormat::Human {
Expand Down
4 changes: 2 additions & 2 deletions gix-command/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#![deny(rust_2018_idioms, missing_docs)]
#![forbid(unsafe_code)]

use std::{ffi::OsString, path::PathBuf};

use bstr::BString;
use std::ffi::OsString;
use std::path::PathBuf;

/// A structure to keep settings to use when invoking a command via [`spawn()`][Prepare::spawn()], after creating it with [`prepare()`].
pub struct Prepare {
Expand Down
3 changes: 1 addition & 2 deletions gix-config/tests/file/init/from_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use gix_config::{
file::{includes, init, init::from_env},
File,
};
use gix_testtools::tempfile::tempdir;
use gix_testtools::Env;
use gix_testtools::{tempfile::tempdir, Env};
use serial_test::serial;

use crate::file::init::from_paths::escape_backslashes;
Expand Down
3 changes: 1 addition & 2 deletions gix-date/tests/time/baseline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ use gix_date::{
time::{format, Format},
SecondsSinceUnixEpoch,
};
use once_cell::sync::Lazy;

use gix_testtools::Result;
use once_cell::sync::Lazy;

struct Sample {
format_name: Option<String>,
Expand Down
5 changes: 2 additions & 3 deletions gix-diff/src/blob/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
//! For using text diffs, please have a look at the [`imara-diff` documentation](https://docs.rs/imara-diff),
//! maintained by [Pascal Kuthe](https://github.com/pascalkuthe).
pub use imara_diff::*;
use std::collections::HashMap;
use std::path::PathBuf;
use std::{collections::HashMap, path::PathBuf};

use bstr::BString;
pub use imara_diff::*;

///
pub mod pipeline;
Expand Down
18 changes: 12 additions & 6 deletions gix-diff/src/blob/pipeline.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
use crate::blob::{Driver, Pipeline, ResourceKind};
use std::{
io::{Read, Write},
path::{Path, PathBuf},
process::{Command, Stdio},
};

use bstr::{BStr, ByteSlice};
use gix_filter::driver::apply::{Delay, MaybeDelayed};
use gix_filter::pipeline::convert::{ToGitOutcome, ToWorktreeOutcome};
use gix_filter::{
driver::apply::{Delay, MaybeDelayed},
pipeline::convert::{ToGitOutcome, ToWorktreeOutcome},
};
use gix_object::tree::EntryKind;
use std::io::{Read, Write};
use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};

use crate::blob::{Driver, Pipeline, ResourceKind};

/// A way to access roots for different kinds of resources that are possibly located and accessible in a worktree.
#[derive(Clone, Debug, Default)]
Expand Down
22 changes: 14 additions & 8 deletions gix-diff/src/blob/platform.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use std::{io::Write, process::Stdio};

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

use super::Algorithm;
use crate::blob::{pipeline, Pipeline, Platform, ResourceKind};
use bstr::{BStr, BString, ByteSlice};
use std::io::Write;
use std::process::Stdio;

/// A key to uniquely identify either a location in the worktree, or in the object database.
#[derive(Clone)]
Expand Down Expand Up @@ -90,8 +91,10 @@ pub struct Resource<'a> {

///
pub mod resource {
use crate::blob::pipeline;
use crate::blob::platform::{CacheKey, CacheValue, Resource};
use crate::blob::{
pipeline,
platform::{CacheKey, CacheValue, Resource},
};

impl<'a> Resource<'a> {
pub(crate) fn new(key: &'a CacheKey, value: &'a CacheValue) -> Self {
Expand Down Expand Up @@ -148,9 +151,10 @@ pub mod resource {

///
pub mod set_resource {
use crate::blob::{pipeline, ResourceKind};
use bstr::BString;

use crate::blob::{pipeline, ResourceKind};

/// The error returned by [Platform::set_resource](super::Platform::set_resource).
#[derive(Debug, thiserror::Error)]
#[allow(missing_docs)]
Expand All @@ -176,9 +180,10 @@ pub mod set_resource {

///
pub mod prepare_diff {
use crate::blob::platform::Resource;
use bstr::BStr;

use crate::blob::platform::Resource;

/// The kind of operation that was performed during the [`diff`](super::Platform::prepare_diff()) operation.
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum Operation<'a> {
Expand Down Expand Up @@ -241,9 +246,10 @@ pub mod prepare_diff {

///
pub mod prepare_diff_command {
use bstr::BString;
use std::ops::{Deref, DerefMut};

use bstr::BString;

/// The error returned by [Platform::prepare_diff_command()](super::Platform::prepare_diff_command()).
#[derive(Debug, thiserror::Error)]
#[allow(missing_docs)]
Expand Down
1 change: 0 additions & 1 deletion gix-diff/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
/// Re-export for use in public API.
#[cfg(feature = "blob")]
pub use gix_command as command;

/// Re-export for use in public API.
#[cfg(feature = "blob")]
pub use gix_object as object;
Expand Down
17 changes: 9 additions & 8 deletions gix-diff/src/rewrites/tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
//! - the set used for copy-detection is probably smaller by default.
use std::ops::Range;

use bstr::BStr;
use gix_object::tree::{EntryKind, EntryMode};

use crate::blob::platform::prepare_diff::Operation;
use crate::blob::{DiffLineStats, ResourceKind};
use crate::rewrites::{CopySource, Outcome};
use crate::{rewrites::Tracker, Rewrites};
use bstr::BStr;
use crate::{
blob::{platform::prepare_diff::Operation, DiffLineStats, ResourceKind},
rewrites::{CopySource, Outcome, Tracker},
Rewrites,
};

/// The kind of a change.
#[derive(Debug, Copy, Clone, Ord, PartialOrd, PartialEq, Eq)]
Expand Down Expand Up @@ -75,10 +76,11 @@ impl<T: Change> Item<T> {

/// A module with types used in the user-callback in [Tracker::emit()](crate::rewrites::Tracker::emit()).
pub mod visit {
use crate::blob::DiffLineStats;
use bstr::BStr;
use gix_object::tree::EntryMode;

use crate::blob::DiffLineStats;

/// The source of a rewrite, rename or copy.
#[derive(Debug, Clone, PartialEq, PartialOrd)]
pub struct Source<'a> {
Expand Down Expand Up @@ -566,8 +568,7 @@ mod diff {
#[cfg(test)]
mod estimate_involved_items {
use super::estimate_involved_items;
use crate::rewrites::tracker::visit::SourceKind;
use crate::rewrites::tracker::ChangeKind;
use crate::rewrites::tracker::{visit::SourceKind, ChangeKind};

#[test]
fn renames_count_unemitted_as_sources_and_destinations() {
Expand Down
3 changes: 1 addition & 2 deletions gix-diff/src/tree/changes.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::{borrow::BorrowMut, collections::VecDeque};

use gix_object::tree::EntryRef;
use gix_object::FindExt;
use gix_object::{tree::EntryRef, FindExt};

use crate::{
tree,
Expand Down
4 changes: 2 additions & 2 deletions gix-diff/src/tree/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ pub trait Visit {

#[cfg(feature = "blob")]
mod change_impls {
use crate::rewrites::tracker::ChangeKind;
use crate::tree::visit::Change;
use gix_hash::oid;
use gix_object::tree::EntryMode;

use crate::{rewrites::tracker::ChangeKind, tree::visit::Change};

impl crate::rewrites::tracker::Change for crate::tree::visit::Change {
fn id(&self) -> &oid {
match self {
Expand Down
16 changes: 9 additions & 7 deletions gix-diff/tests/blob/pipeline.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
pub(crate) mod convert_to_diffable {

use crate::util::ObjectDb;
use gix_diff::blob::pipeline::Options;
use gix_diff::blob::{pipeline, pipeline::WorktreeRoots, ResourceKind};
use gix_filter::eol;
use gix_filter::eol::AutoCrlf;
use gix_object::bstr::ByteSlice;
use gix_object::tree::EntryKind;
use gix_diff::blob::{
pipeline,
pipeline::{Options, WorktreeRoots},
ResourceKind,
};
use gix_filter::{eol, eol::AutoCrlf};
use gix_object::{bstr::ByteSlice, tree::EntryKind};
use gix_worktree::stack::state::attributes;

use crate::util::ObjectDb;

#[test]
fn simple() -> crate::Result {
for mode in [
Expand Down
19 changes: 11 additions & 8 deletions gix-diff/tests/blob/platform.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
use crate::blob::pipeline::convert_to_diffable::default_options;
use crate::hex_to_id;
use crate::util::ObjectDb;
use gix_diff::blob::platform::prepare_diff;
use gix_diff::blob::platform::prepare_diff::Operation;
use gix_diff::blob::{pipeline, platform, Algorithm, Platform, ResourceKind};
use gix_object::bstr::{BString, ByteSlice};
use gix_object::tree::EntryKind;
use gix_diff::blob::{
pipeline, platform,
platform::{prepare_diff, prepare_diff::Operation},
Algorithm, Platform, ResourceKind,
};
use gix_object::{
bstr::{BString, ByteSlice},
tree::EntryKind,
};
use gix_worktree::stack::state::attributes;

use crate::{blob::pipeline::convert_to_diffable::default_options, hex_to_id, util::ObjectDb};

#[test]
fn resources_of_worktree_and_odb_and_check_link() -> crate::Result {
let mut platform = new_platform(
Expand Down
Loading

0 comments on commit 51c7abc

Please sign in to comment.