rustc_hir_typeck::cast

Function check_cast

source
pub fn check_cast<'tcx>(
    tcx: TyCtxt<'tcx>,
    param_env: ParamEnv<'tcx>,
    e: &'tcx Expr<'tcx>,
    from_ty: Ty<'tcx>,
    to_ty: Ty<'tcx>,
) -> Option<CastKind>
Expand description

If a cast from from_ty to to_ty is valid, returns a Some containing the kind of the cast.

This is a helper used from clippy.