Skip to content

Commit 76617b0

Browse files
committed
avoid redundant initialization
1 parent 2b12594 commit 76617b0

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

src/finding.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,9 @@ impl FindingCollection {
345345
last_str_is_incomplete: false,
346346
};
347347
fc.v.push(Finding {
348-
filename: filename,
348+
filename,
349349
ptr: text_ptr,
350-
mission: mission,
350+
mission,
351351
s: String::with_capacity(FINDING_STR_CAPACITY),
352352
});
353353

@@ -385,9 +385,9 @@ impl FindingCollection {
385385
let filename = self.v.last().unwrap().filename;
386386
if !self.v.last().unwrap().s.is_empty() {
387387
self.v.push(Finding {
388-
filename: filename,
388+
filename,
389389
ptr: text_ptr,
390-
mission: mission,
390+
mission,
391391
s: String::with_capacity(FINDING_STR_CAPACITY),
392392
});
393393
} else {

src/mission.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ impl UnicodeBlockFilter {
5959

6060
pub fn new2(and_mask: u32, and_result: u32, is_some: bool) -> Self {
6161
UnicodeBlockFilter {
62-
and_mask: and_mask,
63-
and_result: and_result,
64-
is_some: is_some,
62+
and_mask,
63+
and_result,
64+
is_some,
6565
}
6666
}
6767
}
@@ -243,17 +243,17 @@ impl Missions {
243243
v.push(Mission {
244244
// For ASCII with `-c i` we use our own decoder
245245
encoding: ASCII_GRAPHIC as encoding::EncodingRef,
246-
nbytes_min: nbytes_min,
247-
filter1: filter1,
248-
filter2: filter2,
246+
nbytes_min,
247+
filter1,
248+
filter2,
249249
enable_filter: unicode_filtering,
250250
})
251251
} else {
252252
v.push(Mission {
253253
encoding: encoding::all::ASCII as encoding::EncodingRef,
254-
nbytes_min: nbytes_min,
255-
filter1: filter1,
256-
filter2: filter2,
254+
nbytes_min,
255+
filter1,
256+
filter2,
257257
enable_filter: control_char_filtering || unicode_filtering,
258258
})
259259
}
@@ -263,9 +263,9 @@ impl Missions {
263263
v.push(match encoding_from_whatwg_label(enc_name) {
264264
Some(enc) => Mission {
265265
encoding: enc,
266-
filter1: filter1,
267-
filter2: filter2,
268-
nbytes_min: nbytes_min,
266+
filter1,
267+
filter2,
268+
nbytes_min,
269269
enable_filter: control_char_filtering || unicode_filtering,
270270
},
271271
None => {
@@ -280,7 +280,7 @@ impl Missions {
280280
});
281281
}
282282

283-
Missions { v: v }
283+
Missions { v }
284284
}
285285

286286
/// Return the number of `Mission`s stored.

src/scanner.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl<'a> ScannerPool<'a> {
128128
pub fn new(missions: &'static Missions, tx: &'a SyncSender<FindingCollection>) -> Self {
129129
let n_threads = missions.len();
130130
let v = Vec::new();
131-
let mut ms = ScannerStates { v: v };
131+
let mut ms = ScannerStates { v };
132132
for i in 0..n_threads {
133133
ms.v.push(ScannerState {
134134
offset: 0,
@@ -524,7 +524,7 @@ mod tests {
524524
mission: &MISSIONS.v[0],
525525
s: "\u{2691}TUSH".to_string(),
526526
}],
527-
completes_last_str: completes_last_str,
527+
completes_last_str,
528528
last_str_is_incomplete: false,
529529
};
530530

0 commit comments

Comments
 (0)