Skip to content

Commit

Permalink
thanks clippy
Browse files Browse the repository at this point in the history
This time, one kind of warning has to be silenced as it's only relevant
if features of Rust 1.62 can be used.

For now, the silencing is done on the command-line as clippy.toml
apparently can't be used to allow specific lints.
  • Loading branch information
Byron committed Sep 23, 2022
1 parent 82fd251 commit b9937ad
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ doc: ## Run cargo doc on all crates
cargo doc
cargo doc --features=max,lean,small

clippy_args = -- -A clppy::unnecessary_lazy_evaluations # needed to silence `.then(||)` warnings, need MSRV of 1.62 to make use of it.
clippy: ## Run cargo clippy on all crates
cargo clippy --all --tests --examples
cargo clippy --all --no-default-features --features small
cargo clippy --all --no-default-features --features lean-async --tests
cargo clippy --all --tests --examples $(clippy_args)
cargo clippy --all --no-default-features --features small $(clippy_args)
cargo clippy --all --no-default-features --features lean-async --tests $(clippy_args)

check-msrv: ## run cargo msrv to validate the current msrv requirements, similar to what CI does
cd git-repository && cargo check --package git-repository --no-default-features --features async-network-client,max-performance
Expand Down
6 changes: 3 additions & 3 deletions cargo-smart-release/src/command/release/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,9 @@ fn set_version_and_update_package_dependency(
// Originally copied from [cargo release](https://github.com/crate-ci/cargo-release/blob/9633353ad5a57dbdca9a9ed6a70c1cf78fc5a51f/src/cargo.rs#L235:L263).
// The licenses are compatible.
// With adjustments.
fn find_dependency_tables<'r>(
root: &'r mut toml_edit::Table,
) -> impl Iterator<Item = (&mut dyn toml_edit::TableLike, Cow<'_, str>)> + 'r {
fn find_dependency_tables(
root: &mut toml_edit::Table,
) -> impl Iterator<Item = (&mut dyn toml_edit::TableLike, Cow<'_, str>)> + '_ {
const DEP_TABLES: &[&str] = &["dependencies", "dev-dependencies", "build-dependencies"];

root.iter_mut()
Expand Down
2 changes: 1 addition & 1 deletion git-hash/src/prefix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub enum Error {
Prefix::MIN_HEX_LEN
)]
TooShort { hex_len: usize },
#[error("An object of kind {} cannot be larger than {object_kind} in hex, but {hex_len} was requested")]
#[error("An object of kind {object_kind} cannot be larger than {} in hex, but {hex_len} was requested", object_kind.len_in_hex())]
TooLong { object_kind: crate::Kind, hex_len: usize },
}

Expand Down
4 changes: 2 additions & 2 deletions git-index/src/access.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl State {
pub fn entries_mut_with_paths(&mut self) -> impl Iterator<Item = (&mut Entry, &BStr)> {
let paths = &self.path_backing;
self.entries.iter_mut().map(move |e| {
let path = (&paths[e.path.clone()]).as_bstr();
let path = paths[e.path.clone()].as_bstr();
(e, path)
})
}
Expand All @@ -67,7 +67,7 @@ impl State {
backing: &'backing PathStorage,
) -> impl Iterator<Item = (&'state mut Entry, &'backing BStr)> {
self.entries.iter_mut().map(move |e| {
let path = (&backing[e.path.clone()]).as_bstr();
let path = backing[e.path.clone()].as_bstr();
(e, path)
})
}
Expand Down
4 changes: 2 additions & 2 deletions git-index/src/entry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ mod access {
impl Entry {
/// Return an entry's path, relative to the repository, which is extracted from its owning `state`.
pub fn path<'a>(&self, state: &'a State) -> &'a BStr {
(&state.path_backing[self.path.clone()]).as_bstr()
state.path_backing[self.path.clone()].as_bstr()
}

/// Return an entry's path using the given `backing`.
pub fn path_in<'backing>(&self, backing: &'backing crate::PathStorageRef) -> &'backing BStr {
(backing[self.path.clone()]).as_bstr()
backing[self.path.clone()].as_bstr()
}

/// Return an entry's stage.
Expand Down
2 changes: 1 addition & 1 deletion git-odb/src/store_impls/dynamic/load_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ impl super::Store {
.iter()
.map(|idx| (*idx, &self.files[*idx]))
.filter_map(|(id, file)| {
let lookup = match (&**file.files.load()).as_ref()? {
let lookup = match (**file.files.load()).as_ref()? {
types::IndexAndPacks::Index(bundle) => handle::SingleOrMultiIndex::Single {
index: bundle.index.loaded()?.clone(),
data: bundle.data.loaded().cloned(),
Expand Down

0 comments on commit b9937ad

Please sign in to comment.