add profiling feature

This commit is contained in:
ConnorSkees 2020-05-01 15:43:43 -04:00
parent 1326e8f000
commit 05b78a3ddd
4 changed files with 8 additions and 2 deletions

View File

@ -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"

View File

@ -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;

View File

@ -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"))

View File

@ -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<String> {
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<String> {
let mut map = CodeMap::new();