Skip to main content

opt_must_use_path

Function opt_must_use_path 

Source
pub fn opt_must_use_path<'tcx>(
    cx: &LateContext<'tcx>,
    ty: Ty<'tcx>,
) -> Option<MustUsePath>
Expand description

Returns whether the ty has #[must_use] attribute, or acts like it does according to the compiler determination. For example, if ty is a Result/ControlFlow whose Err/Break payload is an uninhabited type, the Ok/Continue payload type will be used instead.

The MustUsePath can be used to describe the type through describe_must_use_type.