mirror of
https://github.com/rust-lang/rust
synced 2024-10-01 22:34:35 +00:00
impl: specialize impl of ToString
on bool
This commit is contained in:
parent
3254bef9a7
commit
203bbfa2f7
|
@ -2548,6 +2548,15 @@ fn to_string(&self) -> String {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(no_global_oom_handling))]
|
||||||
|
#[stable(feature = "bool_to_string_specialization", since = "CURRENT_RUSTC_VERSION")]
|
||||||
|
impl ToString for bool {
|
||||||
|
#[inline]
|
||||||
|
fn to_string(&self) -> String {
|
||||||
|
String::from(if *self { "true" } else { "false" })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(not(no_global_oom_handling))]
|
#[cfg(not(no_global_oom_handling))]
|
||||||
#[stable(feature = "u8_to_string_specialization", since = "1.54.0")]
|
#[stable(feature = "u8_to_string_specialization", since = "1.54.0")]
|
||||||
impl ToString for u8 {
|
impl ToString for u8 {
|
||||||
|
|
Loading…
Reference in a new issue