Skip to content

Commit bf03c66

Browse files
committed
cargo clippy project
1 parent f5fdb99 commit bf03c66

31 files changed

+293
-249
lines changed

README.md

Lines changed: 248 additions & 204 deletions
Large diffs are not rendered by default.

src/all.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::http::Resp;
99
pub fn all() {
1010
let files = file::get_all_bin_file();
1111

12-
let mut v = Vec::<Resp>::with_capacity(files.len());
12+
let v = Vec::<Resp>::with_capacity(files.len());
1313

1414
let x = Arc::new(Mutex::new(v));
1515
let mut handlers = vec![];
@@ -26,14 +26,15 @@ pub fn all() {
2626

2727
handlers.push(thread::spawn(move || {
2828
for i in files {
29+
println!("{} downloading", i);
2930
let resp = crate::http::get_question_info(&i);
3031
x.lock().unwrap().push(resp);
3132
}
3233
}))
3334
}
3435

3536
for i in handlers {
36-
i.join();
37+
i.join().unwrap();
3738
}
3839

3940
crate::file::write_readme(&mut *x.lock().unwrap());

src/bin/boats-to-save-people.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl Solution {
4444
count
4545
}
4646

47-
pub fn num_rescue_boats(mut people: Vec<i32>, limit: i32) -> i32 {
47+
pub fn num_rescue_boats(people: Vec<i32>, limit: i32) -> i32 {
4848
let mut v = vec![0; (limit + 1) as usize];
4949

5050
for i in people {

src/bin/climbing-stairs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::ptr::hash;
1+
22

33
fn main() {}
44

@@ -12,7 +12,7 @@ impl Solution {
1212

1313
let (mut a, mut b) = (1, 2);
1414

15-
for i in 3..=n {
15+
for _i in 3..=n {
1616
let a1 = a;
1717
a = b;
1818
b = a1 + b;

src/bin/combination-sum.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl Solution {
2222
v.push(i);
2323
r.push(v);
2424
} else if i < target {
25-
let mut x = Self::calc(&candidates, target - i);
25+
let x = Self::calc(&candidates, target - i);
2626
for mut m in x {
2727
if !m.is_empty() {
2828
if i >= *m.last().unwrap() {

src/bin/construct-binary-search-tree-from-preorder-traversal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl TreeNode {
2323
}
2424

2525
use std::cell::RefCell;
26-
use std::ops::Deref;
26+
2727
use std::rc::Rc;
2828

2929
struct Solution;

src/bin/count-complete-tree-nodes.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ impl TreeNode {
2121
}
2222
}
2323

24-
use std::arch::x86_64::_mm_xor_pd;
24+
2525
use std::cell::RefCell;
26-
use std::cmp::{max, min};
26+
2727
use std::rc::Rc;
2828

2929
impl Solution {
@@ -70,7 +70,7 @@ impl Solution {
7070
}
7171

7272
while max_count - min_count > 1 {
73-
let mut middle = (min_count + max_count) / 2;
73+
let middle = (min_count + max_count) / 2;
7474

7575
let e = exists(root.as_ref(), middle, level);
7676
if e {

src/bin/fei-bo-na-qi-shu-lie-lcof.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ impl Solution {
88
return n;
99
}
1010
let (mut last, mut result) = (1, 1);
11-
for i in 2..n {
11+
for _i in 2..n {
1212
let result1 = result + last;
1313
last = result;
1414
result = result1 % 1000000007;

src/bin/find-k-closest-elements.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ impl Solution {
2727
}
2828

2929
let index = Self::split(&arr, x);
30-
let (mut start, mut end, mut k) = (index, index, k as usize);
30+
let (mut start, mut end, k) = (index, index, k as usize);
3131
while end - start < k - 1 {
3232
if start == 0 {
3333
end += 1;

src/bin/group-anagrams.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ impl Solution {
1616
.or_insert(vec![i]);
1717
}
1818

19-
hash.into_iter().map(|(x, y)| y).collect()
19+
hash.into_iter().map(|(_x, y)| y).collect()
2020
}
2121

2222
// 计算字母出现的个数
@@ -37,6 +37,6 @@ impl Solution {
3737
}
3838
}
3939

40-
hash.into_iter().map(|(x, y)| y).collect()
40+
hash.into_iter().map(|(_x, y)| y).collect()
4141
}
4242
}

0 commit comments

Comments
 (0)