Skip to content

Commit

Permalink
make fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Jul 23, 2022
1 parent 4e7b343 commit 47724c0
Show file tree
Hide file tree
Showing 48 changed files with 182 additions and 150 deletions.
12 changes: 6 additions & 6 deletions etc/check-package-size.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ echo "in root: gitoxide CLI"
(enter git-pathspec && indent cargo diet -n --package-size-limit 5KB)
(enter git-path && indent cargo diet -n --package-size-limit 15KB)
(enter git-attributes && indent cargo diet -n --package-size-limit 15KB)
(enter git-discover && indent cargo diet -n --package-size-limit 15KB)
(enter git-discover && indent cargo diet -n --package-size-limit 20KB)
(enter git-index && indent cargo diet -n --package-size-limit 30KB)
(enter git-worktree && indent cargo diet -n --package-size-limit 30KB)
(enter git-quote && indent cargo diet -n --package-size-limit 5KB)
(enter git-revision && indent cargo diet -n --package-size-limit 20KB)
(enter git-revision && indent cargo diet -n --package-size-limit 25KB)
(enter git-bitmap && indent cargo diet -n --package-size-limit 5KB)
(enter git-tempfile && indent cargo diet -n --package-size-limit 25KB)
(enter git-lock && indent cargo diet -n --package-size-limit 15KB)
(enter git-config && indent cargo diet -n --package-size-limit 90KB)
(enter git-config && indent cargo diet -n --package-size-limit 110KB)
(enter git-hash && indent cargo diet -n --package-size-limit 20KB)
(enter git-chunk && indent cargo diet -n --package-size-limit 10KB)
(enter git-rebase && indent cargo diet -n --package-size-limit 5KB)
Expand All @@ -45,13 +45,13 @@ echo "in root: gitoxide CLI"
(enter git-note && indent cargo diet -n --package-size-limit 5KB)
(enter git-sec && indent cargo diet -n --package-size-limit 10KB)
(enter git-tix && indent cargo diet -n --package-size-limit 5KB)
(enter git-credentials && indent cargo diet -n --package-size-limit 5KB)
(enter git-credentials && indent cargo diet -n --package-size-limit 10KB)
(enter git-object && indent cargo diet -n --package-size-limit 25KB)
(enter git-commitgraph && indent cargo diet -n --package-size-limit 25KB)
(enter git-pack && indent cargo diet -n --package-size-limit 115KB)
(enter git-odb && indent cargo diet -n --package-size-limit 120KB)
(enter git-protocol && indent cargo diet -n --package-size-limit 50KB)
(enter git-packetline && indent cargo diet -n --package-size-limit 35KB)
(enter git-repository && indent cargo diet -n --package-size-limit 110KB)
(enter git-repository && indent cargo diet -n --package-size-limit 120KB)
(enter git-transport && indent cargo diet -n --package-size-limit 50KB)
(enter gitoxide-core && indent cargo diet -n --package-size-limit 70KB)
(enter gitoxide-core && indent cargo diet -n --package-size-limit 80KB)
3 changes: 1 addition & 2 deletions git-config/src/file/access/comfort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ use std::{borrow::Cow, convert::TryFrom};

use bstr::BStr;

use crate::file::MetadataFilter;
use crate::{value, File};
use crate::{file::MetadataFilter, value, File};

