Skip to content

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

Closed
@XAMPPRocky

Description

@XAMPPRocky

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.

Metadata

Metadata

Assignees

Labels

A-lintArea: New lintsE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions