Skip to content

Commit 92a17d0

Browse files
committed
[chore] rayon feature clippy changes
1 parent 031e8b4 commit 92a17d0

5 files changed

Lines changed: 15 additions & 18 deletions

File tree

src/chunked/arrow_converter.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ unsafe impl Send for MasterBuilders {}
6363
unsafe impl Sync for MasterBuilders {}
6464

6565
impl MasterBuilders {
66-
pub fn writer_factory<'a>(&mut self, out_file: &PathBuf) -> ArrowWriter<File> {
66+
pub fn writer_factory(&mut self, out_file: &PathBuf) -> ArrowWriter<File> {
6767
let _out_file = fs::OpenOptions::new()
6868
.create(true)
6969
.append(true)
@@ -86,8 +86,8 @@ impl MasterBuilders {
8686
writer
8787
}
8888

89-
pub fn builders_factory<'a>(schema_path: PathBuf, instances: i16) -> Self {
90-
let schema = schema::FixedSchema::from_path(schema_path.into()).unwrap();
89+
pub fn builders_factory(schema_path: PathBuf, instances: i16) -> Self {
90+
let schema = schema::FixedSchema::from_path(schema_path).unwrap();
9191
let antal_col = schema.num_columns();
9292
let mut builders: Vec<Vec<Box<dyn ColumnBuilder + Sync + Send>>> = Vec::new();
9393

src/chunked/mod.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ pub(crate) struct Stats {
5858
pub(crate) type FnLineBreakLen = fn() -> usize;
5959
#[allow(dead_code)]
6060
pub(crate) fn line_break_len_cr() -> usize {
61-
1 as usize
61+
1_usize
6262
}
6363
#[allow(dead_code)]
6464
pub(crate) fn line_break_len_crlf() -> usize {
65-
2 as usize
65+
2_usize
6666
}
6767

6868
pub(crate) type FnFindLastLineBreak<'a> = fn(bytes: &'a [u8]) -> (bool, usize);
@@ -142,6 +142,7 @@ impl<'a, T> Iterator for IterRevolver<'a, T> {
142142
}
143143
}
144144

145+
#[allow(dead_code)]
145146
pub(crate) trait Converter<'a> {
146147
fn set_line_break_handler(&mut self, fn_line_break: FnFindLastLineBreak<'a>);
147148
fn get_line_break_handler(&self) -> FnFindLastLineBreak<'a>;
@@ -165,7 +166,7 @@ fn column_length_num_rightaligned(data: &[u8], runes: i16) -> (usize, usize) {
165166
let stop: usize = min(data.len(), runes as usize);
166167

167168
while counted_runes < runes as usize {
168-
let byten = eat.nth(0);
169+
let byten = eat.next();
169170
let bb: u8 = match byten {
170171
None => {
171172
//TODO we ran out of data,this is an error, fix later.
@@ -174,10 +175,8 @@ fn column_length_num_rightaligned(data: &[u8], runes: i16) -> (usize, usize) {
174175
Some(b) => *b,
175176
};
176177

177-
match bb {
178-
48..=57 => return (start, stop),
179-
_ => {}
180-
};
178+
if let 48..=57 = bb { return (start, stop) }
179+
181180
start += 1;
182181
counted_runes += 1;
183182
}
@@ -192,7 +191,7 @@ fn column_length_char_rightaligned(data: &[u8], runes: i16) -> (usize, usize) {
192191
let stop: usize = min(data.len(), runes as usize);
193192

194193
while counted_runes < runes as usize {
195-
let byten = eat.nth(0);
194+
let byten = eat.next();
196195
let bb: u8 = match byten {
197196
None => {
198197
//TODO we ran out of data,this is an error, fix later.

src/chunked/slicer.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl<'a> Slicer<'a> for OldSlicer<'a> {
124124

125125
match converter.finish() {
126126
Ok(x) => Result::Ok(Stats {
127-
bytes_in: bytes_in,
127+
bytes_in,
128128
bytes_out: converter.get_finish_bytes_written(),
129129
num_rows: x.num_rows,
130130
}),
@@ -145,9 +145,7 @@ fn residual_to_slice<'a>(
145145
if 0 != residue_effective_len {
146146
target_chunk_residue.copy_from_slice(&residue[0..residue_effective_len]);
147147
}
148-
let mut r: Vec<&[u8]> = vec![];
149-
150-
r.push(target_chunk_residue);
148+
let r: Vec<&[u8]> = vec![target_chunk_residue];
151149
r
152150
}
153151

src/cli.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ impl Cli {
274274
in_file,
275275
out_file,
276276
} => {
277-
let _in_file = fs::File::open(&in_file)?;
277+
let _in_file = fs::File::open(in_file)?;
278278

279279
let mut slicer_instance: Box<dyn Slicer> = Box::new(OldSlicer {
280280
fn_find_last_nl: find_last_nl,
@@ -313,7 +313,7 @@ impl Cli {
313313
let stats = slicer_instance.slice_and_convert(
314314
converter_instance,
315315
_in_file,
316-
n_threads as usize,
316+
n_threads,
317317
)?;
318318

319319
info!(

src/converter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ impl Converter {
232232
fn spawn_convert_threads(
233233
&mut self,
234234
buffer: &Vec<u8>,
235-
line_breaks: &Vec<usize>,
235+
line_breaks: &[usize],
236236
thread_workloads: &Vec<(usize, usize)>,
237237
) -> Result<()> {
238238
let (sender, receiver) = channel::bounded(self.thread_channel_capacity);

0 commit comments

Comments
 (0)