Skip to content

Commit

Permalink
clippy: disable bogus lints for nightly clippy
Browse files Browse the repository at this point in the history
The nightly compiler has several clippy fix-its that, if applied, break the
build. There are various bugs about this, but there isn't enough space in the
margins to detail it all.

Just ignore these on a per-function basis; about 70% of them are just multiple
instances happening inside a single function.

This makes `cargo clippy --workspace --all-targets` run clean, even with the
nightly compiler.

Signed-off-by: Austin Seipp <[email protected]>
Change-Id: Ic26a025d3c62b12fbf096171308b56e38f7d1bb9
  • Loading branch information
thoughtpolice committed Apr 4, 2024
1 parent 69d38fb commit 1105366
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cli/src/commit_templater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,8 @@ impl RefNamesIndex {
}
}

#[allow(unknown_lints)] // XXX FIXME (aseipp): nightly bogons; re-test this occasionally
#[allow(clippy::manual_unwrap_or_default)]
pub fn get(&self, id: &CommitId) -> &[RefName] {
if let Some(names) = self.index.get(id) {
names
Expand Down
2 changes: 2 additions & 0 deletions cli/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,8 @@ impl Ui {
.unwrap_or(false)
}

#[allow(unknown_lints)] // XXX FIXME (aseipp): nightly bogons; re-test this occasionally
#[allow(clippy::assigning_clones)]
pub fn prompt(&self, prompt: &str) -> io::Result<String> {
if !Self::can_prompt() {
return Err(io::Error::new(
Expand Down
2 changes: 2 additions & 0 deletions lib/src/commit_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ impl CommitBuilder<'_> {
}

/// Only called from [`MutRepo::rewrite_commit`]. Use that function instead.
#[allow(unknown_lints)] // XXX FIXME (aseipp): nightly bogons; re-test this occasionally
#[allow(clippy::assigning_clones)]
pub(crate) fn for_rewrite_from<'repo>(
mut_repo: &'repo mut MutableRepo,
settings: &UserSettings,
Expand Down
2 changes: 2 additions & 0 deletions lib/src/local_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ impl Backend for LocalBackend {
}
}

#[allow(unknown_lints)] // XXX FIXME (aseipp): nightly bogons; re-test this occasionally
#[allow(clippy::assigning_clones)]
pub fn commit_to_proto(commit: &Commit) -> crate::protos::local_store::Commit {
let mut proto = crate::protos::local_store::Commit::default();
for parent in &commit.parents {
Expand Down
2 changes: 2 additions & 0 deletions lib/src/local_working_copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,8 @@ impl TreeState {
Ok(())
}

#[allow(unknown_lints)] // XXX FIXME (aseipp): nightly bogons; re-test this occasionally
#[allow(clippy::assigning_clones)]
fn save(&mut self) -> Result<(), TreeStateError> {
let mut proto: crate::protos::working_copy::TreeState = Default::default();
match &self.tree_id {
Expand Down
4 changes: 4 additions & 0 deletions lib/src/stacked_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ impl MutableTable {
other.segment_add_entries_to(self);
}

#[allow(unknown_lints)] // XXX FIXME (aseipp): nightly bogons; re-test this occasionally
#[allow(clippy::assigning_clones)]
fn merge_in(&mut self, other: &Arc<ReadonlyTable>) {
let mut maybe_own_ancestor = self.parent_file.clone();
let mut maybe_other_ancestor = Some(other.clone());
Expand Down Expand Up @@ -281,6 +283,8 @@ impl MutableTable {
/// If the MutableTable has more than half the entries of its parent
/// ReadonlyTable, return MutableTable with the commits from both. This
/// is done recursively, so the stack of index files has O(log n) files.
#[allow(unknown_lints)] // XXX FIXME (aseipp): nightly bogons; re-test this occasionally
#[allow(clippy::assigning_clones)]
fn maybe_squash_with_ancestors(self) -> MutableTable {
let mut num_new_entries = self.entries.len();
let mut files_to_squash = vec![];
Expand Down

0 comments on commit 1105366

Please sign in to comment.