about summary refs log tree commit diff
path: root/src/librustdoc/html
diff options
context:
space:
mode:
authorCamelid <camelidcamel@gmail.com>2020-11-23 19:26:15 -0800
committerCamelid <camelidcamel@gmail.com>2020-12-03 14:11:37 -0800
commit07e9426efba69e8b662f2a896326b157f5d0ba2d (patch)
tree756fbbdfde3447b5145ee1b0aa790581fc165d8b /src/librustdoc/html
parente178030ea4d1b3a1e38cc53141188d2249d33cf5 (diff)
downloadrust-07e9426efba69e8b662f2a896326b157f5d0ba2d.tar.gz
rust-07e9426efba69e8b662f2a896326b157f5d0ba2d.zip
Make `length_limit` a `usize`
Diffstat (limited to 'src/librustdoc/html')
-rw-r--r--src/librustdoc/html/markdown.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs
index 6bba5036191..0e4c5410abe 100644
--- a/src/librustdoc/html/markdown.rs
+++ b/src/librustdoc/html/markdown.rs
@@ -1043,13 +1043,11 @@ impl MarkdownSummaryLine<'_> {
 ///
 /// Returns a tuple of the rendered HTML string and whether the output was shortened
 /// due to the provided `length_limit`.
-fn markdown_summary_with_limit(md: &str, length_limit: Option<u16>) -> (String, bool) {
+fn markdown_summary_with_limit(md: &str, length_limit: usize) -> (String, bool) {
     if md.is_empty() {
         return (String::new(), false);
     }
 
-    let length_limit = length_limit.unwrap_or(u16::MAX) as usize;
-
     let mut s = String::with_capacity(md.len() * 3 / 2);
     let mut text_length = 0;
     let mut stopped_early = false;
@@ -1115,7 +1113,7 @@ fn markdown_summary_with_limit(md: &str, length_limit: Option<u16>) -> (String,
 ///
 /// See [`markdown_summary_with_limit`] for details about what is rendered and what is not.
 crate fn short_markdown_summary(markdown: &str) -> String {
-    let (mut s, was_shortened) = markdown_summary_with_limit(markdown, Some(59));
+    let (mut s, was_shortened) = markdown_summary_with_limit(markdown, 59);
 
     if was_shortened {
         s.push('…');