Skip to content

Commit

Permalink
Merge pull request #213 from dmarriner/master
Browse files Browse the repository at this point in the history
Color user-defined async functions correctly for Rust coloring
  • Loading branch information
jonhoo authored May 26, 2021
2 parents 98bc13d + 0291e6b commit 7ecd6e1
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/flamegraph/color/palettes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ pub(super) mod rust {
if name.starts_with("core::")
|| name.starts_with("std::")
|| name.starts_with("alloc::")
|| name.starts_with("<core::")
|| (name.starts_with("<core::")
// Rust user-defined async functions are desugared into
// GenFutures so we don't want to include those as Rust
// system functions
&& !name.starts_with("<core::future::from_generator::GenFuture<T>"))
|| name.starts_with("<std::")
|| name.starts_with("<alloc::")
{
Expand Down Expand Up @@ -512,6 +516,12 @@ mod tests {
input: String::from("<core::something as something::else"),
output: BasicPalette::Orange,
},
TestData {
input: String::from(
"<core::future::from_generator::GenFuture<T> as something::else",
),
output: BasicPalette::Aqua,
},
TestData {
input: String::from("<std::something something::else"),
output: BasicPalette::Orange,
Expand Down

0 comments on commit 7ecd6e1

Please sign in to comment.