sentry_backtrace/
trim.rs

1use crate::utils::function_starts_with;
2
3const WELL_KNOWN_NOT_IN_APP: &[&str] = &[
4    // standard library and sentry crates
5    "std::",
6    "core::",
7    "alloc::",
8    "backtrace::",
9    "sentry::",
10    "sentry_core::",
11    "sentry_types::",
12    "sentry_backtrace::",
13    "sentry_tracing::",
14    // these are not modules but things like __rust_maybe_catch_panic
15    "__rust_",
16    "___rust_",
17    "rust_begin_unwind",
18    "_start",
19    // these are well-known library frames
20    "anyhow::",
21    "log::",
22    "tokio::",
23    "tracing_core::",
24    "futures_core::",
25    "futures_util::",
26];
27
28/// Checks if a function is from a module that shall be considered not in-app by default
29pub fn is_well_known_not_in_app(func: &str) -> bool {
30    WELL_KNOWN_NOT_IN_APP
31        .iter()
32        .any(|m| function_starts_with(func, m))
33}