Skip to content

Commit

Permalink
Check Clippy and rustfmt from CI (#176)
Browse files Browse the repository at this point in the history
* Check Clippy and rustfmt from CI

* Run clippy on --all-targets

* Fix Clippy nits

* One more Clippy nit
  • Loading branch information
sourcefrog authored Aug 11, 2022
1 parent 92a716e commit 1c8a847
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,9 @@ jobs:
key: cargo-${{ runner.os }}-${{ hashFiles('Cargo.lock') }}
- name: Build
run: cargo build --all-targets
- name: Run tests
- name: Test
run: cargo test -- --include-ignored
- name: Clippy
run: cargo clippy --all-targets -- -D clippy::all
- name: rustfmt
run: cargo fmt --all -- --check
4 changes: 2 additions & 2 deletions src/bandid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

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

use crate::errors::Error;
Expand Down Expand Up @@ -105,7 +105,7 @@ impl fmt::Display for BandId {
let mut result = String::with_capacity(self.seqs.len() * 5);
result.push('b');
for s in &self.seqs {
result.push_str(&format!("{:04}-", s));
let _ = write!(result, "{:04}-", s);
}
result.pop(); // remove the last dash
result.shrink_to_fit();
Expand Down
2 changes: 1 addition & 1 deletion src/gc_lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ mod test {
let _delete_guard = GarbageCollectionLock::new(&archive).unwrap();
let backup_result = backup(&archive, &source.live_tree(), &BackupOptions::default());
assert_eq!(
backup_result.err().expect("backup fails").to_string(),
backup_result.expect_err("backup fails").to_string(),
"Archive is locked for garbage collection"
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/transport/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl Transport for LocalTransport {
return Err(err);
}
if let Err(persist_error) = temp.persist(&full_path) {
let _ = persist_error.file.close()?;
persist_error.file.close()?;
Err(persist_error.error)
} else {
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion tests/api/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn list_dir_names() {

let url = Url::from_directory_path(temp.path()).unwrap();
dbg!(&url);
let transport = open_transport(&url.as_str()).unwrap();
let transport = open_transport(url.as_str()).unwrap();
dbg!(&transport);

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

0 comments on commit 1c8a847

Please sign in to comment.