From 4dfebbe52d1789ed0a93786e3a6f01f79bb0386b Mon Sep 17 00:00:00 2001 From: Patrick Thomson Date: Tue, 10 Mar 2020 20:46:55 -0400 Subject: [PATCH] some whitespace and comments --- tags/src/lib.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tags/src/lib.rs b/tags/src/lib.rs index afb7e376..fa508cb1 100644 --- a/tags/src/lib.rs +++ b/tags/src/lib.rs @@ -224,11 +224,12 @@ where let config = &self.config; let tag_from_node = |node: Node, kind: TagKind| -> Option { let name = str::from_utf8(&source[name_node?.byte_range()]).ok()?; + + // Slice out the first line of the text corresponding to the node in question. let mut line_range = node.byte_range(); - if line_range.len() > 180 { - line_range.end = line_range.start + 180; - } + line_range.end = line_range.end.min(line_range.start + 180); let line = str::from_utf8(&source[line_range]).ok()?.lines().next()?; + let docs = doc_node .and_then(|n| str::from_utf8(&source[n.byte_range()]).ok()) .map(|s| {