Updating rustfmt

This commit is contained in:
João M. Bezerra 2021-11-02 16:15:36 -03:00
parent 9a9488fcd2
commit 27b6970eda
8 changed files with 20 additions and 21 deletions

View File

@ -1,8 +1,8 @@
use std::{env, fs::create_dir_all, path::Path};
use clap::{ArgEnum, IntoApp};
use clap_generate::{generate_to, Shell};
use std::{env, fs::create_dir_all, path::Path};
include!("src/opts.rs");
fn main() {

View File

@ -1,3 +1,4 @@
# Stable features
max_width = 120
use_field_init_shorthand = true
newline_style = "Unix"
@ -6,5 +7,9 @@ reorder_imports = true
reorder_modules = true
use_try_shorthand = true
use_small_heuristics = "Max"
# Unstable features (nightly only)
unstable_features = true
force_multiline_blocks = true
group_imports = "StdExternalCrate"
imports_granularity = "Crate"

View File

@ -7,10 +7,10 @@ use std::{
};
use fs_err as fs;
use walkdir::WalkDir;
use zip::{self, read::ZipFile, ZipArchive};
use self::utf8::get_invalid_utf8_paths;
use crate::{
info,
list::FileInArchive,
@ -18,8 +18,6 @@ use crate::{
QuestionPolicy,
};
use self::utf8::get_invalid_utf8_paths;
/// Unpacks the archive given by `archive` into the folder given by `into`.
pub fn unpack_archive<R>(
mut archive: ZipArchive<R>,
@ -158,8 +156,7 @@ fn check_for_comments(file: &ZipFile) {
#[cfg(unix)]
fn __unix_set_permissions(file_path: &Path, file: &ZipFile) -> crate::Result<()> {
use std::fs::Permissions;
use std::os::unix::fs::PermissionsExt;
use std::{fs::Permissions, os::unix::fs::PermissionsExt};
if let Some(mode) = file.unix_mode() {
fs::set_permissions(file_path, Permissions::from_mode(mode))?;
@ -175,8 +172,7 @@ mod utf8 {
// Sad double reference in order to make `filter` happy in `get_invalid_utf8_paths`
#[cfg(unix)]
fn is_invalid_utf8(path: &&Path) -> bool {
use std::os::unix::prelude::OsStrExt;
use std::str;
use std::{os::unix::prelude::OsStrExt, str};
// str::from_utf8 does not make any allocations
let bytes = path.as_os_str().as_bytes();

View File

@ -1,8 +1,9 @@
//! Implementation of the 'list' command, print list of files in an archive
use self::tree::Tree;
use std::path::{Path, PathBuf};
use self::tree::Tree;
/// Options controlling how archive contents should be listed
#[derive(Debug, Clone, Copy)]
pub struct ListOptions {
@ -56,11 +57,11 @@ fn print_entry(name: impl std::fmt::Display, is_dir: bool) {
/// we have to construct the tree structure ourselves to be able to
/// display them as a tree
mod tree {
use super::FileInArchive;
use std::{ffi::OsString, iter::FromIterator, path};
use linked_hash_map::LinkedHashMap;
use std::ffi::OsString;
use std::iter::FromIterator;
use std::path;
use super::FileInArchive;
/// Directory tree
#[derive(Debug, Default)]

View File

@ -1,7 +1,7 @@
use clap::{Parser, ValueHint};
use std::path::PathBuf;
use clap::{Parser, ValueHint};
/// Command line options
#[derive(Parser, Debug)]
#[clap(version, about)]

View File

@ -4,8 +4,7 @@ use std::{
cmp, env,
ffi::OsStr,
io,
path::Component,
path::{Path, PathBuf},
path::{Component, Path, PathBuf},
};
use fs_err as fs;

View File

@ -7,9 +7,8 @@ use std::{
time::Duration,
};
use ouch::{commands::run, Opts, QuestionPolicy, Subcommand};
use fs_err as fs;
use ouch::{commands::run, Opts, QuestionPolicy, Subcommand};
use rand::{rngs::SmallRng, RngCore, SeedableRng};
use tempfile::NamedTempFile;
use utils::*;

View File

@ -5,7 +5,6 @@
use std::path::{Path, PathBuf};
use fs_err as fs;
use ouch::{commands::run, Opts, QuestionPolicy, Subcommand};
pub fn create_empty_dir(at: &Path, filename: &str) -> PathBuf {