Skip to content

Commit 7cf3545

Browse files
committed
make fmt
1 parent d79b506 commit 7cf3545

File tree

54 files changed

+209
-161
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+209
-161
lines changed

experiments/object-access/src/main.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
use std::{path::Path, sync::Arc, time::Instant};
22

33
use anyhow::anyhow;
4-
use git_repository::ThreadSafeRepository;
5-
use git_repository::{hash::ObjectId, odb, threading::OwnShared};
4+
use git_repository::{hash::ObjectId, odb, threading::OwnShared, ThreadSafeRepository};
65

76
use crate::odb::Cache;
87

git-attributes/src/parse/attribute.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use bstr::{BStr, BString, ByteSlice};
21
use std::borrow::Cow;
32

3+
use bstr::{BStr, BString, ByteSlice};
4+
45
#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)]
56
#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]
67
pub enum Kind {

git-attributes/src/parse/ignore.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use crate::ignore;
21
use bstr::{BString, ByteSlice};
32

3+
use crate::ignore;
4+
45
pub struct Lines<'a> {
56
lines: bstr::Lines<'a>,
67
line_no: usize,

git-attributes/tests/parse/attribute.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use bstr::{BStr, ByteSlice};
2-
use git_attributes::ignore::pattern::Mode;
3-
use git_attributes::{parse, State};
2+
use git_attributes::{ignore::pattern::Mode, parse, State};
43
use git_testtools::fixture_bytes;
54

65
#[test]

git-config/src/file/git_config.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,12 @@ pub struct GitConfig<'event> {
119119
}
120120

121121
pub mod from_paths {
122-
use crate::parser;
123-
use crate::values::path::interpolate;
124-
use quick_error::quick_error;
125122
use std::borrow::Cow;
126123

124+
use quick_error::quick_error;
125+
126+
use crate::{parser, values::path::interpolate};
127+
127128
quick_error! {
128129
#[derive(Debug)]
129130
/// The error returned by [`GitConfig::from_paths()`][super::GitConfig::from_paths()] and [`GitConfig::from_env_paths()`][super::GitConfig::from_env_paths()].
@@ -174,9 +175,10 @@ pub mod from_paths {
174175
}
175176

176177
pub mod from_env {
178+
use quick_error::quick_error;
179+
177180
use super::from_paths;
178181
use crate::values::path::interpolate;
179-
use quick_error::quick_error;
180182

181183
quick_error! {
182184
#[derive(Debug)]
@@ -1796,11 +1798,10 @@ a"#,
17961798
mod from_paths_tests {
17971799
use std::{fs, io};
17981800

1799-
use crate::file::from_paths;
18001801
use tempfile::tempdir;
18011802

18021803
use super::{from_paths::Error, Cow, GitConfig};
1803-
use crate::parser::ParserOrIoError;
1804+
use crate::{file::from_paths, parser::ParserOrIoError};
18041805

18051806
/// Escapes backslash when writing a path as string so that it is a valid windows path
18061807
fn escape_backslashes(path: &std::path::Path) -> String {
@@ -2261,12 +2262,11 @@ mod from_paths_tests {
22612262
mod from_env_tests {
22622263
use std::{env, fs};
22632264

2264-
use crate::file::from_paths;
2265-
use crate::file::from_paths::Options;
22662265
use serial_test::serial;
22672266
use tempfile::tempdir;
22682267

22692268
use super::{from_env, Cow, GitConfig};
2269+
use crate::file::{from_paths, from_paths::Options};
22702270

22712271
struct Env<'a> {
22722272
altered_vars: Vec<&'a str>,

git-config/src/fs.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ use std::{
77
path::{Path, PathBuf},
88
};
99

10-
use crate::file::from_paths;
11-
use crate::file::{GitConfig, GitConfigError};
10+
use crate::file::{from_paths, GitConfig, GitConfigError};
1211

1312
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
1413
pub enum ConfigSource {

git-config/src/values.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//! Rust containers for valid `git-config` types.
22
3-
use quick_error::quick_error;
43
use std::{borrow::Cow, convert::TryFrom, fmt::Display, str::FromStr};
54

5+
use quick_error::quick_error;
66
#[cfg(feature = "serde")]
77
use serde::{Serialize, Serializer};
88

@@ -288,8 +288,7 @@ pub mod path {
288288
mod interpolate_tests {
289289
use std::borrow::Cow;
290290

291-
use crate::values::b;
292-
use crate::values::{path::interpolate::Error, Path};
291+
use crate::values::{b, path::interpolate::Error, Path};
293292

294293
#[test]
295294
fn no_interpolation_for_paths_without_tilde_or_prefix() {
@@ -1383,9 +1382,10 @@ mod boolean {
13831382

13841383
#[cfg(test)]
13851384
mod integer {
1385+
use std::convert::TryFrom;
1386+
13861387
use super::{Integer, IntegerSuffix};
13871388
use crate::values::b;
1388-
use std::convert::TryFrom;
13891389

13901390
#[test]
13911391
fn from_str_no_suffix() {

git-features/src/parallel/in_parallel.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use crate::parallel::{num_threads, Reduce};
21
use std::sync::atomic::{AtomicBool, Ordering};
32

3+
use crate::parallel::{num_threads, Reduce};
4+
45
/// Runs `left` and `right` in parallel, returning their output when both are done.
56
pub fn join<O1: Send, O2: Send>(left: impl FnOnce() -> O1 + Send, right: impl FnOnce() -> O2 + Send) -> (O1, O2) {
67
crossbeam_utils::thread::scope(|s| {

git-hash/src/owned/prefix.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
use crate::{oid, ObjectId, Prefix};
2-
use quick_error::quick_error;
31
use std::cmp::Ordering;
42

3+
use quick_error::quick_error;
4+
5+
use crate::{oid, ObjectId, Prefix};
6+
57
quick_error! {
68
/// The error returned by [Prefix::try_from_id()][super::Prefix::try_from_id()].
79
#[derive(Debug)]

git-hash/tests/oid/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
mod prefix {
22
mod cmp_oid {
3-
use git_testtools::hex_to_id;
43
use std::cmp::Ordering;
54

5+
use git_testtools::hex_to_id;
6+
67
#[test]
78
fn it_detects_inequality() {
89
let prefix = git_hash::Prefix::new(hex_to_id("b920bbb055e1efb9080592a409d3975738b6efb3"), 7).unwrap();
@@ -30,9 +31,10 @@ mod prefix {
3031
}
3132
}
3233
mod new {
34+
use std::cmp::Ordering;
35+
3336
use git_hash::{Kind, ObjectId};
3437
use git_testtools::hex_to_id;
35-
use std::cmp::Ordering;
3638

3739
#[test]
3840
fn various_valid_inputs() {

git-mailmap/src/entry.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use crate::Entry;
21
use bstr::BStr;
32

3+
use crate::Entry;
4+
45
/// Acccess
56
impl<'a> Entry<'a> {
67
/// The name to map to.

git-mailmap/src/parse.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ mod error {
1717
}
1818
}
1919

20-
use crate::Entry;
2120
use bstr::{BStr, ByteSlice};
2221
pub use error::Error;
2322

23+
use crate::Entry;
24+
2425
/// An iterator to parse mailmap lines on-demand.
2526
pub struct Lines<'a> {
2627
lines: bstr::Lines<'a>,

git-mailmap/src/snapshot.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
use crate::Snapshot;
1+
use std::{cmp::Ordering, ops::Deref};
2+
23
use bstr::{BStr, BString, ByteSlice};
34
use git_actor::SignatureRef;
4-
use std::cmp::Ordering;
5-
use std::ops::Deref;
5+
6+
use crate::Snapshot;
67

78
/// A resolved signature with borrowed fields for a mapped `name` and/or `email`.
89
pub struct ResolvedSignature<'a> {
@@ -311,9 +312,10 @@ fn enriched_signature(
311312

312313
#[cfg(test)]
313314
mod encoded_string {
314-
use crate::snapshot::{EncodedString, EncodedStringRef};
315315
use std::cmp::Ordering;
316316

317+
use crate::snapshot::{EncodedString, EncodedStringRef};
318+
317319
#[test]
318320
fn basic_ascii_case_folding() {
319321
assert_eq!(

git-odb/src/cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use std::rc::Rc;
21
use std::{
32
cell::RefCell,
43
ops::{Deref, DerefMut},
4+
rc::Rc,
55
sync::Arc,
66
};
77

git-odb/src/store_impls/dynamic/find.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,13 @@ mod error {
8484
}
8585
}
8686
}
87-
use crate::find::{PotentialPrefix, PrefixLookupResult};
88-
use crate::Find;
8987
pub use error::Error;
9088

91-
use crate::store::types::PackId;
89+
use crate::{
90+
find::{PotentialPrefix, PrefixLookupResult},
91+
store::types::PackId,
92+
Find,
93+
};
9294

9395
impl<S> super::Handle<S>
9496
where

git-odb/src/store_impls/dynamic/handle.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
use std::convert::{TryFrom, TryInto};
2-
use std::rc::Rc;
31
use std::{
42
cell::RefCell,
3+
convert::{TryFrom, TryInto},
54
ops::Deref,
5+
rc::Rc,
66
sync::{atomic::Ordering, Arc},
77
};
88

git-odb/src/store_impls/dynamic/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,10 @@ mod access;
7979

8080
///
8181
pub mod structure {
82-
use crate::store::load_index;
83-
use crate::types::IndexAndPacks;
84-
use crate::Store;
8582
use std::path::PathBuf;
8683

84+
use crate::{store::load_index, types::IndexAndPacks, Store};
85+
8786
/// A record of a structural element of an object database.
8887
#[derive(Debug, Clone, PartialEq, Eq)]
8988
#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))]

git-odb/src/store_impls/loose/find.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use std::cmp::Ordering;
2-
use std::{fs, io::Read, path::PathBuf};
1+
use std::{cmp::Ordering, fs, io::Read, path::PathBuf};
32

43
use git_features::zlib;
54

git-odb/tests/odb/store/dynamic.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,10 +404,12 @@ fn assert_all_indices_loaded(handle: &git_odb::Handle, num_refreshes: usize, ope
404404
}
405405

406406
mod disambiguate_prefix {
407-
use crate::store::dynamic::{assert_all_indices_loaded, db_with_all_object_sources};
407+
use std::cmp::Ordering;
408+
408409
use git_odb::find::PotentialPrefix;
409410
use git_testtools::hex_to_id;
410-
use std::cmp::Ordering;
411+
412+
use crate::store::dynamic::{assert_all_indices_loaded, db_with_all_object_sources};
411413

412414
#[test]
413415
fn unambiguous_hex_lengths_yield_prefixes_of_exactly_the_given_length() {
@@ -483,9 +485,10 @@ mod disambiguate_prefix {
483485
}
484486

485487
mod lookup_prefix {
486-
use crate::store::dynamic::{assert_all_indices_loaded, db_with_all_object_sources};
487488
use git_testtools::hex_to_id;
488489

490+
use crate::store::dynamic::{assert_all_indices_loaded, db_with_all_object_sources};
491+
489492
#[test]
490493
fn returns_none_for_prefixes_without_any_match() {
491494
let (handle, _tmp) = db_with_all_object_sources().unwrap();

git-odb/tests/odb/store/loose.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,10 @@ mod contains {
8585
}
8686

8787
mod lookup_prefix {
88-
use crate::store::loose::ldb;
8988
use git_testtools::{fixture_path, hex_to_id};
9089

90+
use crate::store::loose::ldb;
91+
9192
#[test]
9293
fn returns_none_for_prefixes_without_any_match() {
9394
let store = ldb();

git-pack/src/index/access.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
use std::cmp::Ordering;
2-
use std::mem::size_of;
1+
use std::{cmp::Ordering, mem::size_of};
32

4-
use crate::index::PrefixLookupResult;
53
use crate::{
64
data,
7-
index::{self, EntryIndex, FAN_LEN},
5+
index::{self, EntryIndex, PrefixLookupResult, FAN_LEN},
86
};
97

108
const N32_SIZE: usize = size_of::<u32>();

git-pack/src/multi_index/access.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
use std::cmp::Ordering;
2-
use std::path::{Path, PathBuf};
1+
use std::{
2+
cmp::Ordering,
3+
path::{Path, PathBuf},
4+
};
35

4-
use crate::index::PrefixLookupResult;
56
use crate::{
67
data,
8+
index::PrefixLookupResult,
79
multi_index::{EntryIndex, File, PackIndex, Version},
810
};
911

git-pack/tests/pack/index.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,15 @@ mod version {
9595

9696
use git_features::progress;
9797
use git_odb::pack;
98-
use git_pack::data::{input, EntryRange};
99-
use git_pack::index;
98+
use git_pack::{
99+
data::{input, EntryRange},
100+
index,
101+
};
100102

101-
use crate::pack::INDEX_V2;
102-
use crate::{fixture_path, pack::V2_PACKS_AND_INDICES};
103+
use crate::{
104+
fixture_path,
105+
pack::{INDEX_V2, V2_PACKS_AND_INDICES},
106+
};
103107

104108
#[test]
105109
fn write_to_stream() -> Result<(), Box<dyn std::error::Error>> {

git-pack/tests/pack/multi_index/access.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
use super::multi_index;
2-
use git_testtools::hex_to_id;
31
use std::path::PathBuf;
42

3+
use git_testtools::hex_to_id;
4+
5+
use super::multi_index;
6+
57
#[test]
68
fn lookup_with_ambiguity() {
79
let (file, _path) = multi_index();

git-repository/src/head.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,10 @@ pub mod peel {
120120
PeelReference(#[from] reference::peel::Error),
121121
}
122122
}
123-
use crate::head::Kind;
124123
pub use error::Error;
125124

125+
use crate::head::Kind;
126+
126127
mod peel_to_commit {
127128
use crate::object;
128129

0 commit comments

Comments
 (0)