peel_parent_while in rustc_lint::non_local_def - Rust
Description: Given a `DefId` checks if it satisfies `f` if it does check with it’s parent and continue until it doesn’t satisfies `f` and return the last `DefId` checked.

Skip to main content

## peel_parent_while

# Function peel_parent_while

Source

    fn peel_parent_while(
        tcx: TyCtxt<'_>,
        did: DefId,
        f: impl FnMut(TyCtxt<'_>, DefId) -> bool,
    ) -> Option<DefId>

Expand description

Given a `DefId` checks if it satisfies `f` if it does check with it’s parent and continue until it doesn’t satisfies `f` and return the last `DefId` checked.

In other word this method return the first `DefId` that doesn’t satisfies `f`.