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
There is this question on Stackoverflow which has the following code:
println!("\033[93mError\033[0m");
and the person (coming with a python background) is confused why Rust doesn't print it colored.
The obvious solution would be to use a crate to do the the work ;)
Categories (optional)
Kind: clippy::suspicious
What is the advantage of the recommended code over the original code
Correctly write ASCII escape characters and possible other bytes.
Drawbacks
If you intentionnaly would like to write "\033" this lint would fire. But I doubt that somebody would like to insert a null-byte into their string, so this is probably worth a #[allow(clippy::zzz)]
Example
println!("\033[93mError\033[0m");
Could be written as:
println!("\x1b[93mError\x1b[0m");
The text was updated successfully, but these errors were encountered:
What it does
There is this question on Stackoverflow which has the following code:
and the person (coming with a python background) is confused why Rust doesn't print it colored.
The obvious solution would be to use a crate to do the the work ;)
Categories (optional)
clippy::suspicious
What is the advantage of the recommended code over the original code
Correctly write ASCII escape characters and possible other bytes.
Drawbacks
If you intentionnaly would like to write
"\033"
this lint would fire. But I doubt that somebody would like to insert a null-byte into their string, so this is probably worth a#[allow(clippy::zzz)]
Example
Could be written as:
The text was updated successfully, but these errors were encountered: