Skip to content

Commit 7890c82

Browse files
bors[bot]CAD97
andauthored
Merge #30
30: Don't use decimal numbers when str length overflows TextSize. r=matklad a=CAD97 Since the string is necessarily longer than 4,294,967,296 bytes, it is probably more useful to output the length in hexadecimal. For additional niceness, we output the first and last 10 characters. Co-authored-by: CAD97 <[email protected]>
2 parents f8a73ed + 9332ee9 commit 7890c82

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/traits.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ pub trait LenTextSize: Copy {
1212
impl LenTextSize for &'_ str {
1313
#[inline]
1414
fn len_text_size(self) -> TextSize {
15-
self.len()
16-
.try_into()
17-
.unwrap_or_else(|_| panic!("string too large ({}) for TextSize", self.len()))
15+
self.len().try_into().unwrap()
1816
}
1917
}
2018

0 commit comments

Comments
 (0)