Skip to content

Commit 1c8a847

Browse files
authored
Check Clippy and rustfmt from CI (#176)
* Check Clippy and rustfmt from CI * Run clippy on --all-targets * Fix Clippy nits * One more Clippy nit
1 parent 92a716e commit 1c8a847

File tree

5 files changed

+10
-6
lines changed

5 files changed

+10
-6
lines changed

.github/workflows/rust.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,9 @@ jobs:
3939
key: cargo-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}
4040
- name: Build
4141
run: cargo build --all-targets
42-
- name: Run tests
42+
- name: Test
4343
run: cargo test -- --include-ignored
44+
- name: Clippy
45+
run: cargo clippy --all-targets -- -D clippy::all
46+
- name: rustfmt
47+
run: cargo fmt --all -- --check

src/bandid.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
//! Bands are identified by a string like `b0001-0023`, represented by a `BandId` object.
1515
16-
use std::fmt;
16+
use std::fmt::{self, Write};
1717
use std::str::FromStr;
1818

1919
use crate::errors::Error;
@@ -105,7 +105,7 @@ impl fmt::Display for BandId {
105105
let mut result = String::with_capacity(self.seqs.len() * 5);
106106
result.push('b');
107107
for s in &self.seqs {
108-
result.push_str(&format!("{:04}-", s));
108+
let _ = write!(result, "{:04}-", s);
109109
}
110110
result.pop(); // remove the last dash
111111
result.shrink_to_fit();

src/gc_lock.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ mod test {
138138
let _delete_guard = GarbageCollectionLock::new(&archive).unwrap();
139139
let backup_result = backup(&archive, &source.live_tree(), &BackupOptions::default());
140140
assert_eq!(
141-
backup_result.err().expect("backup fails").to_string(),
141+
backup_result.expect_err("backup fails").to_string(),
142142
"Archive is locked for garbage collection"
143143
);
144144
}

src/transport/local.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl Transport for LocalTransport {
9797
return Err(err);
9898
}
9999
if let Err(persist_error) = temp.persist(&full_path) {
100-
let _ = persist_error.file.close()?;
100+
persist_error.file.close()?;
101101
Err(persist_error.error)
102102
} else {
103103
Ok(())

tests/api/transport.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fn list_dir_names() {
3030

3131
let url = Url::from_directory_path(temp.path()).unwrap();
3232
dbg!(&url);
33-
let transport = open_transport(&url.as_str()).unwrap();
33+
let transport = open_transport(url.as_str()).unwrap();
3434
dbg!(&transport);
3535

3636
let ListDirNames { mut files, dirs } = transport.list_dir_names("").unwrap();

0 commit comments

Comments
 (0)