You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
println!("{}",
"colored blue if a supported terminal"
.if_supports_color(Stdout, |text| text.bold().bright_blue()));
I get the output:
--> src/lib.rs:46:43
|
10 | .if_supports_color(Stdout, |text| text.bold().bright_blue())
| -----------^^^^^^^^^^^^^^
| |
| returns a reference to data owned by the current function
| temporary value created here
It looks like each formatter creates a temporary, causing issues if multiple formatters are applied.
I suspect this may need to be a macro rather than a function call...
The text was updated successfully, but these errors were encountered:
I will note that this issue only occurs with non-color styles. For example .bright_blue().on_red() will work (outside of being an eye sore). It's definitely possible to support this without a macro, but with my current setup that'd suck. I think possibly specializing the method to auto-convert it to a Style once you've applied both a color and a modifier (bold, italics, etc) would fix this though. I'm currently in the middle of moving but hopefully once I'm less busy I'll have time
With input:
I get the output:
It looks like each formatter creates a temporary, causing issues if multiple formatters are applied.
I suspect this may need to be a macro rather than a function call...
The text was updated successfully, but these errors were encountered: