Skip to main content

strip_comments

Function strip_comments 

Source
pub fn strip_comments(line: &str) -> &str
Expand description

Everything after // on a line, gone.

This is what separates prose from code for every scanner here, and // covers /// and //! as well, so a doc comment that names a quarantined type — including a working intra-doc link to it — is not a use of it.

Deliberately crude, with two stated limits: a // inside a string literal truncates the line early, which can only ever hide a hit on that same line; and block comments are not stripped, because the workspace uses none in item bodies.