ok/jj
1
0
Fork 0
forked from mirrors/jj

rustfmt: configure to merge imports by module

Perhaps we should even set the config to "Item" to reduce merge conflicts.
This commit is contained in:
Martin von Zweigbergk 2021-03-14 10:46:35 -07:00
parent 4b8484e561
commit a7f4f4cf5b
18 changed files with 26 additions and 52 deletions

View file

@ -13,8 +13,7 @@
// limitations under the License. // limitations under the License.
use std::fmt::{Debug, Error, Formatter}; use std::fmt::{Debug, Error, Formatter};
use std::io::Cursor; use std::io::{Cursor, Read};
use std::io::Read;
use std::ops::Deref; use std::ops::Deref;
use std::path::Path; use std::path::Path;
use std::sync::Mutex; use std::sync::Mutex;

View file

@ -15,8 +15,7 @@
use std::fmt::Debug; use std::fmt::Debug;
use std::fs; use std::fs;
use std::fs::File; use std::fs::File;
use std::io::Write; use std::io::{ErrorKind, Read, Write};
use std::io::{ErrorKind, Read};
use std::path::PathBuf; use std::path::PathBuf;
use blake2::{Blake2b, Digest}; use blake2::{Blake2b, Digest};

View file

@ -62,8 +62,7 @@ impl Drop for FileLock {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use std::env; use std::{env, thread};
use std::thread;
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};

View file

