• Ephera@lemmy.ml
    link
    fedilink
    English
    arrow-up
    2
    ·
    7 months ago

    many crates include items for windows which I don’t necessarily need (but there’s no official way to tell cargo that).

    The Rust libraries should be marking such code with #[cfg(target_os = "windows")] or similar. And then dependending on what target you compile for, it’ll be included or not. When you compile without specifying a target, then it will target your current OS and therefore not include the Windows-only code, when you compile on Linux or macOS.