Skip to content

Commit 535e967

Browse files
committed
make fmt
1 parent 5c05198 commit 535e967

File tree

110 files changed

+369
-287
lines changed

Some content is hidden

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

110 files changed

+369
-287
lines changed

cargo-smart-release/src/changelog/tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
mod repository_url {
2-
use crate::changelog::write::RepositoryUrl;
32
use git_repository as git;
43

4+
use crate::changelog::write::RepositoryUrl;
5+
56
#[test]
67
fn github_https_url() {
78
for input in [

git-command/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ pub struct Prepare {
1515
}
1616

1717
mod prepare {
18-
use crate::Prepare;
19-
use git_testtools::bstr::ByteSlice;
2018
use std::process::{Command, Stdio};
2119

20+
use git_testtools::bstr::ByteSlice;
21+
22+
use crate::Prepare;
23+
2224
/// Builder
2325
impl Prepare {
2426
/// If called, the command will not be executed directly, but with `sh`.

git-config-value/src/boolean.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use std::ffi::OsString;
2-
use std::{borrow::Cow, convert::TryFrom, fmt::Display};
1+
use std::{borrow::Cow, convert::TryFrom, ffi::OsString, fmt::Display};
32

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

git-config-value/tests/value/boolean.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
use crate::b;
2-
use git_config_value::Boolean;
31
use std::convert::TryFrom;
42

3+
use git_config_value::Boolean;
4+
5+
use crate::b;
6+
57
#[test]
68
fn from_str_false() -> crate::Result {
79
assert!(!Boolean::try_from(b("no"))?.0);

git-config-value/tests/value/color.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
mod name {
2-
use git_config_value::color::Name;
32
use std::str::FromStr;
43

4+
use git_config_value::color::Name;
5+
56
#[test]
67
fn non_bright() {
78
assert_eq!(Name::from_str("normal"), Ok(Name::Normal));

git-config-value/tests/value/integer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use std::convert::TryFrom;
22

3+
use git_config_value::{integer::Suffix, Integer};
4+
35
use crate::b;
4-
use git_config_value::integer::Suffix;
5-
use git_config_value::Integer;
66

77
#[test]
88
fn from_str_no_suffix() {

git-config-value/tests/value/main.rs

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

3+
use bstr::{BStr, ByteSlice};
4+
45
type Result<T = ()> = std::result::Result<T, Box<dyn std::error::Error>>;
56
fn b(s: &str) -> &bstr::BStr {
67
s.into()

git-config-value/tests/value/path.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
mod interpolate {
2-
use git_config_value::path;
32
use std::{
43
borrow::Cow,
54
path::{Path, PathBuf},
65
};
76

7+
use git_config_value::path;
8+
89
use crate::{b, cow_str};
910

1011
#[test]

git-config/src/file/access/comfort.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ use std::{borrow::Cow, convert::TryFrom};
22

33
use bstr::BStr;
44

5-
use crate::parse::section;
6-
use crate::{file::MetadataFilter, lookup, value, File};
5+
use crate::{file::MetadataFilter, lookup, parse::section, value, File};
76

87
/// Comfortable API for accessing values
98
impl<'event> File<'event> {

git-config/src/file/access/raw.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use std::convert::TryInto;
2-
use std::{borrow::Cow, collections::HashMap};
1+
use std::{borrow::Cow, collections::HashMap, convert::TryInto};
32

43
use bstr::BStr;
54
use smallvec::ToSmallVec;

git-credentials/src/helper/cascade.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
use crate::helper::Cascade;
2-
use crate::protocol::Context;
3-
use crate::{helper, protocol, Program};
1+
use crate::{helper, helper::Cascade, protocol, protocol::Context, Program};
42

53
impl Default for Cascade {
64
fn default() -> Self {

git-credentials/src/helper/invoke.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use crate::helper::{Action, NextAction};
2-
use crate::helper::{Context, Error, Outcome, Result};
31
use std::io::Read;
42

3+
use crate::helper::{Action, Context, Error, NextAction, Outcome, Result};
4+
55
impl Action {
66
/// Send ourselves to the given `write` which is expected to be credentials-helper compatible
77
pub fn send(&self, mut write: impl std::io::Write) -> std::io::Result<()> {

git-credentials/src/helper/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
use crate::protocol::Context;
2-
use crate::{protocol, Program};
3-
use bstr::{BStr, BString};
41
use std::convert::TryFrom;
52

3+
use bstr::{BStr, BString};
4+
5+
use crate::{protocol, protocol::Context, Program};
6+
67
/// A list of helper programs to run in order to obtain credentials.
78
#[allow(dead_code)]
89
#[derive(Debug)]

git-credentials/src/program/main.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
use std::{convert::TryFrom, ffi::OsString};
2+
13
use bstr::BString;
2-
use std::convert::TryFrom;
3-
use std::ffi::OsString;
44

55
/// The action passed to the credential helper implementation in [`main()`][crate::program::main()].
66
#[derive(Debug, Copy, Clone)]
@@ -60,10 +60,12 @@ pub enum Error {
6060
}
6161

6262
pub(crate) mod function {
63-
use crate::program::main::{Action, Error};
64-
use crate::protocol::Context;
65-
use std::convert::TryInto;
66-
use std::ffi::OsString;
63+
use std::{convert::TryInto, ffi::OsString};
64+
65+
use crate::{
66+
program::main::{Action, Error},
67+
protocol::Context,
68+
};
6769

6870
/// Invoke a custom credentials helper which receives program `args`, with the first argument being the
6971
/// action to perform (as opposed to the program name).

git-credentials/src/program/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
use crate::{helper, Program};
2-
use bstr::{BString, ByteSlice, ByteVec};
31
use std::process::{Command, Stdio};
42

3+
use bstr::{BString, ByteSlice, ByteVec};
4+
5+
use crate::{helper, Program};
6+
57
/// The kind of helper program to use.
68
#[derive(Debug, Clone, Eq, PartialEq)]
79
pub enum Kind {

git-credentials/src/protocol/context/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ pub enum Error {
99
}
1010

1111
mod access {
12-
use crate::protocol::Context;
1312
use bstr::BString;
1413

14+
use crate::protocol::Context;
15+
1516
impl Context {
1617
/// Convert all relevant fields into a URL for consumption.
1718
pub fn to_url(&self) -> Option<BString> {
@@ -44,10 +45,10 @@ mod access {
4445
}
4546

4647
mod mutate {
47-
use crate::protocol;
48-
use crate::protocol::Context;
4948
use bstr::ByteSlice;
5049

50+
use crate::{protocol, protocol::Context};
51+
5152
/// In-place mutation
5253
impl Context {
5354
/// Destructure the url at our `url` field into parts like protocol, host, username and path and store

git-credentials/src/protocol/context/serde.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
use crate::protocol::context::Error;
21
use bstr::BStr;
32

3+
use crate::protocol::context::Error;
4+
45
mod write {
5-
use crate::protocol::context::serde::validate;
6-
use crate::protocol::Context;
76
use bstr::{BStr, BString};
87

8+
use crate::protocol::{context::serde::validate, Context};
9+
910
impl Context {
1011
/// Write ourselves to `out` such that [`from_bytes()`][Self::from_bytes()] can decode it losslessly.
1112
pub fn write_to(&self, mut out: impl std::io::Write) -> std::io::Result<()> {
@@ -49,12 +50,12 @@ mod write {
4950

5051
///
5152
pub mod decode {
52-
use crate::protocol::context;
53-
use crate::protocol::context::serde::validate;
54-
use crate::protocol::Context;
55-
use bstr::{BString, ByteSlice};
5653
use std::convert::TryFrom;
5754

55+
use bstr::{BString, ByteSlice};
56+
57+
use crate::protocol::{context, context::serde::validate, Context};
58+
5859
/// The error returned by [`from_bytes()`][Context::from_bytes()].
5960
#[derive(Debug, thiserror::Error)]
6061
#[allow(missing_docs)]

git-credentials/src/protocol/mod.rs

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

3+
use crate::helper;
4+
45
/// The outcome of the credentials top-level functions to obtain a complete identity.
56
#[derive(Debug, Clone, Eq, PartialEq)]
67
pub struct Outcome {

git-credentials/tests/helper/cascade.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
mod invoke {
2+
use std::convert::TryInto;
3+
24
use bstr::{ByteSlice, ByteVec};
3-
use git_credentials::helper::Action;
4-
use git_credentials::helper::Cascade;
5-
use git_credentials::protocol::Context;
6-
use git_credentials::{program, protocol, Program};
5+
use git_credentials::{
6+
helper::{Action, Cascade},
7+
program, protocol,
8+
protocol::Context,
9+
Program,
10+
};
711
use git_sec::identity::Account;
812
use git_testtools::fixture_path;
9-
use std::convert::TryInto;
1013

1114
#[test]
1215
fn credentials_are_filled_in_one_by_one_and_stop_when_complete() {

git-credentials/tests/helper/invoke.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use bstr::{BString, ByteVec};
2-
use git_credentials::protocol::Context;
3-
use git_credentials::{helper, Program};
2+
use git_credentials::{helper, protocol::Context, Program};
43
use git_testtools::fixture_path;
54

65
#[test]
@@ -45,9 +44,10 @@ fn store_and_reject() {
4544
}
4645

4746
mod program {
48-
use crate::helper::invoke::script_helper;
4947
use git_credentials::{helper, program::Kind, Program};
5048

49+
use crate::helper::invoke::script_helper;
50+
5151
#[test]
5252
fn builtin() {
5353
assert!(

git-credentials/tests/helper/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ mod context;
33
mod invoke;
44

55
mod invoke_outcome_to_helper_result {
6-
use git_credentials::protocol::helper_outcome_to_result;
7-
use git_credentials::{helper, protocol};
6+
use git_credentials::{helper, protocol, protocol::helper_outcome_to_result};
87

98
#[test]
109
fn missing_username_or_password_causes_failure_with_get_action() {

git-credentials/tests/program/from_custom_definition.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use git_credentials::program::Kind;
2-
use git_credentials::Program;
1+
use git_credentials::{program::Kind, Program};
32

43
#[test]
54
fn script() {

git-date/src/parse.rs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,19 @@ pub enum Error {
1212
}
1313

1414
pub(crate) mod function {
15-
use crate::parse::{relative, Error};
16-
use crate::time::format::{DEFAULT, ISO8601, ISO8601_STRICT, RFC2822, SHORT};
17-
use crate::time::Sign;
18-
use crate::Time;
19-
use std::convert::TryInto;
20-
use std::str::FromStr;
21-
use std::time::SystemTime;
15+
use std::{convert::TryInto, str::FromStr, time::SystemTime};
16+
2217
use time::{Date, OffsetDateTime};
2318

19+
use crate::{
20+
parse::{relative, Error},
21+
time::{
22+
format::{DEFAULT, ISO8601, ISO8601_STRICT, RFC2822, SHORT},
23+
Sign,
24+
},
25+
Time,
26+
};
27+
2428
#[allow(missing_docs)]
2529
pub fn parse(input: &str, now: Option<SystemTime>) -> Result<Time, Error> {
2630
// TODO: actual implementation, this is just to not constantly fail
@@ -82,12 +86,12 @@ pub(crate) mod function {
8286
}
8387

8488
mod relative {
85-
use crate::parse::Error;
86-
use std::convert::TryInto;
87-
use std::str::FromStr;
88-
use std::time::SystemTime;
89+
use std::{convert::TryInto, str::FromStr, time::SystemTime};
90+
8991
use time::{Duration, OffsetDateTime};
9092

93+
use crate::parse::Error;
94+
9195
fn parse_inner(input: &str) -> Option<Duration> {
9296
let mut split = input.split_whitespace();
9397
let multiplier = i64::from_str(split.next()?).ok()?;

git-date/src/time/format.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
use crate::time::Format;
2-
use crate::Time;
3-
use time::format_description::FormatItem;
4-
use time::macros::format_description;
1+
use time::{format_description::FormatItem, macros::format_description};
2+
3+
use crate::{time::Format, Time};
54

65
/// E.g. `2018-12-24`
76
pub const SHORT: &[FormatItem<'_>] = format_description!("[year]-[month]-[day]");
@@ -31,9 +30,10 @@ pub const DEFAULT: &[FormatItem<'_>] = format_description!(
3130
);
3231

3332
mod format_impls {
34-
use crate::time::Format;
3533
use time::format_description::FormatItem;
3634

35+
use crate::time::Format;
36+
3737
impl<'a> From<&'a [FormatItem<'a>]> for Format<'a> {
3838
fn from(f: &'a [FormatItem<'a>]) -> Self {
3939
Format::Custom(f)

git-date/src/time/init.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
use crate::time::Sign;
2-
use crate::Time;
3-
use std::convert::TryInto;
4-
use std::ops::Sub;
1+
use std::{convert::TryInto, ops::Sub};
2+
3+
use crate::{time::Sign, Time};
54

65
/// Instantiation
76
impl Time {

git-date/src/time/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ mod sign {
5353
}
5454

5555
mod impls {
56-
use crate::time::Sign;
57-
use crate::Time;
56+
use crate::{time::Sign, Time};
5857

5958
impl Default for Time {
6059
fn default() -> Self {

git-date/src/time/write.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use crate::time::Sign;
2-
use crate::Time;
31
use bstr::BString;
42

3+
use crate::{time::Sign, Time};
4+
55
/// Serialization with standard `git` format
66
impl Time {
77
/// Serialize this instance into memory, similar to what [`write_to()`][Self::write_to()] would do with arbitrary `Write` implementations.

0 commit comments

Comments
 (0)