@ -14,13 +14,9 @@
#![allow(dead_code)] #![allow(dead_code)]
use std::collections::HashMap; use std::collections::{HashMap, HashSet};
use std::collections::HashSet;
use crate::repo_path::DirRepoPath; use crate::repo_path::{DirRepoPath, DirRepoPathComponent, FileRepoPath, FileRepoPathComponent};
use crate::repo_path::DirRepoPathComponent;
use crate::repo_path::FileRepoPath;
use crate::repo_path::FileRepoPathComponent;
#[derive(PartialEq, Eq, Debug)] #[derive(PartialEq, Eq, Debug)]
pub struct Visit<'a> { pub struct Visit<'a> {
@ -156,10 +152,9 @@ mod tests {
use std::collections::HashSet; use std::collections::HashSet;
use super::*; use super::*;
use crate::repo_path::DirRepoPath; use crate::repo_path::{
use crate::repo_path::DirRepoPathComponent; DirRepoPath, DirRepoPathComponent, FileRepoPath, FileRepoPathComponent,
use crate::repo_path::FileRepoPath; };
use crate::repo_path::FileRepoPathComponent;
#[test] #[test]
fn dirs_empty() { fn dirs_empty() {

View file

@ -18,14 +18,13 @@ use std::sync::Arc;
use thiserror::Error; use thiserror::Error;
use crate::dag_walk;
use crate::lock::FileLock; use crate::lock::FileLock;
use crate::op_store;
use crate::op_store::{OpStore, OperationId, OperationMetadata}; use crate::op_store::{OpStore, OperationId, OperationMetadata};
use crate::operation::Operation; use crate::operation::Operation;
use crate::repo::RepoLoader; use crate::repo::RepoLoader;
use crate::store::{CommitId, Timestamp}; use crate::store::{CommitId, Timestamp};
use crate::transaction::UnpublishedOperation; use crate::transaction::UnpublishedOperation;
use crate::{dag_walk, op_store};
/// Manages the very set of current heads of the operation log. The store is /// Manages the very set of current heads of the operation log. The store is
/// simply a directory where each operation id is a file with that name (and no /// simply a directory where each operation id is a file with that name (and no

View file

@ -23,7 +23,6 @@ use thiserror::Error;
use crate::commit::Commit; use crate::commit::Commit;
use crate::commit_builder::{new_change_id, signature, CommitBuilder}; use crate::commit_builder::{new_change_id, signature, CommitBuilder};
use crate::conflicts;
use crate::dag_walk::topo_order_reverse; use crate::dag_walk::topo_order_reverse;
use crate::evolution::{EvolutionRef, MutableEvolution, ReadonlyEvolution}; use crate::evolution::{EvolutionRef, MutableEvolution, ReadonlyEvolution};
use crate::git_store::GitStore; use crate::git_store::GitStore;
@ -31,17 +30,16 @@ use crate::index::{IndexRef, MutableIndex, ReadonlyIndex};
use crate::index_store::IndexStore; use crate::index_store::IndexStore;
use crate::local_store::LocalStore; use crate::local_store::LocalStore;
use crate::op_heads_store::OpHeadsStore; use crate::op_heads_store::OpHeadsStore;
use crate::op_store;
use crate::op_store::{OpStore, OperationId}; use crate::op_store::{OpStore, OperationId};
use crate::operation::Operation; use crate::operation::Operation;
use crate::settings::{RepoSettings, UserSettings}; use crate::settings::{RepoSettings, UserSettings};
use crate::simple_op_store::SimpleOpStore; use crate::simple_op_store::SimpleOpStore;
use crate::store;
use crate::store::{CommitId, Store, StoreError}; use crate::store::{CommitId, Store, StoreError};
use crate::store_wrapper::StoreWrapper; use crate::store_wrapper::StoreWrapper;
use crate::transaction::Transaction; use crate::transaction::Transaction;
use crate::view::{merge_views, MutableView, ReadonlyView, ViewRef}; use crate::view::{merge_views, MutableView, ReadonlyView, ViewRef};
use crate::working_copy::WorkingCopy; use crate::working_copy::WorkingCopy;
use crate::{conflicts, op_store, store};
#[derive(Debug, Error, PartialEq, Eq)] #[derive(Debug, Error, PartialEq, Eq)]
pub enum RepoError { pub enum RepoError {

View file

@ -15,8 +15,7 @@
use std::fmt::Debug; use std::fmt::Debug;
use std::fs; use std::fs;
use std::fs::File; use std::fs::File;
use std::io::ErrorKind; use std::io::{ErrorKind, Write};
use std::io::Write;
use std::path::PathBuf; use std::path::PathBuf;
use blake2::{Blake2b, Digest}; use blake2::{Blake2b, Digest};

View file

@ -21,8 +21,7 @@ use std::vec::Vec;
use thiserror::Error; use thiserror::Error;
use crate::repo_path::DirRepoPath; use crate::repo_path::{DirRepoPath, FileRepoPath};
use crate::repo_path::FileRepoPath;
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash)] #[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Hash)]
pub struct CommitId(pub Vec<u8>); pub struct CommitId(pub Vec<u8>);

View file

@ -18,16 +18,14 @@ use crate::commit::Commit;
use crate::evolution::MutableEvolution; use crate::evolution::MutableEvolution;
use crate::index::MutableIndex; use crate::index::MutableIndex;
use crate::op_heads_store::OpHeadsStore; use crate::op_heads_store::OpHeadsStore;
use crate::op_store; use crate::op_store::{OperationId, OperationMetadata};
use crate::op_store::OperationId;
use crate::op_store::OperationMetadata;
use crate::operation::Operation; use crate::operation::Operation;
use crate::repo::{MutableRepo, ReadonlyRepo, RepoRef}; use crate::repo::{MutableRepo, ReadonlyRepo, RepoRef};
use crate::settings::UserSettings; use crate::settings::UserSettings;
use crate::store;
use crate::store::{CommitId, Timestamp}; use crate::store::{CommitId, Timestamp};
use crate::store_wrapper::StoreWrapper; use crate::store_wrapper::StoreWrapper;
use crate::view::MutableView; use crate::view::MutableView;
use crate::{op_store, store};
pub struct Transaction<'r> { pub struct Transaction<'r> {
repo: Option<Arc<MutableRepo<'r>>>, repo: Option<Arc<MutableRepo<'r>>>,

View file

@ -23,8 +23,7 @@ use std::os::unix::fs::symlink;
use std::os::unix::fs::PermissionsExt; use std::os::unix::fs::PermissionsExt;
#[cfg(windows)] #[cfg(windows)]
use std::os::windows::fs::symlink_file; use std::os::windows::fs::symlink_file;
use std::path::Path; use std::path::{Path, PathBuf};
use std::path::PathBuf;
use std::sync::Arc; use std::sync::Arc;
use std::time::UNIX_EPOCH; use std::time::UNIX_EPOCH;

View file

@ -15,9 +15,8 @@
use std::sync::Arc; use std::sync::Arc;
use std::thread; use std::thread;
use jujube_lib::dag_walk;
use jujube_lib::repo::ReadonlyRepo; use jujube_lib::repo::ReadonlyRepo;
use jujube_lib::testutils; use jujube_lib::{dag_walk, testutils};
use test_case::test_case; use test_case::test_case;
fn count_non_merge_operations(repo: &ReadonlyRepo) -> u32 { fn count_non_merge_operations(repo: &ReadonlyRepo) -> u32 {

View file

@ -14,8 +14,7 @@
use jujube_lib::commit::Commit; use jujube_lib::commit::Commit;
use jujube_lib::commit_builder::CommitBuilder; use jujube_lib::commit_builder::CommitBuilder;
use jujube_lib::evolution::evolve; use jujube_lib::evolution::{evolve, EvolveListener};
use jujube_lib::evolution::EvolveListener;
use jujube_lib::repo::ReadonlyRepo; use jujube_lib::repo::ReadonlyRepo;
use jujube_lib::repo_path::FileRepoPath; use jujube_lib::repo_path::FileRepoPath;
use jujube_lib::settings::UserSettings; use jujube_lib::settings::UserSettings;

View file

@ -18,12 +18,11 @@ use std::sync::Arc;
use git2::Oid; use git2::Oid;
use jujube_lib::commit::Commit; use jujube_lib::commit::Commit;
use jujube_lib::git;
use jujube_lib::git::{GitFetchError, GitPushError}; use jujube_lib::git::{GitFetchError, GitPushError};
use jujube_lib::repo::ReadonlyRepo; use jujube_lib::repo::ReadonlyRepo;
use jujube_lib::settings::UserSettings; use jujube_lib::settings::UserSettings;
use jujube_lib::store::CommitId; use jujube_lib::store::CommitId;
use jujube_lib::testutils; use jujube_lib::{git, testutils};
use maplit::hashset; use maplit::hashset;
use tempfile::TempDir; use tempfile::TempDir;

View file

@ -14,9 +14,8 @@
use jujube_lib::repo_path::{DirRepoPath, FileRepoPath, RepoPath}; use jujube_lib::repo_path::{DirRepoPath, FileRepoPath, RepoPath};
use jujube_lib::store::{ConflictPart, TreeValue}; use jujube_lib::store::{ConflictPart, TreeValue};
use jujube_lib::testutils;
use jujube_lib::tree::Tree; use jujube_lib::tree::Tree;
use jujube_lib::trees; use jujube_lib::{testutils, trees};
use test_case::test_case; use test_case::test_case;
#[test_case(false ; "local store")] #[test_case(false ; "local store")]

View file

@ -2,3 +2,4 @@ max_width = 100
wrap_comments = true wrap_comments = true
error_on_line_overflow = true error_on_line_overflow = true
group_imports = "StdExternalCrate" group_imports = "StdExternalCrate"
imports_granularity = "Module"

View file

@ -19,25 +19,20 @@ extern crate config;
use std::collections::{HashSet, VecDeque}; use std::collections::{HashSet, VecDeque};
use std::ffi::OsString; use std::ffi::OsString;
use std::fmt::Debug; use std::fmt::Debug;
use std::fs;
use std::fs::OpenOptions; use std::fs::OpenOptions;
use std::io;
use std::io::{Read, Write}; use std::io::{Read, Write};
use std::process::Command; use std::process::Command;
use std::sync::Arc; use std::sync::Arc;
use std::time::Instant; use std::time::Instant;
use std::{fs, io};
use clap::{crate_version, App, Arg, ArgMatches, SubCommand}; use clap::{crate_version, App, Arg, ArgMatches, SubCommand};
use criterion::Criterion; use criterion::Criterion;
use jujube_lib::commit::Commit; use jujube_lib::commit::Commit;
use jujube_lib::commit_builder::CommitBuilder; use jujube_lib::commit_builder::CommitBuilder;
use jujube_lib::conflicts;
use jujube_lib::dag_walk::{topo_order_reverse, walk_ancestors}; use jujube_lib::dag_walk::{topo_order_reverse, walk_ancestors};
use jujube_lib::evolution::evolve; use jujube_lib::evolution::{evolve, EvolveListener};
use jujube_lib::evolution::EvolveListener;
use jujube_lib::files;
use jujube_lib::files::DiffLine; use jujube_lib::files::DiffLine;
use jujube_lib::git;
use jujube_lib::git::GitFetchError; use jujube_lib::git::GitFetchError;
use jujube_lib::index::{HexPrefix, PrefixResolution}; use jujube_lib::index::{HexPrefix, PrefixResolution};
use jujube_lib::op_store::{OpStore, OpStoreError, OperationId}; use jujube_lib::op_store::{OpStore, OpStoreError, OperationId};
@ -46,14 +41,14 @@ use jujube_lib::repo::{ReadonlyRepo, RepoLoadError, RepoLoader};
use jujube_lib::repo_path::RepoPath; use jujube_lib::repo_path::RepoPath;
use jujube_lib::rewrite::{back_out_commit, merge_commit_trees, rebase_commit}; use jujube_lib::rewrite::{back_out_commit, merge_commit_trees, rebase_commit};
use jujube_lib::settings::UserSettings; use jujube_lib::settings::UserSettings;
use jujube_lib::store::{CommitId, Timestamp}; use jujube_lib::store::{CommitId, StoreError, Timestamp, TreeValue};
use jujube_lib::store::{StoreError, TreeValue};
use jujube_lib::store_wrapper::StoreWrapper; use jujube_lib::store_wrapper::StoreWrapper;
use jujube_lib::transaction::Transaction; use jujube_lib::transaction::Transaction;
use jujube_lib::tree::Tree; use jujube_lib::tree::Tree;
use jujube_lib::trees::TreeValueDiff; use jujube_lib::trees::TreeValueDiff;
use jujube_lib::view::merge_views; use jujube_lib::view::merge_views;
use jujube_lib::working_copy::{CheckoutStats, WorkingCopy}; use jujube_lib::working_copy::{CheckoutStats, WorkingCopy};
use jujube_lib::{conflicts, files, git};
use pest::Parser; use pest::Parser;
use self::chrono::{FixedOffset, TimeZone, Utc}; use self::chrono::{FixedOffset, TimeZone, Utc};

View file

@ -17,8 +17,7 @@ extern crate pest;
use jujube_lib::commit::Commit; use jujube_lib::commit::Commit;
use jujube_lib::repo::RepoRef; use jujube_lib::repo::RepoRef;
use jujube_lib::store::{CommitId, Signature}; use jujube_lib::store::{CommitId, Signature};
use pest::iterators::Pair; use pest::iterators::{Pair, Pairs};
use pest::iterators::Pairs;
use pest::Parser; use pest::Parser;
use crate::styler::PlainTextStyler; use crate::styler::PlainTextStyler;

View file

@ -12,11 +12,10 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use std::fmt;
use std::io;
use std::io::Write; use std::io::Write;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::sync::{Mutex, MutexGuard}; use std::sync::{Mutex, MutexGuard};
use std::{fmt, io};
use jujube_lib::commit::Commit; use jujube_lib::commit::Commit;
use jujube_lib::repo::RepoRef; use jujube_lib::repo::RepoRef;