Skip to content

Commit 06ab38f

Browse files
committed
Fix clippy lints
1 parent f1d3001 commit 06ab38f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/main.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ fn run_ascii() -> UnitResult {
225225
use std::str::FromStr;
226226

227227
let s = AsciiString::from_str("2019-07-01")?;
228-
let mut ix = s.as_str().match_indices("-");
228+
let mut ix = s.as_str().match_indices('-');
229229
let (i0, _) = ix.next().ok_or_else(|| "got none")?;
230230
let (i1, _) = ix.next().ok_or_else(|| "got none")?;
231231

@@ -255,7 +255,7 @@ fn run_bitset_fixed() {
255255
use rand::prelude::*;
256256
use rand_distr::Uniform;
257257

258-
let rng = StdRng::seed_from_u64(114514);
258+
let rng = StdRng::seed_from_u64(114_514);
259259
let dist = Uniform::from(0..2000);
260260

261261
let n = rng
@@ -345,9 +345,9 @@ fn run_rustc_hash() {
345345

346346
let mut map = [('c', "Cindy"), ('a', "Alice"), ('b', "Bob")]
347347
.iter()
348-
.map(|(c, s)| (*c, s.to_string()))
348+
.map(|&(c, s)| (c, s.to_string()))
349349
.collect::<FxHashMap<_, _>>();
350-
map.entry('d').or_insert("Denis".to_string());
350+
map.entry('d').or_insert_with(|| "Denis".to_string());
351351
map.insert('a', "Alexa".to_string());
352352
assert_eq!(map.len(), 4);
353353
}
@@ -417,6 +417,7 @@ fn calc_mean<D: rand_distr::Distribution<f64>>(rng: &mut impl rand::Rng, distr:
417417

418418
// regex and lazy_static
419419
// these codes were taken from examples on: https://docs.rs/regex/1.1.7/regex/
420+
#[allow(clippy::trivial_regex)]
420421
fn run_regex() -> UnitResult {
421422
use lazy_static::lazy_static;
422423
use regex::{Regex, RegexSet};

tests/test_jemallocator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn do_allocate_heap() -> UnitResult {
2121
use jemalloc_ctl::{epoch, stats};
2222
use rand::prelude::*;
2323

24-
const SIZE: usize = 100000;
24+
const SIZE: usize = 100_000;
2525

2626
let mut rng = SmallRng::from_rng(thread_rng())?;
2727

0 commit comments

Comments
 (0)