/// Comfortable API for accessing values
impl<'event> File<'event> {
Expand Down
10 changes: 4 additions & 6 deletions git-config/src/file/access/mutate.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
use git_features::threading::OwnShared;
use std::borrow::Cow;

use crate::file::write::ends_with_newline;
use crate::file::{MetadataFilter, SectionId};
use crate::parse::{Event, FrontMatterEvents};
use git_features::threading::OwnShared;

use crate::{
file::{self, rename_section, SectionMut},
file::{self, rename_section, write::ends_with_newline, MetadataFilter, SectionId, SectionMut},
lookup,
parse::section,
parse::{section, Event, FrontMatterEvents},
File,
};

Expand Down
3 changes: 1 addition & 2 deletions git-config/src/file/access/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ use std::{borrow::Cow, collections::HashMap};
use bstr::BStr;
use smallvec::ToSmallVec;

use crate::file::MetadataFilter;
use crate::{
file::{mutable::multi_value::EntryData, Index, MultiValueMut, Size, ValueMut},
file::{mutable::multi_value::EntryData, Index, MetadataFilter, MultiValueMut, Size, ValueMut},
lookup,
parse::{section, Event},
File,
Expand Down
17 changes: 11 additions & 6 deletions git-config/src/file/access/read_only.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
use std::iter::FromIterator;
use std::{borrow::Cow, convert::TryFrom};
use std::{borrow::Cow, convert::TryFrom, iter::FromIterator};

use bstr::BStr;
use git_features::threading::OwnShared;
use smallvec::SmallVec;

use crate::file::write::{extract_newline, platform_newline};
use crate::file::{Metadata, MetadataFilter};
use crate::parse::Event;
use crate::{file, lookup, File};
use crate::{
file,
file::{
write::{extract_newline, platform_newline},
Metadata, MetadataFilter,
},
lookup,
parse::Event,
File,
};

/// Read-only low-level access methods, as it requires generics for converting into
/// custom values defined in this crate like [`Integer`][crate::Integer] and
Expand Down
14 changes: 8 additions & 6 deletions git-config/src/file/impls.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
use std::borrow::Cow;
use std::{convert::TryFrom, fmt::Display, str::FromStr};
use std::{borrow::Cow, convert::TryFrom, fmt::Display, str::FromStr};

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

use crate::file::Metadata;
use crate::parse::{section, Event};
use crate::value::normalize;
use crate::{parse, File};
use crate::{
file::Metadata,
parse,
parse::{section, Event},
value::normalize,
File,
};

impl FromStr for File<'static> {
type Err = parse::Error;
Expand Down
7 changes: 5 additions & 2 deletions git-config/src/file/includes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ use bstr::{BStr, BString, ByteSlice, ByteVec};
use git_features::threading::OwnShared;
use git_ref::Category;

use crate::file::{includes, init, Metadata, SectionId};
use crate::{file, path, File};
use crate::{
file,
file::{includes, init, Metadata, SectionId},
path, File,
};

impl File<'static> {
/// Traverse all `include` and `includeIf` directives found in this instance and follow them, loading the
Expand Down
3 changes: 1 addition & 2 deletions git-config/src/file/includes/types.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::parse;
use crate::path::interpolate;
use crate::{parse, path::interpolate};

/// The error returned when following includes.
#[derive(Debug, thiserror::Error)]
Expand Down
7 changes: 5 additions & 2 deletions git-config/src/file/init/comfort.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
use crate::file::{init, Metadata};
use crate::{path, source, File, Source};
use std::path::PathBuf;

use crate::{
file::{init, Metadata},
path, source, File, Source,
};

/// Easy-instantiation of typical non-repository git configuration files with all configuration defaulting to typical values.
///
/// ### Limitations
Expand Down
6 changes: 2 additions & 4 deletions git-config/src/file/init/from_env.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use std::borrow::Cow;
use std::convert::TryFrom;
use std::{borrow::Cow, convert::TryFrom};

use crate::file::init;
use crate::{file, parse, parse::section, path::interpolate, File};
use crate::{file, file::init, parse, parse::section, path::interpolate, File};

/// Represents the errors that may occur when calling [`File::from_env()`].
#[derive(Debug, thiserror::Error)]
Expand Down
8 changes: 5 additions & 3 deletions git-config/src/file/init/from_paths.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use crate::file::init::Options;
use crate::file::{init, Metadata};
use crate::File;
use std::collections::BTreeSet;

use crate::{
file::{init, init::Options, Metadata},
File,
};

/// The error returned by [`File::from_paths_metadata()`] and [`File::from_path_no_includes()`].
#[derive(Debug, thiserror::Error)]
#[allow(missing_docs)]
Expand Down
7 changes: 5 additions & 2 deletions git-config/src/file/init/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
use crate::file::{includes, section, Metadata};
use crate::{parse, File};
use git_features::threading::OwnShared;

use crate::{
file::{includes, section, Metadata},
parse, File,
};

mod types;
pub use types::{Error, Options};

Expand Down
5 changes: 1 addition & 4 deletions git-config/src/file/init/types.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
use crate::file::init;
use crate::parse;
use crate::parse::Event;
use crate::path::interpolate;
use crate::{file::init, parse, parse::Event, path::interpolate};

/// The error returned by [`File::from_bytes_no_includes()`][crate::File::from_bytes_no_includes()].
#[derive(Debug, thiserror::Error)]
Expand Down
3 changes: 1 addition & 2 deletions git-config/src/file/meta.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::path::PathBuf;

use crate::file::Metadata;
use crate::{file, Source};
use crate::{file, file::Metadata, Source};

/// Instantiation
impl Metadata {
Expand Down
2 changes: 1 addition & 1 deletion git-config/src/file/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//! A high level wrapper around a single or multiple `git-config` file, for reading and mutation.
use std::path::PathBuf;
use std::{
borrow::Cow,
collections::HashMap,
ops::{Add, AddAssign},
path::PathBuf,
};

use bstr::BStr;
Expand Down
21 changes: 13 additions & 8 deletions git-config/src/file/mutable/multi_value.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
use crate::file::mutable::{escape_value, Whitespace};
use crate::file::{self, Section, SectionId};
use crate::lookup;
use crate::parse::{section, Event};
use crate::value::{normalize_bstr, normalize_bstring};
use std::{borrow::Cow, collections::HashMap, ops::DerefMut};

use bstr::{BStr, BString, ByteVec};
use std::borrow::Cow;
use std::collections::HashMap;
use std::ops::DerefMut;

use crate::{
file::{
self,
mutable::{escape_value, Whitespace},
Section, SectionId,
},
lookup,
parse::{section, Event},
value::{normalize_bstr, normalize_bstring},
};

/// Internal data structure for [`MutableMultiValue`]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
Expand Down
4 changes: 2 additions & 2 deletions git-config/src/file/mutable/section.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use std::{
use bstr::{BStr, BString, ByteSlice, ByteVec};
use smallvec::SmallVec;

use crate::file::{self, Section};
use crate::{
file::{
self,
mutable::{escape_value, Whitespace},
Index, Size,
Index, Section, Size,
},
lookup, parse,
parse::{section::Key, Event},
Expand Down
13 changes: 7 additions & 6 deletions git-config/src/file/section/body.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use crate::parse::section::Key;
use crate::parse::Event;
use crate::value::{normalize, normalize_bstr, normalize_bstring};
use std::{borrow::Cow, iter::FusedIterator, ops::Range};

use bstr::{BStr, BString, ByteVec};
use std::borrow::Cow;
use std::iter::FusedIterator;
use std::ops::Range;

use crate::{
parse::{section::Key, Event},
value::{normalize, normalize_bstr, normalize_bstring},
};

/// A opaque type that represents a section body.
#[derive(PartialEq, Eq, Hash, PartialOrd, Ord, Clone, Debug, Default)]
Expand Down
17 changes: 11 additions & 6 deletions git-config/src/file/section/mod.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
use crate::file::{Metadata, Section, SectionMut};
use crate::parse::{section, Event};
use crate::{file, parse};
use std::{borrow::Cow, ops::Deref};

use bstr::{BString, ByteSlice};
use smallvec::SmallVec;
use std::borrow::Cow;
use std::ops::Deref;

use crate::{
file,
file::{Metadata, Section, SectionMut},
parse,
parse::{section, Event},
};

pub(crate) mod body;
use crate::file::write::{extract_newline, platform_newline};
pub use body::{Body, BodyIter};
use git_features::threading::OwnShared;

use crate::file::write::{extract_newline, platform_newline};

impl<'a> Deref for Section<'a> {
type Target = Body<'a>;

Expand Down
9 changes: 6 additions & 3 deletions git-config/src/file/tests.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
use crate::file::{self, Section, SectionId};
use crate::parse::section;
use std::collections::HashMap;

use crate::{
file::{self, Section, SectionId},
parse::section,
};

mod try_from {
use super::{bodies, headers};
use std::{borrow::Cow, collections::HashMap, convert::TryFrom};

use super::{bodies, headers};
use crate::{
file::{self, SectionBodyIdsLut, SectionId},
parse::{
Expand Down
3 changes: 1 addition & 2 deletions git-config/src/file/utils.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::cmp::Ordering;
use std::collections::HashMap;
use std::{cmp::Ordering, collections::HashMap};

use bstr::BStr;

Expand Down
3 changes: 1 addition & 2 deletions git-config/src/file/write.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use bstr::{BStr, BString, ByteSlice};

use crate::parse::Event;
use crate::File;
use crate::{parse::Event, File};

impl File<'_> {
/// Serialize this type into a `BString` for convenience.
Expand Down
9 changes: 4 additions & 5 deletions git-config/src/parse/nom/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,13 @@ mod config_name {
}

mod section {
use crate::parse::tests::util::newline_custom_event;
use crate::parse::{
error::ParseNode,
section,
tests::util::{
comment_event, fully_consumed, name_event, newline_event, section_header as parsed_section_header,
value_done_event, value_event, value_not_done_event, whitespace_event,
comment_event, fully_consumed, name_event, newline_custom_event, newline_event,
section_header as parsed_section_header, value_done_event, value_event, value_not_done_event,
whitespace_event,
},
Event, Section,
};
Expand Down Expand Up @@ -562,10 +562,9 @@ mod section {
mod value_continuation {
use bstr::ByteSlice;

use crate::parse::tests::util::newline_custom_event;
use crate::parse::{
section,
tests::util::{into_events, newline_event, value_done_event, value_not_done_event},
tests::util::{into_events, newline_custom_event, newline_event, value_done_event, value_not_done_event},
};

pub fn value_impl<'a>(i: &'a [u8], events: &mut section::Events<'a>) -> nom::IResult<&'a [u8], ()> {
Expand Down
9 changes: 6 additions & 3 deletions git-config/src/source.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
use std::{
borrow::Cow,
ffi::OsString,
path::{Path, PathBuf},
};

use crate::Source;
use std::borrow::Cow;
use std::ffi::OsString;
use std::path::{Path, PathBuf};

/// The category of a [`Source`], in order of ascending precedence.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
Expand Down
6 changes: 3 additions & 3 deletions git-config/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use git_features::threading::OwnShared;
use std::collections::{HashMap, VecDeque};

use crate::file::Metadata;
use git_features::threading::OwnShared;

use crate::{
color, file,
file::{SectionBodyIdsLut, SectionId},
file::{Metadata, SectionBodyIdsLut, SectionId},
integer,
parse::section,
};
Expand Down
Loading

0 comments on commit 47724c0

Please sign in to comment.