Take the layer-chain test's closure down to &dyn Operation
`clippy::borrowed_box` is denied by the workspace lint set, and the closure added with the optics exclusion took `&Box<dyn Operation>` — a borrow of the box rather than of the thing in it, which says nothing the plain trait object does not. Caught by `cargo clippy --workspace --all-targets -- -D warnings`, which is what CI runs and what the workspace tests do not: a lint on test code only appears when the tests are compiled as a clippy target. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1500,7 +1500,7 @@ mod tests {
|
|||||||
let ids: Vec<&str> = layer.capabilities().iter().map(|c| c.id.0).collect();
|
let ids: Vec<&str> = layer.capabilities().iter().map(|c| c.id.0).collect();
|
||||||
|
|
||||||
let global = crate::ops::chain();
|
let global = crate::ops::chain();
|
||||||
let local_means_something = |op: &Box<dyn Operation>| {
|
let local_means_something = |op: &dyn Operation| {
|
||||||
op.detail().is_none()
|
op.detail().is_none()
|
||||||
&& !op
|
&& !op
|
||||||
.descriptor()
|
.descriptor()
|
||||||
@@ -1512,14 +1512,15 @@ mod tests {
|
|||||||
let id = op.descriptor().id.0;
|
let id = op.descriptor().id.0;
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
ids.contains(&id),
|
ids.contains(&id),
|
||||||
local_means_something(op),
|
local_means_something(op.as_ref()),
|
||||||
"{id} is offered as a local adjustment but cannot meaningfully \
|
"{id} is offered as a local adjustment but cannot meaningfully \
|
||||||
be one, or is an ordinary point operation and has gone \
|
be one, or is an ordinary point operation and has gone \
|
||||||
missing from a layer"
|
missing from a layer"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
assert!(
|
assert!(
|
||||||
ids.len() < global.len() || global.iter().all(local_means_something),
|
ids.len() < global.len()
|
||||||
|
|| global.iter().all(|op| local_means_something(op.as_ref())),
|
||||||
"the filter dropped nothing, so either it is not running or the \
|
"the filter dropped nothing, so either it is not running or the \
|
||||||
chain has nothing left that a layer cannot carry"
|
chain has nothing left that a layer cannot carry"
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user