Skip to content

Commit 5ad7153

Browse files
authored
Merge pull request #196 from nyurik/use-crate
Switch to `use crate::` for local decl
2 parents 27ce5f5 + 6622aeb commit 5ad7153

22 files changed

+64
-67
lines changed

src/enc/backward_references/hash_to_binary_tree.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
#![allow(dead_code)]
22

33
use alloc::{Allocator, SliceWrapper, SliceWrapperMut};
4+
use core;
45
use core::cmp::min;
56

6-
use enc::static_dict::{BrotliDictionary, FindMatchLengthWithLimit, BROTLI_UNALIGNED_LOAD32};
7-
use enc::util::floatX;
8-
use {alloc, core};
9-
107
use super::{
118
kHashMul32, AnyHasher, BrotliEncoderParams, CloneWithAlloc, H9Opts, HasherSearchResult,
129
HowPrepared, Struct1,
1310
};
11+
use crate::enc::static_dict::{
12+
BrotliDictionary, FindMatchLengthWithLimit, BROTLI_UNALIGNED_LOAD32,
13+
};
14+
use crate::enc::util::floatX;
1415

1516
pub const kInfinity: floatX = 1.7e38 as floatX;
1617

src/enc/backward_references/hq.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,6 @@ use alloc::{Allocator, SliceWrapper, SliceWrapperMut};
44
use core;
55
use core::cmp::{max, min};
66

7-
use enc::command::{
8-
BrotliDistanceParams, CombineLengthCodes, Command, GetCopyLengthCode, GetInsertLengthCode,
9-
PrefixEncodeCopyDistance,
10-
};
11-
use enc::constants::{kCopyExtra, kInsExtra};
12-
use enc::encode;
13-
use enc::literal_cost::BrotliEstimateBitCostsForLiterals;
14-
use enc::static_dict::{
15-
BrotliDictionary, BrotliFindAllStaticDictionaryMatches, FindMatchLengthWithLimit,
16-
BROTLI_UNALIGNED_LOAD32,
17-
};
18-
use enc::util::{floatX, FastLog2, FastLog2f64};
19-
207
use super::hash_to_binary_tree::{
218
kInfinity, Allocable, BackwardMatch, BackwardMatchMut, H10Params, StoreAndFindMatchesH10,
229
Union1, ZopfliNode, H10,
@@ -25,6 +12,18 @@ use super::{
2512
kDistanceCacheIndex, kDistanceCacheOffset, kHashMul32, kInvalidMatch, AnyHasher,
2613
BrotliEncoderParams,
2714
};
15+
use crate::enc::command::{
16+
BrotliDistanceParams, CombineLengthCodes, Command, GetCopyLengthCode, GetInsertLengthCode,
17+
PrefixEncodeCopyDistance,
18+
};
19+
use crate::enc::constants::{kCopyExtra, kInsExtra};
20+
use crate::enc::encode;
21+
use crate::enc::literal_cost::BrotliEstimateBitCostsForLiterals;
22+
use crate::enc::static_dict::{
23+
BrotliDictionary, BrotliFindAllStaticDictionaryMatches, FindMatchLengthWithLimit,
24+
BROTLI_UNALIGNED_LOAD32,
25+
};
26+
use crate::enc::util::{floatX, FastLog2, FastLog2f64};
2827

2928
const BROTLI_WINDOW_GAP: usize = 16;
3029
const BROTLI_MAX_STATIC_DICTIONARY_MATCH_LEN: usize = 37;

src/enc/backward_references/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
#![cfg(test)]
33

44
use alloc_stdlib::StandardAlloc;
5-
use enc::{Allocator, SliceWrapper};
65

76
use super::{
87
AdvHasher, AnyHasher, BrotliHasherParams, CloneWithAlloc, H5Sub, H9Opts, HQ7Sub, Struct1,
98
};
9+
use crate::enc::{Allocator, SliceWrapper};
1010

1111
static RANDOM_THEN_UNICODE: &[u8] = include_bytes!("../../../testdata/random_then_unicode"); //&[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,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55];
1212

src/enc/brotli_bit_stream.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ use core::cmp::{max, min};
66
#[cfg(feature = "std")]
77
use std::io::Write;
88

9-
use enc::backward_references::BrotliEncoderParams;
10-
use VERSION;
11-
129
use super::super::alloc::{Allocator, SliceWrapper, SliceWrapperMut};
1310
use super::super::dictionary::{
1411
kBrotliDictionary, kBrotliDictionaryOffsetsByLength, kBrotliDictionarySizeBitsByLength,
@@ -38,6 +35,8 @@ use super::interface::StaticCommand;
3835
use super::static_dict::kNumDistanceCacheEntries;
3936
use super::util::floatX;
4037
use super::{find_stride, interface, prior_eval, stride_eval};
38+
use crate::enc::backward_references::BrotliEncoderParams;
39+
use crate::VERSION;
4140

4241
pub struct PrefixCodeRange {
4342
pub offset: u32,
@@ -2956,7 +2955,7 @@ pub fn BrotliWriteMetadataMetaBlock(
29562955

29572956
#[cfg(test)]
29582957
mod test {
2959-
use enc::brotli_bit_stream::{encode_base_128, MAX_SIZE_ENCODING};
2958+
use crate::enc::brotli_bit_stream::{encode_base_128, MAX_SIZE_ENCODING};
29602959

29612960
#[test]
29622961
fn test_encode_base_128() {

src/enc/context_map_entropy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ impl<'a, Alloc: alloc::Allocator<u16> + alloc::Allocator<u32> + alloc::Allocator
539539
fn literal_context_map(&self) -> &[u8] {
540540
self.context_map.literal_context_map.slice()
541541
}
542-
fn prediction_mode(&self) -> ::interface::LiteralPredictionModeNibble {
542+
fn prediction_mode(&self) -> crate::interface::LiteralPredictionModeNibble {
543543
self.context_map.literal_prediction_mode()
544544
}
545545
fn update_cost(

src/enc/encode.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ use alloc::Allocator;
44
use core;
55
use core::cmp::{max, min};
66

7-
use enc::input_pair::InputReferenceMut;
8-
97
use super::super::alloc;
108
use super::super::alloc::{SliceWrapper, SliceWrapperMut};
119
use super::backward_references::{
@@ -41,6 +39,7 @@ pub use super::parameters::BrotliEncoderParameter;
4139
use super::static_dict::{kNumDistanceCacheEntries, BrotliGetDictionary};
4240
use super::utf8_util::BrotliIsMostlyUTF8;
4341
use super::util::Log2FloorNonZero;
42+
use crate::enc::input_pair::InputReferenceMut;
4443

4544
//fn BrotliCreateHqZopfliBackwardReferences(m: &mut [MemoryManager],
4645
// dictionary: &[BrotliDictionary],

src/enc/ir_interpret.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub trait IRInterpreter {
1111
fn block_type(&self) -> u8;
1212
fn literal_data_at_offset(&self, index: usize) -> u8;
1313
fn literal_context_map(&self) -> &[u8];
14-
fn prediction_mode(&self) -> ::interface::LiteralPredictionModeNibble;
14+
fn prediction_mode(&self) -> crate::interface::LiteralPredictionModeNibble;
1515
fn update_cost(
1616
&mut self,
1717
stride_prior: [u8; 8],

src/enc/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ pub use alloc_stdlib::StandardAlloc;
5353
use brotli_decompressor::{CustomRead, CustomWrite};
5454
#[cfg(feature = "std")]
5555
pub use brotli_decompressor::{IntoIoReader, IoReaderWrapper, IoWriterWrapper};
56-
use enc::encode::BrotliEncoderStateStruct;
5756
pub use interface::{InputPair, InputReference, InputReferenceMut};
5857

5958
pub use self::backward_references::{
@@ -76,6 +75,7 @@ pub use self::util::floatX;
7675
pub use self::vectorization::{v256, v256i, Mem256f};
7776
#[cfg(feature = "std")]
7877
pub use self::worker_pool::{compress_worker_pool, new_work_pool, WorkerPool};
78+
use crate::enc::encode::BrotliEncoderStateStruct;
7979

8080
#[cfg(feature = "simd")]
8181
pub type s16 = core::simd::i16x16;

src/enc/multithreading.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ use std;
88
use std::sync::RwLock;
99
use std::thread::JoinHandle;
1010

11-
use enc::backward_references::UnionHasher;
12-
use enc::threading::{
11+
use crate::enc::backward_references::UnionHasher;
12+
use crate::enc::threading::{
1313
AnyBoxConstructor, BatchSpawnable, BatchSpawnableLite, BrotliEncoderThreadError, CompressMulti,
1414
CompressionThreadResult, InternalOwned, InternalSendAlloc, Joinable, Owned, OwnedRetriever,
1515
PoisonedThreadError, SendAlloc,
1616
};
17-
use enc::{BrotliAlloc, BrotliEncoderParams};
17+
use crate::enc::{BrotliAlloc, BrotliEncoderParams};
1818

1919
pub struct MultiThreadedJoinable<T: Send + 'static, U: Send + 'static>(
2020
JoinHandle<T>,

src/enc/prior_eval.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ impl<'a, Alloc: alloc::Allocator<s16> + alloc::Allocator<u32> + alloc::Allocator
856856
self.context_map.literal_context_map.slice()
857857
}
858858
#[inline]
859-
fn prediction_mode(&self) -> ::interface::LiteralPredictionModeNibble {
859+
fn prediction_mode(&self) -> crate::interface::LiteralPredictionModeNibble {
860860
self.context_map.literal_prediction_mode()
861861
}
862862
#[inline]

0 commit comments

Comments
 (0)