Skip to content

Commit

Permalink
make fmt (#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Apr 12, 2022
1 parent 04ca834 commit 50ff7aa
Show file tree
Hide file tree
Showing 15 changed files with 64 additions and 57 deletions.
3 changes: 2 additions & 1 deletion git-actor/src/signature/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
mod _ref {
use crate::{signature::decode, Signature, SignatureRef};
use bstr::ByteSlice;

use crate::{signature::decode, Signature, SignatureRef};

impl<'a> SignatureRef<'a> {
/// Deserialize a signature from the given `data`.
pub fn from_bytes<E>(data: &'a [u8]) -> Result<SignatureRef<'a>, nom::Err<E>>
Expand Down
3 changes: 1 addition & 2 deletions git-attributes/tests/parse/ignore.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use bstr::BString;
use git_glob::pattern::Mode;
use git_glob::Pattern;
use git_glob::{pattern::Mode, Pattern};
use git_testtools::fixture_bytes;

#[test]
Expand Down
2 changes: 1 addition & 1 deletion git-config/src/values.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! Rust containers for valid `git-config` types.

use bstr::BStr;
use std::{borrow::Cow, convert::TryFrom, fmt::Display, str::FromStr};

use bstr::BStr;
use quick_error::quick_error;
#[cfg(feature = "serde")]
use serde::{Serialize, Serializer};
Expand Down
58 changes: 31 additions & 27 deletions git-config/tests/integration_tests/git_config_integration_tests.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#[cfg(test)]
mod mutable_value {
use git_config::file::GitConfig;
use std::convert::TryFrom;

use git_config::file::GitConfig;

fn init_config() -> GitConfig<'static> {
GitConfig::try_from(
r#"[core]
Expand Down Expand Up @@ -137,9 +138,10 @@ b

#[cfg(test)]
mod mutable_multi_value {
use git_config::file::GitConfig;
use std::{borrow::Cow, convert::TryFrom};

use git_config::file::GitConfig;

fn init_config() -> GitConfig<'static> {
GitConfig::try_from(
r#"[core]
Expand Down Expand Up @@ -277,13 +279,12 @@ a"#,

#[cfg(test)]
mod from_paths_tests {
use std::borrow::Cow;
use std::path::Path;
use std::{fs, io};
use std::{borrow::Cow, fs, io, path::Path};

use git_config::file::from_paths::Error;
use git_config::file::{from_paths, GitConfig};
use git_config::parser::ParserOrIoError;
use git_config::{
file::{from_paths, from_paths::Error, GitConfig},
parser::ParserOrIoError,
};
use tempfile::tempdir;

/// Escapes backslash when writing a path as string so that it is a valid windows path
Expand Down Expand Up @@ -749,12 +750,9 @@ mod from_paths_tests {

#[cfg(test)]
mod from_env_tests {
use std::borrow::Cow;
use std::{env, fs};
use std::{borrow::Cow, env, fs};

use git_config::file::from_paths::Options;
use git_config::file::GitConfig;
use git_config::file::{from_env, from_paths};
use git_config::file::{from_env, from_paths, from_paths::Options, GitConfig};
use serial_test::serial;
use tempfile::tempdir;

Expand Down Expand Up @@ -892,10 +890,12 @@ mod from_env_tests {

#[cfg(test)]
mod get_raw_value {
use git_config::file::{GitConfig, GitConfigError};
use git_config::parser::SectionHeaderName;
use std::borrow::Cow;
use std::convert::TryFrom;
use std::{borrow::Cow, convert::TryFrom};

use git_config::{
file::{GitConfig, GitConfigError},
parser::SectionHeaderName,
};

#[test]
fn single_section() {
Expand Down Expand Up @@ -956,11 +956,12 @@ mod get_raw_value {

#[cfg(test)]
mod get_value {
use git_config::file::GitConfig;
use git_config::values::{Boolean, Bytes, TrueVariant};
use std::borrow::Cow;
use std::convert::TryFrom;
use std::error::Error;
use std::{borrow::Cow, convert::TryFrom, error::Error};

use git_config::{
file::GitConfig,
values::{Boolean, Bytes, TrueVariant},
};

#[test]
fn single_section() -> Result<(), Box<dyn Error>> {
Expand Down Expand Up @@ -1005,10 +1006,12 @@ mod get_value {

#[cfg(test)]
mod get_raw_multi_value {
use git_config::file::{GitConfig, GitConfigError};
use git_config::parser::SectionHeaderName;
use std::borrow::Cow;
use std::convert::TryFrom;
use std::{borrow::Cow, convert::TryFrom};

use git_config::{
file::{GitConfig, GitConfigError},
parser::SectionHeaderName,
};

#[test]
fn single_value_is_identical_to_single_value_query() {
Expand Down Expand Up @@ -1089,9 +1092,10 @@ mod get_raw_multi_value {

#[cfg(test)]
mod display {
use git_config::file::GitConfig;
use std::convert::TryFrom;

use git_config::file::GitConfig;

#[test]
fn can_reconstruct_empty_config() {
let config = r#"
Expand Down
3 changes: 2 additions & 1 deletion git-odb/tests/odb/store/compound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ fn db() -> git_odb::Handle {
}

mod locate {
use crate::{hex_to_id, odb::store::compound::db};
use git_odb::Find;

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

fn can_locate(db: &git_odb::Handle, hex_id: &str) {
let mut buf = vec![];
assert!(db
Expand Down
2 changes: 1 addition & 1 deletion git-odb/tests/odb/store/dynamic.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use git_hash::ObjectId;
use std::process::Command;

use git_hash::ObjectId;
use git_odb::{store, Find, FindExt, Write};
use git_testtools::{fixture_path, hex_to_id};

Expand Down
3 changes: 2 additions & 1 deletion git-odb/tests/odb/store/linked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ mod locate {
}

mod init {
use crate::odb::{alternate::alternate, store::linked::db};
use git_hash::ObjectId;
use git_odb::Find;

use crate::odb::{alternate::alternate, store::linked::db};

#[test]
fn multiple_linked_repositories_via_alternates() -> crate::Result {
let tmp = git_testtools::tempfile::TempDir::new()?;
Expand Down
3 changes: 2 additions & 1 deletion git-ref/tests/fullname/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use git_ref::Category;
use std::convert::TryInto;

use git_ref::Category;

#[test]
fn file_name() {
let name: git_ref::FullName = "refs/heads/main".try_into().unwrap();
Expand Down
8 changes: 4 additions & 4 deletions git-repository/src/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ pub enum Error {

///
pub mod describe {
use crate::bstr::BStr;
use crate::ext::ObjectIdExt;
use crate::Repository;
use std::borrow::Cow;

use git_hash::ObjectId;
use git_odb::Find;
use std::borrow::Cow;

use crate::{bstr::BStr, ext::ObjectIdExt, Repository};

/// The result of [try_resolve()][Platform::try_resolve()].
pub struct Resolution<'repo> {
Expand Down
13 changes: 8 additions & 5 deletions git-repository/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@ pub(crate) struct Cache {
}

mod cache {
use std::{borrow::Cow, convert::TryFrom};

use git_config::{
file::GitConfig,
values,
values::{Boolean, Integer},
};

use super::{Cache, Error};
use crate::bstr::ByteSlice;
use git_config::file::GitConfig;
use git_config::values;
use git_config::values::{Boolean, Integer};
use std::borrow::Cow;
use std::convert::TryFrom;

impl Cache {
pub fn new(git_dir: &std::path::Path) -> Result<Self, Error> {
Expand Down
4 changes: 2 additions & 2 deletions git-repository/src/object/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ mod error {
}
}

use crate::id::Ancestors;

pub use error::Error;

use crate::id::Ancestors;

impl<'repo> Commit<'repo> {
/// Create an owned instance of this object, copying our data in the process.
pub fn detached(&self) -> DetachedObject {
Expand Down
3 changes: 1 addition & 2 deletions git-repository/src/object/tag.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::ext::ObjectIdExt;
use crate::Tag;
use crate::{ext::ObjectIdExt, Tag};

impl<'repo> Tag<'repo> {
/// Decode this tag and return the id of its target.
Expand Down
12 changes: 5 additions & 7 deletions git-revision/src/describe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,21 +143,19 @@ where
}

pub(crate) mod function {
use super::Error;
use hash_hasher::HashBuildHasher;
use std::cmp::Ordering;
use std::collections::HashMap;
use std::{
borrow::Cow,
collections::{hash_map, VecDeque},
cmp::Ordering,
collections::{hash_map, HashMap, VecDeque},
iter::FromIterator,
};

use crate::describe::{Flags, Options, MAX_CANDIDATES};
use git_hash::oid;
use git_object::{bstr::BStr, CommitRefIter};
use hash_hasher::HashBuildHasher;

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

/// 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 gitoxide-core/src/repository/commit.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::path::PathBuf;

use anyhow::{Context, Result};
use git_repository as git;
use std::path::PathBuf;

pub fn describe(
repo: impl Into<PathBuf>,
Expand Down
1 change: 0 additions & 1 deletion src/plumbing/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use std::{

use anyhow::Result;
use clap::Parser;

use gitoxide_core as core;
use gitoxide_core::pack::verify;

Expand Down

0 comments on commit 50ff7aa

Please sign in to comment.