is_ty_must_use in rustc_lint::unused::must_use - Rust
Description: Returns `Some(path)` if `ty` should be considered as “`must_use`” in the context of `expr` (`expr` is used to get the parent module, which can affect which types are considered uninhabited).

Skip to main content

## is_ty_must_use

# Function is_ty_must_use

Source

    pub fn is_ty_must_use<'tcx>(
        cx: &LateContext<'tcx>,
        ty: Ty<'tcx>,
        expr: &Expr<'_>,
        simplify_uninhabited: bool,
    ) -> IsTyMustUse

Expand description

Returns `Some(path)` if `ty` should be considered as “`must_use`” in the context of `expr` (`expr` is used to get the parent module, which can affect which types are considered uninhabited).

If `simplify_uninhabited` is true, this function considers `Result<T, Uninhabited>` and `ControlFlow<Uninhabited, T>` the same as `T` (we don’t set this yet in rustc, but expose this so clippy can use this).