diff --git a/Cargo.toml b/Cargo.toml index 6f1bc12..30d6355 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,6 +44,8 @@ nightly = [] random = ["rand"] # Option: compile to web assembly wasm = ["wasm-bindgen"] +# Option: enable features that assist in profiling (e.g. inline(never)) +profiling = [] [dev-dependencies] tempfile = "3" diff --git a/src/lib.rs b/src/lib.rs index 26b2845..75ff116 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -80,6 +80,7 @@ grass input.scss clippy::redundant_pub_crate, )] #![cfg_attr(feature = "nightly", feature(track_caller))] +#![cfg_attr(feature = "profiling", inline(never))] use std::iter::Iterator; diff --git a/src/main.rs b/src/main.rs index 1691a85..10d330a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,6 +21,7 @@ arg_enum! { } } +#[cfg_attr(feature = "profiling", inline(never))] fn main() -> std::io::Result<()> { let matches = App::new("grass") .version(env!("CARGO_PKG_VERSION")) diff --git a/src/stylesheet.rs b/src/stylesheet.rs index d2c8732..aff2527 100644 --- a/src/stylesheet.rs +++ b/src/stylesheet.rs @@ -71,7 +71,8 @@ impl StyleSheet { /// Ok(()) /// } /// ``` - #[inline] + #[cfg_attr(feature = "profiling", inline(never))] + #[cfg_attr(not(feature = "profiling"), inline)] #[cfg(not(feature = "wasm"))] pub fn new(input: String) -> SassResult { let mut map = CodeMap::new(); @@ -102,7 +103,8 @@ impl StyleSheet { /// Ok(()) /// } /// ``` - #[inline] + #[cfg_attr(feature = "profiling", inline(never))] + #[cfg_attr(not(feature = "profiling"), inline)] #[cfg(not(feature = "wasm"))] pub fn from_path(p: &str) -> SassResult { let mut map = CodeMap::new();