FUNCTION_CASTS_AS_INTEGER in rustc_lint::function_cast_as_integer - Rust
Description: The `function_casts_as_integer` lint detects cases where a function item is cast to an integer.

Skip to main content

## FUNCTION_CASTS_AS_INTEGER

# Static FUNCTION_CASTS_AS_INTEGER

Source

    pub static FUNCTION_CASTS_AS_INTEGER: &Lint

Expand description

The `function_casts_as_integer` lint detects cases where a function item is cast to an integer.

#### §Example

    fn foo() {}
    let x = foo as usize;

{{produces}}

#### §Explanation

When casting a function item to an integer, it implicitly creates a function pointer that will in turn be cast to an integer. By making it explicit, it improves readability of the code and prevents bugs.