Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions library/core/src/fmt/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ impl<'a, 'b: 'a> DebugStruct<'a, 'b> {
#[stable(feature = "debug_builders", since = "1.2.0")]
pub fn field(&mut self, name: &str, value: &dyn fmt::Debug) -> &mut Self {
self.result = self.result.and_then(|_| {
if self.is_pretty() {
if crate::hint::unlikely(self.is_pretty()) {
if !self.has_fields {
self.fmt.write_str(" {\n")?;
}
Expand Down Expand Up @@ -352,7 +352,7 @@ impl<'a, 'b: 'a> DebugTuple<'a, 'b> {
#[stable(feature = "debug_builders", since = "1.2.0")]
pub fn field(&mut self, value: &dyn fmt::Debug) -> &mut Self {
self.result = self.result.and_then(|_| {
if self.is_pretty() {
if crate::hint::unlikely(self.is_pretty()) {
if self.fields == 0 {
self.fmt.write_str("(\n")?;
}
Expand Down Expand Up @@ -479,7 +479,7 @@ struct DebugInner<'a, 'b: 'a> {
impl<'a, 'b: 'a> DebugInner<'a, 'b> {
fn entry(&mut self, entry: &dyn fmt::Debug) {
self.result = self.result.and_then(|_| {
if self.is_pretty() {
if crate::hint::unlikely(self.is_pretty()) {
if !self.has_fields {
self.fmt.write_str("\n")?;
}
Expand Down Expand Up @@ -1004,7 +1004,7 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
without completing the previous one"
);

if self.is_pretty() {
if crate::hint::unlikely(self.is_pretty()) {
if !self.has_fields {
self.fmt.write_str("\n")?;
}
Expand Down Expand Up @@ -1076,7 +1076,7 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
self.result = self.result.and_then(|_| {
assert!(self.has_key, "attempted to format a map value before its key");

if self.is_pretty() {
if crate::hint::unlikely(self.is_pretty()) {
let mut slot = None;
let mut writer = PadAdapter::wrap(self.fmt, &mut slot, &mut self.state);
value.fmt(&mut writer)?;
Expand Down
Loading