pub fn mask_non_code(source: &str) -> StringExpand description
Replace comments and quoted literals with spaces while preserving offsets. 用空格替换注释和引号字面量,同时保留原始偏移量。 Blank the contents of comments, string literals and character literals. 把注释、字符串字面量与字符字面量的内容抹成空白。
The workspace’s one text rule for “what is code”: the source scanners use it so
a fn inside a comment or a brace inside a string is not read as Rust, and the
conventions gates use it so a workspace test’s fixture string mentioning
include!/std::fs is not read as a violation. Macro bodies are deliberately
left alone — the macro name and its delimiter are code, and a gate that looks
for a macro invocation has to see them.
本工作区关于“什么算代码“的唯一文本规则:源码扫描器用它,使注释里的 fn 或字符串里的花括号不被
读成 Rust;conventions 的门禁也用它,使工作区测试里夹具字符串中提到的
include!/std::fs 不被读成违规。宏内容有意保留——宏名与它的定界符是代码,而查找宏调用的
门禁必须看见它们。