Skip to content

Commit 56fcd59

Browse files
committed
Document the unsafe
1 parent 1bb0872 commit 56fcd59

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

library/core/src/displaywrapper.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ impl<T: Displayable> Display for DisplayWrapper<T> {
187187
buf[cur] = b'-';
188188
}
189189
}
190+
// SAFETY: The buffer is initially ASCII and we only write ASCII bytes to it.
190191
let s = unsafe { core::str::from_utf8_unchecked(&buf[cur..]) };
191192
f.write_str(s)
192193
}

0 commit comments

Comments
 (0)