Fix clippy on macOS with current stable: dead_code on Overrides::is_set, needless_range_loop in cut_edge

Overrides::is_set is only called from main under cfg(not(macos)), so it is allowed to be unused there (the repo's cfg_attr pattern). settle_cut_edges walks blended with iter_mut().enumerate() instead of indexing it.
This commit is contained in:
Taha-Mahmoodi
2026-11-17 16:48:13 +04:30
parent 6d5767bf10
commit 92a2d2de71
2 changed files with 3 additions and 2 deletions
+1
View File
@@ -54,6 +54,7 @@ fn flag_value(flag: &str, arg: &str, args: &mut impl Iterator<Item = String>) ->
impl Overrides {
/// Whether a flag or a variable set the present mode or the frame latency.
#[cfg_attr(target_os = "macos", allow(dead_code))] // its one caller, in `main`, is not built on macOS
pub fn is_set(&self) -> bool {
*self != Self::default()
}
+2 -2
View File
@@ -607,7 +607,7 @@ pub(crate) fn settle_cut_edges(q: &mut Quantized, img: &Raster, gray: bool) -> V
let edge = cut_edge(img);
let mut changed = false;
let mut stack: Vec<(usize, usize)> = Vec::new();
for i in 0..w * h {
for (i, blend) in blended.iter_mut().enumerate() {
let mine = q.labels[i];
if mine == TRANSPARENT || !edge.get(i).copied().unwrap_or(false) {
continue;
@@ -630,7 +630,7 @@ pub(crate) fn settle_cut_edges(q: &mut Quantized, img: &Raster, gray: bool) -> V
}
}
});
blended[i] = !near.is_empty();
*blend = !near.is_empty();
if keep || near.is_empty() {
continue;
}