-
-
Notifications
You must be signed in to change notification settings - Fork 394
Labels
bugSomething isn't workingSomething isn't working
Description
Current and expected behavior
Current behavior:
Running cargo +nightly clippy --workspace fails with result_large_err errors in kube-runtime/src/controller/mod.rs:
error: the `Err`-variant returned from this closure is very large
--> kube-runtime/src/controller/mod.rs:409:38
|
44 | ObjectNotFound(ObjectRef<DynamicObject>),
| ---------------------------------------- the largest variant contains at least 216 bytes
45 | #[error("reconciler for object {1} failed")]
46 | ReconcilerFailed(#[source] ReconcilerErr, ObjectRef<DynamicObject>),
| ------------------------------------------------------------------- the variant `ReconcilerFailed` contains at least 216 bytes
...
= help: try reducing the size of `controller::Error<...>`, for example by boxing large elements
= note: `#[deny(clippy::result_large_err)]` implied by `#[deny(clippy::all)]`
Expected behavior:
Clippy nightly should pass without errors.
Possible solution
Two options:
- Box the
ObjectRef<DynamicObject>(breaking change):
#[derive(Debug, Error)]
pub enum Error<ReconcilerErr: 'static, QueueErr: 'static> {
#[error("tried to reconcile object {0} that was not found in local store")]
ObjectNotFound(Box<ObjectRef<DynamicObject>>),
#[error("reconciler for object {1} failed")]
ReconcilerFailed(#[source] ReconcilerErr, Box<ObjectRef<DynamicObject>>),
// ...
}- Allow the lint (non-breaking):
#[derive(Debug, Error)]
#[allow(clippy::result_large_err)]
pub enum Error<ReconcilerErr: 'static, QueueErr: 'static> {
// ...
}Additional context
The ObjectRef<DynamicObject> is 216 bytes because:
ApiResource(DynamicType): 5 ×String= ~120 bytesname: String+namespace: Option<String>+extra: Extra= ~96 bytes
This also affects PR #1875's CI: https://github.com/kube-rs/kube/actions/runs/20649326753/job/59291390836
Environment
- Clippy nightly (2026-01-02)
- Reproducible on main branch
Configuration and features
kube = { version = "0.99.0", features = ["runtime"] }Affected crates
- kube-runtime
Would you like to work on fixing this bug?
maybe
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working