Skip to main content

side_effect

Function side_effect 

Source
pub fn side_effect<F>(expr: &Expr, is_builtin: F) -> SideEffect
where F: Fn(&str) -> bool,
Expand description

Return whether expr has no side effects, maybe has side effects, or definitely has side effects.

Unlike contains_effect, which returns a simple bool, this function distinguishes between expressions that are definitely side-effect-free, definitely side-effectful, and those that may invoke user-defined code (e.g., formatting a non-literal f-string interpolation can call __format__ or __str__).