Skip to content

Box ErrorKind within RequestError to fix oversize lint #2079

Merged
thomas-zahner merged 5 commits into
lycheeverse:masterfrom
rina-forks:box-requesterror
Mar 9, 2026
Merged

Box ErrorKind within RequestError to fix oversize lint #2079
thomas-zahner merged 5 commits into
lycheeverse:masterfrom
rina-forks:box-requesterror

Conversation

@katrinafyi

@katrinafyi katrinafyi commented Mar 7, 2026

Copy link
Copy Markdown
Member

I also tried changing uses of RequestError to Box<RequestError>, but that was a much bigger change.

Should fix this:

error: the `Err`-variant returned from this closure is very large
   --> lychee-lib/src/utils/request.rs:117:14
    |
117 |           .map(|raw_uri| {
    |  ______________^
118 | |             create_request(&raw_uri, source, root_dir, base, extractor)
119 | |                 .map_err(|e| RequestError::CreateRequestItem(raw_uri.clone(), source.clone(), e))
120 | |         })
    | |_________^
    |
   ::: lychee-lib/src/types/request_error.rs:17:5
    |
 17 |       CreateRequestItem(RawUri, ResolvedInputSource, #[source] ErrorKind),
    |       ------------------------------------------------------------------- the largest variant contains at least 240 bytes
...
 21 |       GetInputContent(InputSource, #[source] ErrorKind),
    |       ------------------------------------------------- the variant `GetInputContent` contains at least 184 bytes
...
 25 |       UserInputContent(InputSource, #[source] ErrorKind),
    |       -------------------------------------------------- the variant `UserInputContent` contains at least 184 bytes
...
 30 |       InputSourceError(InputSource, #[source] ErrorKind),
    |       -------------------------------------------------- the variant `InputSourceError` contains at least 184 bytes
    |
    = help: try reducing the size of `types::request_error::RequestError`, for example by boxing large elements or replacing it with `Box<types::request_error::RequestError>`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.94.0/index.html#result_large_err
    = note: `-D clippy::result-large-err` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::result_large_err)]`

This reverts commit 026b8ea.
it has 3 strings, each of which is at least 3 words due to length,
capacity, and buffer pointer
@thomas-zahner

Copy link
Copy Markdown
Member

Thanks 🚀

@thomas-zahner thomas-zahner merged commit 5807c8b into lycheeverse:master Mar 9, 2026
7 checks passed
@mre mre mentioned this pull request Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants