Skip to content

Simplification of Conditional Compilation Attributes #1776

@turbofish-pk

Description

@turbofish-pk

There are instances where there is room for code improvement.

The below two examples are in their original form very difficult to understand and one must check twice to know what they actually mean.

Example 1

Original

    #[cfg(all(
        target_arch = "wasm32",
        feature = "wasmbind",
        not(any(target_os = "emscripten", target_os = "wasi", target_os = "linux"))
    ))]

Simplified

#[cfg(all(
    target_arch = "wasm32",
    feature = "wasmbind",
    not(target_os = "emscripten"),
    not(target_os = "wasi"),
    not(target_os = "linux"),
))]

Example 2

Original

#[cfg(all(
    feature = "now",
    not(all(
        target_arch = "wasm32",
        feature = "wasmbind",
        not(any(target_os = "emscripten", target_os = "wasi", target_os = "linux"))
    ))
))] 

Simplified

#[cfg(all(
    feature = "now",
    any(
        not(target_arch = "wasm32"),
        not(feature = "wasmbind"),
        target_os = "emscripten",
        target_os = "wasi",
        target_os = "linux",
    )
))]

If you agree with this change, but don't have resources to implement it, then I will be happy to make those changes and submit a pr.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions