Skip to content

Commit 64b1f76

Browse files
committed
Auto-format use statements
Use `nightly` fmt to auto-reformat all the use statements. I will create a follow-up PR to do some manual additional cleanups. I did not want to include manual cleanups in the same PR as the initial automatic ones. Note that the nightly fmt is required for this. It will not affect the regular `cargo fmt` CI check because regular one ignores `use` sections (the formatting has not been fully stabilized). ``` cargo +nightly fmt -- --config imports_granularity=Module,group_imports=StdExternalCrate cd c && cargo +nightly fmt -- --config imports_granularity=Module,group_imports=StdExternalCrate ``` Note that the above steps can also be done with `just`: `just fmt2`
1 parent f90551a commit 64b1f76

Some content is hidden

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

44 files changed

+235
-247
lines changed

src/bin/brotli.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ extern crate sha2;
1515
#[allow(unused_imports)]
1616
#[macro_use]
1717
extern crate alloc_no_stdlib;
18+
use core::cmp::{max, min};
19+
use core::ops;
20+
1821
#[allow(unused_imports)]
1922
use alloc_no_stdlib::{
2023
bzero, AllocatedStackMemory, Allocator, SliceWrapper, SliceWrapperMut, StackAllocator,
@@ -30,11 +33,8 @@ use brotli::enc::{
3033
use brotli::CustomRead;
3134
#[allow(unused_imports)]
3235
use brotli::HuffmanCode;
33-
use core::cmp::{max, min};
34-
use core::ops;
3536
mod validate;
3637
use std::env;
37-
3838
use std::fs::File;
3939
use std::io::{self, Error, ErrorKind, Read, Seek, SeekFrom, Write};
4040

src/bin/catbrotli.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
extern crate brotli;
22
extern crate core;
3-
use std::env;
43
use std::fs::File;
5-
use std::io;
64
use std::io::{Read, Write};
75
use std::path::Path;
6+
use std::{env, io};
87

98
use brotli::concat::{BroCatli, BroCatliResult};
109
fn usage() {

src/bin/integration_tests.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,6 @@
33
#![allow(dead_code)]
44
extern crate brotli_decompressor;
55
extern crate core;
6-
#[allow(unused_imports)]
7-
use super::alloc_no_stdlib::{Allocator, SliceWrapper, SliceWrapperMut};
8-
use super::brotli::BrotliResult;
9-
use super::brotli::BrotliState;
10-
#[cfg(feature = "std")]
11-
use super::brotli::{CompressorReader, CompressorWriter};
12-
#[cfg(feature = "std")]
13-
use super::brotli_decompressor::{Decompressor, DecompressorWriter};
14-
use super::HeapAllocator;
15-
use super::Rebox;
16-
use brotli::BrotliDecompressStream;
176
use core::cmp::min;
187
use std::io;
198
#[cfg(feature = "std")]
@@ -22,6 +11,17 @@ use std::time::Duration;
2211
#[cfg(not(feature = "disable-timer"))]
2312
use std::time::SystemTime;
2413

14+
use brotli::BrotliDecompressStream;
15+
16+
#[allow(unused_imports)]
17+
use super::alloc_no_stdlib::{Allocator, SliceWrapper, SliceWrapperMut};
18+
use super::brotli::{BrotliResult, BrotliState};
19+
#[cfg(feature = "std")]
20+
use super::brotli::{CompressorReader, CompressorWriter};
21+
#[cfg(feature = "std")]
22+
use super::brotli_decompressor::{Decompressor, DecompressorWriter};
23+
use super::{HeapAllocator, Rebox};
24+
2525
#[cfg(feature = "benchmark")]
2626
extern crate test;
2727
#[cfg(feature = "benchmark")]

src/bin/test_broccoli.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
#![allow(dead_code)]
44
extern crate brotli_decompressor;
55
extern crate core;
6+
use core::cmp::{max, min};
7+
8+
use brotli_decompressor::{CustomRead, CustomWrite};
9+
610
use super::brotli::concat::{BroCatli, BroCatliResult};
711
use super::brotli::enc::BrotliEncoderParams;
812
use super::integration_tests::UnlimitedBuffer;
9-
use brotli_decompressor::{CustomRead, CustomWrite};
10-
use core::cmp::{max, min};
1113
static RANDOM_THEN_UNICODE: &[u8] = include_bytes!("../../testdata/random_then_unicode");
1214
static ALICE: &[u8] = include_bytes!("../../testdata/alice29.txt");
1315
static UKKONOOA: &[u8] = include_bytes!("../../testdata/ukkonooa");

src/bin/test_custom_dict.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
#![allow(dead_code)]
44
extern crate brotli_decompressor;
55
extern crate core;
6+
use std::io::{Read, Write};
7+
68
use super::brotli::concat::{BroCatli, BroCatliResult};
79
use super::brotli::enc::BrotliEncoderParams;
810
use super::integration_tests::UnlimitedBuffer;
9-
use std::io::{Read, Write};
1011
static RANDOM_THEN_UNICODE: &[u8] = include_bytes!("../../testdata/random_then_unicode");
1112
static ALICE: &[u8] = include_bytes!("../../testdata/alice29.txt");
1213
use super::Rebox;

src/bin/test_threading.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
#![allow(dead_code)]
44
extern crate brotli_decompressor;
55
extern crate core;
6+
use brotli::enc::threading::{Owned, SendAlloc};
7+
use brotli_decompressor::{SliceWrapper, SliceWrapperMut};
8+
69
use super::brotli::enc::{
710
compress_multi, compress_multi_no_threadpool, BrotliEncoderMaxCompressedSizeMulti,
811
BrotliEncoderParams, UnionHasher,
912
};
10-
use super::new_brotli_heap_alloc;
11-
use brotli::enc::threading::{Owned, SendAlloc};
12-
use brotli_decompressor::{SliceWrapper, SliceWrapperMut};
13-
1413
use super::integration_tests::UnlimitedBuffer;
14+
use super::new_brotli_heap_alloc;
1515
static RANDOM_THEN_UNICODE: &[u8] = include_bytes!("../../testdata/random_then_unicode");
1616
static ALICE: &[u8] = include_bytes!("../../testdata/alice29.txt");
1717
use super::Rebox;

src/bin/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
use core::marker::PhantomData;
22
use core::mem;
3+
use std::collections::BTreeMap;
4+
use std::fmt;
35
use std::thread::JoinHandle;
46

57
use alloc_no_stdlib::{Allocator, SliceWrapper};
@@ -13,8 +15,6 @@ use brotli::enc::threading::{
1315
use brotli::enc::BrotliAlloc;
1416
use brotli::interface;
1517
use brotli::transform::TransformDictionaryWord;
16-
use std::collections::BTreeMap;
17-
use std::fmt;
1818

1919
struct HexSlice<'a>(&'a [u8]);
2020

src/bin/validate.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
use super::{HeapAllocator, IoWriterWrapper, Rebox};
1+
#[cfg(feature = "validation")]
2+
use core;
3+
use std::io::{self, Error, ErrorKind, Read, Write};
4+
25
use alloc_no_stdlib::{Allocator, SliceWrapper};
36
use brotli::enc::BrotliEncoderParams;
47
use brotli::{CustomWrite, DecompressorWriterCustomIo};
58
#[cfg(feature = "validation")]
6-
use core;
7-
#[cfg(feature = "validation")]
89
use sha2::{Digest, Sha256};
9-
use std::io::{self, Error, ErrorKind, Read, Write};
10+
11+
use super::{HeapAllocator, IoWriterWrapper, Rebox};
1012
#[cfg(feature = "validation")]
1113
type Checksum = Sha256;
1214

src/enc/backward_references/benchmark.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#![cfg(feature = "benchmark")]
22
#![cfg(feature = "std")]
33
extern crate test;
4-
use super::*;
54
use alloc_stdlib::StandardAlloc;
5+
6+
use super::*;
67
static RANDOM_THEN_UNICODE: &'static [u8] = include_bytes!("../../../testdata/random_then_unicode");
78
static FINALIZE_DATA: &'static [u8] = &[
89
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,

src/enc/backward_references/hash_to_binary_tree.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
#![allow(dead_code, unused_imports)]
2-
use super::{
3-
kDistanceCacheIndex, kDistanceCacheOffset, kHashMul32, kHashMul64, kHashMul64Long,
4-
kInvalidMatch, AnyHasher, BrotliEncoderParams, BrotliHasherParams, CloneWithAlloc, H9Opts,
5-
HasherSearchResult, HowPrepared, Struct1,
6-
};
7-
use alloc;
82
use alloc::{Allocator, SliceWrapper, SliceWrapperMut};
9-
use core;
103
use core::cmp::{max, min};
4+
115
use enc::command::{
126
CombineLengthCodes, Command, ComputeDistanceCode, GetCopyLengthCode, GetInsertLengthCode,
137
PrefixEncodeCopyDistance,
@@ -17,11 +11,16 @@ use enc::dictionary_hash::kStaticDictionaryHash;
1711
use enc::literal_cost::BrotliEstimateBitCostsForLiterals;
1812
use enc::static_dict::{
1913
kBrotliEncDictionary, BrotliDictionary, BrotliFindAllStaticDictionaryMatches,
20-
};
21-
use enc::static_dict::{
2214
FindMatchLengthWithLimit, BROTLI_UNALIGNED_LOAD32, BROTLI_UNALIGNED_LOAD64,
2315
};
2416
use enc::util::{floatX, FastLog2, Log2FloorNonZero};
17+
use {alloc, core};
18+
19+
use super::{
20+
kDistanceCacheIndex, kDistanceCacheOffset, kHashMul32, kHashMul64, kHashMul64Long,
21+
kInvalidMatch, AnyHasher, BrotliEncoderParams, BrotliHasherParams, CloneWithAlloc, H9Opts,
22+
HasherSearchResult, HowPrepared, Struct1,
23+
};
2524

2625
pub const kInfinity: floatX = 1.7e38 as floatX;
2726
#[derive(Clone, Copy, Debug)]

0 commit comments

Comments
 (0)