diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index 33fa5a5033be..4b455c6fea7a 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -2028,7 +2028,7 @@ fn strip_generics_from_path(path_str: &str) -> Result { segment.push(chr); - match path.peek() { + match path.next() { Some('<') => { return Err(ResolutionFailure::MalformedGenerics( MalformedGenerics::TooManyAngleBrackets, @@ -2039,8 +2039,8 @@ fn strip_generics_from_path(path_str: &str) -> Result { - segment.push(path.next().unwrap()); + Some(chr) => { + segment.push(chr); while let Some(chr) = path.next_if(|c| *c != '>') { segment.push(chr);