Skip to content

Commit 07e9426

Browse files
committed
Make length_limit a usize
1 parent e178030 commit 07e9426

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/librustdoc/html/markdown.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1043,13 +1043,11 @@ impl MarkdownSummaryLine<'_> {
10431043
///
10441044
/// Returns a tuple of the rendered HTML string and whether the output was shortened
10451045
/// due to the provided `length_limit`.
1046-
fn markdown_summary_with_limit(md: &str, length_limit: Option<u16>) -> (String, bool) {
1046+
fn markdown_summary_with_limit(md: &str, length_limit: usize) -> (String, bool) {
10471047
if md.is_empty() {
10481048
return (String::new(), false);
10491049
}
10501050

1051-
let length_limit = length_limit.unwrap_or(u16::MAX) as usize;
1052-
10531051
let mut s = String::with_capacity(md.len() * 3 / 2);
10541052
let mut text_length = 0;
10551053
let mut stopped_early = false;
@@ -1115,7 +1113,7 @@ fn markdown_summary_with_limit(md: &str, length_limit: Option<u16>) -> (String,
11151113
///
11161114
/// See [`markdown_summary_with_limit`] for details about what is rendered and what is not.
11171115
crate fn short_markdown_summary(markdown: &str) -> String {
1118-
let (mut s, was_shortened) = markdown_summary_with_limit(markdown, Some(59));
1116+
let (mut s, was_shortened) = markdown_summary_with_limit(markdown, 59);
11191117

11201118
if was_shortened {
11211119
s.push('…');

0 commit comments

Comments
 (0)