Skip to content

Commit

Permalink
Apply nightly rustfmt rules.
Browse files Browse the repository at this point in the history
Applied via `make rustfmt`, which enables these nightly-only rules:
```
group_imports = "StdExternalCrate"
imports_granularity = "Crate"
```

Keep git-config in its original form for now
  • Loading branch information
avoidscorn authored and Byron committed Aug 15, 2021
1 parent 19f21a4 commit 5e0edba
Show file tree
Hide file tree
Showing 275 changed files with 1,173 additions and 723 deletions.
6 changes: 4 additions & 2 deletions cargo-smart-release/src/command/release/cargo.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use super::{utils::will, Options};
use std::process::Command;

use anyhow::bail;
use cargo_metadata::Package;
use std::process::Command;

use super::{utils::will, Options};

pub(in crate::command::release_impl) fn publish_crate(
publishee: &Package,
Expand Down
9 changes: 5 additions & 4 deletions cargo-smart-release/src/command/release/git.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use super::{Context, Options};
use crate::command::release_impl::tag_name_for;
use crate::command::release_impl::utils::will;
use std::{convert::TryInto, process::Command};

use anyhow::{anyhow, bail};
use bstr::ByteSlice;
use cargo_metadata::{
Expand All @@ -20,7 +19,9 @@ use git_repository::{
},
Repository,
};
use std::{convert::TryInto, process::Command};

use super::{Context, Options};
use crate::command::release_impl::{tag_name_for, utils::will};

pub(in crate::command::release_impl) fn has_changed_since_last_release(
package: &Package,
Expand Down
12 changes: 7 additions & 5 deletions cargo-smart-release/src/command/release/manifest.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
use std::{collections::BTreeMap, str::FromStr};

use anyhow::bail;
use cargo_metadata::{Metadata, Package};
use git_repository::hash::ObjectId;
use semver::{Op, Version, VersionReq};

use super::{
cargo, git,
utils::{names_and_versions, package_by_id, package_eq_dependency},
Context, Options,
};
use anyhow::bail;
use cargo_metadata::{Metadata, Package};
use git_repository::hash::ObjectId;
use semver::{Op, Version, VersionReq};
use std::{collections::BTreeMap, str::FromStr};

pub(in crate::command::release_impl) fn edit_version_and_fixup_dependent_crates(
meta: &Metadata,
Expand Down
6 changes: 4 additions & 2 deletions cargo-smart-release/src/command/release/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use crate::command::release::Options;
use std::collections::BTreeSet;

use anyhow::bail;
use cargo_metadata::{camino::Utf8PathBuf, Dependency, DependencyKind, Metadata, Package, Version};
use git_repository::{refs::packed, Repository};
use std::collections::BTreeSet;

use crate::command::release::Options;

mod utils;
use crates_index::Index;
Expand Down
3 changes: 2 additions & 1 deletion experiments/diffing/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::time::Instant;

use anyhow::anyhow;
use diff::tree::visit::{Action, Change};
use git_repository::{
Expand All @@ -10,7 +12,6 @@ use git_repository::{
refs::file::loose::reference::peel,
};
use rayon::prelude::*;
use std::time::Instant;

const GITOXIDE_CACHED_OBJECT_DATA_PER_THREAD_IN_BYTES: usize = 60_000_000;

Expand Down
3 changes: 2 additions & 1 deletion experiments/hash-owned-borrowed/benches/usage.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use criterion::*;
use std::borrow::Borrow;

use criterion::*;

fn use_owned_by_ref(id: &hash::Owned) {
black_box(id);
}
Expand Down
3 changes: 2 additions & 1 deletion experiments/object-access/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::{path::Path, time::Instant};

use anyhow::anyhow;
use git_repository::{hash::ObjectId, odb, prelude::*, Repository};
use std::{path::Path, time::Instant};

const GITOXIDE_STATIC_CACHE_SIZE: usize = 64;
const GITOXIDE_CACHED_OBJECT_DATA_PER_THREAD_IN_BYTES: usize = 60_000_000;
Expand Down
9 changes: 5 additions & 4 deletions experiments/traversal/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
use std::{
collections::HashSet,
time::{Duration, Instant},
};

use anyhow::anyhow;
use dashmap::DashSet;
use git_repository::{
Expand All @@ -8,10 +13,6 @@ use git_repository::{
refs::file::loose::reference::peel,
traverse::{tree, tree::visit::Action},
};
use std::{
collections::HashSet,
time::{Duration, Instant},
};

const GITOXIDE_STATIC_CACHE_SIZE: usize = 64;
const GITOXIDE_CACHED_OBJECT_DATA_PER_THREAD_IN_BYTES: usize = 60_000_000;
Expand Down
3 changes: 2 additions & 1 deletion git-actor/src/immutable/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
//!
use crate::Time;
use bstr::BStr;

use crate::Time;

/// A signature is created by an actor at a certain time.
///
/// Note that this is not a cryptographical signature.
Expand Down
12 changes: 8 additions & 4 deletions git-actor/src/immutable/signature.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
mod decode {
use btoi::btoi;

use crate::{immutable::Signature, Sign, Time};
use bstr::ByteSlice;
use btoi::btoi;
use nom::{
branch::alt,
bytes::complete::{tag, take, take_until, take_while_m_n},
Expand All @@ -12,6 +10,8 @@ mod decode {
IResult,
};

use crate::{immutable::Signature, Sign, Time};

const SPACE: &[u8] = b" ";

/// Parse a signature from the bytes input `i` using `nom`.
Expand Down Expand Up @@ -65,11 +65,15 @@ mod decode {
#[cfg(test)]
mod tests {
mod parse_signature {
use crate::{immutable::signature, immutable::Signature, Sign, Time};
use bstr::ByteSlice;
use git_testtools::to_bstr_err;
use nom::IResult;

use crate::{
immutable::{signature, Signature},
Sign, Time,
};

fn decode(i: &[u8]) -> IResult<&[u8], Signature<'_>, nom::error::VerboseError<&[u8]>> {
signature::decode(i)
}
Expand Down
6 changes: 4 additions & 2 deletions git-actor/src/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ mod convert {
}

mod write {
use crate::{Signature, SPACE};
use std::io;

use bstr::{BStr, ByteSlice};
use quick_error::quick_error;
use std::io;

use crate::{Signature, SPACE};

quick_error! {
/// The Error produced by [`Signature::write_to()`].
Expand Down
3 changes: 2 additions & 1 deletion git-actor/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::{Sign, Signature, Time, SPACE};
use std::io;

use crate::{Sign, Signature, Time, SPACE};

impl Signature {
/// An empty signature, similar to 'null'.
pub fn empty() -> Self {
Expand Down
6 changes: 4 additions & 2 deletions git-commitgraph/src/file/access.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
use crate::file::{self, commit::Commit, File, COMMIT_DATA_ENTRY_SIZE};
use git_hash::SIZE_OF_SHA1_DIGEST as SHA1_SIZE;
use std::{
convert::TryInto,
fmt::{Debug, Formatter},
path::Path,
};

use git_hash::SIZE_OF_SHA1_DIGEST as SHA1_SIZE;

use crate::file::{self, commit::Commit, File, COMMIT_DATA_ENTRY_SIZE};

/// Access
impl File {
/// The number of base graphs that this file depends on.
Expand Down
14 changes: 8 additions & 6 deletions git-commitgraph/src/file/commit.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
//! Low-level operations on individual commits.
use crate::{
file::{self, File},
graph,
};
use byteorder::{BigEndian, ByteOrder};
use git_hash::SIZE_OF_SHA1_DIGEST as SHA1_SIZE;
use std::{
convert::TryInto,
fmt::{Debug, Formatter},
slice::Chunks,
};

use byteorder::{BigEndian, ByteOrder};
use git_hash::SIZE_OF_SHA1_DIGEST as SHA1_SIZE;

use crate::{
file::{self, File},
graph,
};

/// The error used in the [`file::commit`][self] module.
#[derive(thiserror::Error, Debug)]
#[allow(missing_docs)]
Expand Down
12 changes: 7 additions & 5 deletions git-commitgraph/src/file/init.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
use crate::file::{File, COMMIT_DATA_ENTRY_SIZE, FAN_LEN, SIGNATURE};
use bstr::ByteSlice;
use byteorder::{BigEndian, ByteOrder};
use filebuffer::FileBuffer;
use git_hash::SIZE_OF_SHA1_DIGEST as SHA1_SIZE;
use std::{
convert::{TryFrom, TryInto},
ops::Range,
path::Path,
};

use bstr::ByteSlice;
use byteorder::{BigEndian, ByteOrder};
use filebuffer::FileBuffer;
use git_hash::SIZE_OF_SHA1_DIGEST as SHA1_SIZE;

use crate::file::{File, COMMIT_DATA_ENTRY_SIZE, FAN_LEN, SIGNATURE};

type ChunkId = [u8; 4];

/// The error used in [`File::at()`].
Expand Down
8 changes: 4 additions & 4 deletions git-commitgraph/src/file/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ pub use commit::Commit;
mod init;
pub mod verify;

pub use init::Error;

use filebuffer::FileBuffer;
use git_hash::SIZE_OF_SHA1_DIGEST as SHA1_SIZE;
use std::{
fmt::{Display, Formatter},
ops::Range,
path::PathBuf,
};

use filebuffer::FileBuffer;
use git_hash::SIZE_OF_SHA1_DIGEST as SHA1_SIZE;
pub use init::Error;

const COMMIT_DATA_ENTRY_SIZE: usize = SHA1_SIZE + 16;
const FAN_LEN: usize = 256;
const SIGNATURE: &[u8] = b"CGPH";
Expand Down
14 changes: 8 additions & 6 deletions git-commitgraph/src/file/verify.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
//! Auxiliary types used in commit graph file verification methods.
use crate::{
file::{self, File},
GENERATION_NUMBER_INFINITY, GENERATION_NUMBER_MAX,
};
use bstr::ByteSlice;
use git_hash::SIZE_OF_SHA1_DIGEST as SHA1_SIZE;
use std::{
cmp::{max, min},
collections::HashMap,
path::Path,
};

use bstr::ByteSlice;
use git_hash::SIZE_OF_SHA1_DIGEST as SHA1_SIZE;

use crate::{
file::{self, File},
GENERATION_NUMBER_INFINITY, GENERATION_NUMBER_MAX,
};

/// The error used in [`File::traverse()`].
#[derive(thiserror::Error, Debug)]
#[allow(missing_docs)]
Expand Down
9 changes: 5 additions & 4 deletions git-commitgraph/src/graph/init.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
use crate::{
file::{self, File},
Graph, MAX_COMMITS,
};
use std::{
convert::TryFrom,
io::{BufRead, BufReader},
path::{Path, PathBuf},
};

use crate::{
file::{self, File},
Graph, MAX_COMMITS,
};

/// The error used in the [`graph`][crate::graph] module.
#[derive(thiserror::Error, Debug)]
#[allow(missing_docs)]
Expand Down
3 changes: 2 additions & 1 deletion git-commitgraph/src/graph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ mod access;
mod init;
pub mod verify;

use crate::file::File;
use std::fmt;

use crate::file::File;

/// A complete commit graph.
///
/// The data in the commit graph may come from a monolithic `objects/info/commit-graph` file, or it
Expand Down
9 changes: 5 additions & 4 deletions git-commitgraph/src/graph/verify.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
//! Auxiliary types used by graph verification methods.
use crate::{
file::{self, commit},
graph, Graph, GENERATION_NUMBER_MAX,
};
use std::{
cmp::{max, min},
collections::BTreeMap,
convert::TryInto,
path::PathBuf,
};

use crate::{
file::{self, commit},
graph, Graph, GENERATION_NUMBER_MAX,
};

/// The error used in [`verify_integrity()`][Graph::verify_integrity].
#[derive(thiserror::Error, Debug)]
#[allow(missing_docs)]
Expand Down
3 changes: 2 additions & 1 deletion git-commitgraph/tests/access/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::{check_common, inspect_refs, make_readonly_repo};
use git_commitgraph::Graph;

use crate::{check_common, inspect_refs, make_readonly_repo};

#[test]
fn single_parent() -> crate::Result {
let repo_dir = make_readonly_repo("single_parent.sh");
Expand Down
3 changes: 2 additions & 1 deletion git-commitgraph/tests/commitgraph.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use git_commitgraph::{graph::Position as GraphPosition, Graph};
use std::{
collections::{HashMap, HashSet},
convert::{TryFrom, TryInto},
Expand All @@ -8,6 +7,8 @@ use std::{
process::Command,
};

use git_commitgraph::{graph::Position as GraphPosition, Graph};

type Result = std::result::Result<(), Box<dyn std::error::Error>>;

mod access;
Expand Down
10 changes: 6 additions & 4 deletions git-diff/src/tree/changes.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
use std::{borrow::BorrowMut, collections::VecDeque};

use git_hash::{oid, ObjectId};
use git_object::immutable;
use quick_error::quick_error;

use crate::{
tree,
tree::{visit::Change, TreeInfoPair},
};
use git_hash::{oid, ObjectId};
use git_object::immutable;
use quick_error::quick_error;
use std::{borrow::BorrowMut, collections::VecDeque};

quick_error! {
/// The error returned by [tree::Changes::needed_to_obtain()].
Expand Down
3 changes: 2 additions & 1 deletion git-diff/src/tree/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::collections::VecDeque;

use git_hash::ObjectId;
use git_object::immutable;
use std::collections::VecDeque;

/// The state required to visit [Changes] to be instantiated with `State::default()`.
#[derive(Default, Clone)]
Expand Down

0 comments on commit 5e0edba

Please sign in to comment.