Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint on large std::{include_str!, include_bytes!}; calls. #7005

Closed
XAMPPRocky opened this issue Mar 30, 2021 · 2 comments · Fixed by #8727
Closed

Lint on large std::{include_str!, include_bytes!}; calls. #7005

XAMPPRocky opened this issue Mar 30, 2021 · 2 comments · Fixed by #8727
Assignees
Labels
A-lint Area: New lints E-medium Call for participation: Medium difficulty level problem and requires some initial experience.

Comments

@XAMPPRocky
Copy link
Member

XAMPPRocky commented Mar 30, 2021

What it does

At Embark we've been doing some optimisations on the size of the final output of our binaries, and one thing that we thought there could be lint to help with this process. The lint will warn you when you have a have included a large enough file, that might significantly contribute to the size of the final binary.

Categories (optional)

  • Kind: pedantic

What is the advantage of the recommended code over the original code

For example:

  • It allows you to easily find locations in code that contribute heavily to your final binary size, allowing you to slim down your size by optimising or removing your included assets.

Drawbacks

None.

Unresolved Questions

  • How big of a file should be linted against? Every project has different definition of what size is too large. This might be configurable in a world where there's a clippy.toml but assuming that isn't an option, are there good defaults we can use instead?
    • My initial thinking was that there could be two lints clippy::large_include_files and clippy::very_large_include_files which are the same lint but set to two different limits (e.g. >1MB and >10MB), so people can choose what's considered too much for their project.
@XAMPPRocky XAMPPRocky added the A-lint Area: New lints label Mar 30, 2021
@camsteffen camsteffen added the E-medium Call for participation: Medium difficulty level problem and requires some initial experience. label May 3, 2021
@Serial-ATA
Copy link
Contributor

@rustbot claim

@Serial-ATA
Copy link
Contributor

@camsteffen Would it be alright to include a large test asset for this? And should it go in the auxiliary folder?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints E-medium Call for participation: Medium difficulty level problem and requires some initial experience.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants