Skip to content

Commit

Permalink
make fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed May 2, 2022
1 parent 98da8ba commit 251b6df
Show file tree
Hide file tree
Showing 32 changed files with 96 additions and 68 deletions.
4 changes: 2 additions & 2 deletions git-attributes/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#![forbid(unsafe_code)]
#![deny(rust_2018_idioms)]

use bstr::{BStr, BString};
use compact_str::CompactStr;
use std::path::PathBuf;

use bstr::{BStr, BString};
use compact_str::CompactStr;
pub use git_glob as glob;

/// The state an attribute can be in, referencing the value.
Expand Down
12 changes: 8 additions & 4 deletions git-attributes/src/match_group.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
use crate::{Assignment, MatchGroup, PatternList, PatternMapping, State, StateRef};
use std::{
ffi::OsString,
io::Read,
path::{Path, PathBuf},
};

use bstr::{BStr, BString, ByteSlice, ByteVec};
use std::ffi::OsString;
use std::io::Read;
use std::path::{Path, PathBuf};

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

impl<'a> From<StateRef<'a>> for State {
fn from(s: StateRef<'a>) -> Self {
Expand Down
3 changes: 2 additions & 1 deletion git-attributes/tests/match_group/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
mod ignore {
use std::io::Read;

use bstr::{BStr, ByteSlice};
use git_attributes::{Ignore, Match, MatchGroup};
use git_glob::pattern::Case;
use std::io::Read;

struct Expectations<'a> {
lines: bstr::Lines<'a>,
Expand Down
6 changes: 4 additions & 2 deletions git-credentials/src/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,10 @@ mod tests {
type Result = std::result::Result<(), Box<dyn std::error::Error>>;

mod encode_message {
use super::*;
use bstr::ByteSlice;

use super::*;

#[test]
fn from_url() -> super::Result {
let mut out = Vec::new();
Expand All @@ -193,9 +194,10 @@ mod tests {
}

mod invalid {
use super::*;
use std::io;

use super::*;

#[test]
fn contains_null() {
assert_eq!(
Expand Down
3 changes: 2 additions & 1 deletion git-glob/src/pattern.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::fmt;

use bitflags::bitflags;
use bstr::{BStr, ByteSlice};
use std::fmt;

use crate::{pattern, wildmatch, Pattern};

Expand Down
3 changes: 1 addition & 2 deletions git-glob/tests/pattern/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use git_glob::pattern::Mode;
use git_glob::Pattern;
use git_glob::{pattern::Mode, Pattern};

#[test]
fn display() {
Expand Down
2 changes: 1 addition & 1 deletion git-glob/tests/wildmatch/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use bstr::ByteSlice;
use std::{
fmt::{Debug, Display, Formatter},
panic::catch_unwind,
};

use bstr::ByteSlice;
use git_glob::{pattern::Case, wildmatch, Pattern};

#[test]
Expand Down
3 changes: 1 addition & 2 deletions git-lock/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@

use std::path::PathBuf;

use git_tempfile::handle::{Closed, Writable};

pub use git_tempfile as tempfile;
use git_tempfile::handle::{Closed, Writable};

const DOT_LOCK_SUFFIX: &str = ".lock";

Expand Down
3 changes: 2 additions & 1 deletion git-path/src/convert.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use bstr::{BStr, BString};
use std::{
borrow::Cow,
ffi::OsStr,
path::{Path, PathBuf},
};

use bstr::{BStr, BString};

#[derive(Debug)]
/// The error type returned by [`into_bstr()`] and others may suffer from failed conversions from or to bytes.
pub struct Utf8Error;
Expand Down
6 changes: 4 additions & 2 deletions git-path/src/spec.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use crate::Spec;
use bstr::{BStr, ByteSlice, ByteVec};
use std::ffi::OsStr;

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

use crate::Spec;

impl std::convert::TryFrom<&OsStr> for Spec {
type Error = crate::Utf8Error;

Expand Down
9 changes: 3 additions & 6 deletions git-repository/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::bstr::BString;
use crate::permission::EnvVarResourcePermission;
use crate::{bstr::BString, permission::EnvVarResourcePermission};

#[derive(Debug, thiserror::Error)]
pub enum Error {
Expand Down Expand Up @@ -47,17 +46,15 @@ pub(crate) struct Cache {
}

mod cache {
use std::convert::TryFrom;
use std::path::PathBuf;
use std::{convert::TryFrom, path::PathBuf};

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

use super::{Cache, Error};
use crate::bstr::ByteSlice;
use crate::permission::EnvVarResourcePermission;
use crate::{bstr::ByteSlice, permission::EnvVarResourcePermission};

impl Cache {
pub fn new(
Expand Down
9 changes: 5 additions & 4 deletions git-repository/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,7 @@ pub fn open(directory: impl Into<std::path::PathBuf>) -> Result<crate::Repositor

///
pub mod permission {
use git_sec::permission::Resource;
use git_sec::Access;
use git_sec::{permission::Resource, Access};

/// A permission to control access to the resource pointed to an environment variable.
pub type EnvVarResourcePermission = Access<Resource, git_sec::Permission>;
Expand Down Expand Up @@ -299,9 +298,10 @@ pub mod rev_parse {

///
pub mod init {
use crate::ThreadSafeRepository;
use std::path::Path;

use crate::ThreadSafeRepository;

/// The error returned by [`crate::init()`].
#[derive(Debug, thiserror::Error)]
#[allow(missing_docs)]
Expand Down Expand Up @@ -362,9 +362,10 @@ pub mod state {

///
pub mod discover {
use crate::{path, ThreadSafeRepository};
use std::path::Path;

use crate::{path, ThreadSafeRepository};

/// The error returned by [`crate::discover()`].
#[derive(Debug, thiserror::Error)]
#[allow(missing_docs)]
Expand Down
3 changes: 2 additions & 1 deletion git-repository/src/open.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use std::path::PathBuf;

use crate::Permissions;
use git_features::threading::OwnShared;
use git_sec::Trust;

use crate::Permissions;

/// A way to configure the usage of replacement objects, see `git replace`.
pub enum ReplacementObjects {
/// Allow replacement objects and configure the ref prefix the standard environment variable `GIT_REPLACE_REF_BASE`,
Expand Down
5 changes: 3 additions & 2 deletions git-repository/src/path/discover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@ impl Default for Options {
}

pub(crate) mod function {
use super::{Error, Options};
use git_sec::Trust;
use std::{
borrow::Cow,
path::{Component, Path},
};

use git_sec::Trust;

use super::{Error, Options};
use crate::path;

/// Find the location of the git repository directly in `directory` or in any of its parent directories and provide
Expand Down
4 changes: 2 additions & 2 deletions git-repository/src/path/mod.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::path::PathBuf;

use crate::{Kind, Path};

#[cfg(all(feature = "unstable", feature = "git-path"))]
pub use git_path::*;

use crate::{Kind, Path};

///
pub mod create;
///
Expand Down
4 changes: 2 additions & 2 deletions git-repository/src/repository/permissions.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use git_sec::{permission::Resource, Access, Trust};

use crate::permission::EnvVarResourcePermission;
use git_sec::permission::Resource;
use git_sec::{Access, Trust};

/// Permissions associated with various resources of a git repository
pub struct Permissions {
Expand Down
3 changes: 2 additions & 1 deletion git-repository/src/worktree.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use crate::Repository;
#[cfg(all(feature = "unstable", feature = "git-worktree"))]
pub use git_worktree::*;

use crate::Repository;

///
#[cfg(feature = "git-index")]
pub mod open_index {
Expand Down
3 changes: 2 additions & 1 deletion git-repository/tests/commit/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
mod describe {
use crate::named_repo;
use git_repository::commit::describe::SelectRef::{AllRefs, AllTags, AnnotatedTags};

use crate::named_repo;

#[test]
fn tags_are_sorted_by_date_and_lexigraphically() {
let repo = named_repo("make_commit_describe_multiple_tags.sh").unwrap();
Expand Down
3 changes: 2 additions & 1 deletion git-repository/tests/repository/state.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::{named_repo, Result};
use git_repository as git;

use crate::{named_repo, Result};

#[test]
fn apply_mailbox() -> Result {
let repo = named_repo("make_am_repo.sh")?;
Expand Down
11 changes: 7 additions & 4 deletions git-sec/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#![deny(unsafe_code, rust_2018_idioms, missing_docs)]
//! A shared trust model for `gitoxide` crates.

use std::fmt::{Debug, Display, Formatter};
use std::marker::PhantomData;
use std::ops::Deref;
use std::{
fmt::{Debug, Display, Formatter},
marker::PhantomData,
ops::Deref,
};

/// A way to specify how 'safe' we feel about a resource, typically about a git repository.
#[derive(Copy, Clone, Ord, PartialOrd, PartialEq, Eq, Debug, Hash)]
Expand Down Expand Up @@ -75,9 +77,10 @@ pub mod trust {

///
pub mod permission {
use crate::Access;
use std::fmt::{Debug, Display};

use crate::Access;

/// A marker trait to signal tags for permissions.
pub trait Tag: Debug + Clone {}

Expand Down
3 changes: 1 addition & 2 deletions git-transport/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ pub mod capabilities;
pub use capabilities::Capabilities;

mod non_io_types;
pub use non_io_types::{Error, MessageKind, WriteMode};

pub use git_sec::identity::Account;
pub use non_io_types::{Error, MessageKind, WriteMode};

///
#[cfg(any(feature = "blocking-client", feature = "async-client"))]
Expand Down
9 changes: 5 additions & 4 deletions git-worktree/src/fs/cache/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use super::Cache;
use crate::fs;
use crate::fs::PathOidMapping;
use std::path::{Path, PathBuf};

use bstr::{BStr, ByteSlice};
use git_hash::oid;
use std::path::{Path, PathBuf};

use super::Cache;
use crate::{fs, fs::PathOidMapping};

#[derive(Clone)]
pub enum State {
Expand Down
14 changes: 10 additions & 4 deletions git-worktree/src/fs/cache/platform.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
use crate::fs;
use crate::fs::cache::{Platform, State};
use crate::fs::PathOidMapping;
use std::path::Path;

use bstr::ByteSlice;
use git_hash::oid;
use std::path::Path;

use crate::{
fs,
fs::{
cache::{Platform, State},
PathOidMapping,
},
};

impl<'a, 'paths> Platform<'a, 'paths> {
/// The full path to `relative` will be returned for use on the file system.
Expand Down
7 changes: 4 additions & 3 deletions git-worktree/src/fs/cache/state.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use crate::fs::cache::State;
use crate::fs::PathOidMapping;
use std::path::Path;

use bstr::{BStr, BString, ByteSlice};
use git_glob::pattern::Case;
use git_hash::oid;
use std::path::Path;

use crate::fs::{cache::State, PathOidMapping};

type AttributeMatchGroup = git_attributes::MatchGroup<git_attributes::Attributes>;
type IgnoreMatchGroup = git_attributes::MatchGroup<git_attributes::Ignore>;
Expand Down
3 changes: 2 additions & 1 deletion git-worktree/src/fs/capabilities.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::fs::Capabilities;
use std::path::Path;

use crate::fs::Capabilities;

#[cfg(windows)]
impl Default for Capabilities {
fn default() -> Self {
Expand Down
3 changes: 2 additions & 1 deletion git-worktree/src/fs/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use bstr::BStr;
use std::path::PathBuf;

use bstr::BStr;

/// Common knowledge about the worktree that is needed across most interactions with the work tree
#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone, Copy)]
Expand Down
3 changes: 2 additions & 1 deletion git-worktree/src/fs/stack.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::fs::Stack;
use std::path::{Path, PathBuf};

use crate::fs::Stack;

impl Stack {
pub fn root(&self) -> &Path {
&self.root
Expand Down
5 changes: 2 additions & 3 deletions git-worktree/tests/worktree/fs/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,12 @@ mod create_directory {

#[allow(unused)]
mod ignore_and_attributes {
use bstr::{BStr, ByteSlice};
use std::path::Path;

use bstr::{BStr, ByteSlice};
use git_glob::pattern::Case;
use git_index::entry::Mode;
use git_odb::pack::bundle::write::Options;
use git_odb::FindExt;
use git_odb::{pack::bundle::write::Options, FindExt};
use git_testtools::hex_to_id;
use git_worktree::fs;
use tempfile::{tempdir, TempDir};
Expand Down
Loading

0 comments on commit 251b6df

Please sign in to comment.