mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-17 21:27:00 +00:00
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:
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user