Skip to content

Commit aeadf15

Browse files
committed
Auto merge of #4486 - lzutao:fix-panic-unseparate-literals, r=flip1995
Fix index out of bound in case of empty snippet cc #4480 changelog: none
2 parents 2d7da04 + 17d445b commit aeadf15

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clippy_lints/src/misc_early.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,8 @@ impl MiscEarlyLints {
393393
// The `line!()` macro is compiler built-in and a special case for these lints.
394394
let lit_snip = match snippet_opt(cx, lit.span) {
395395
Some(snip) => {
396-
if snip.contains('!') {
396+
// The snip could be empty in case of expand from procedure macro
397+
if snip.is_empty() || snip.contains('!') {
397398
return;
398399
}
399400
snip

0 commit comments

Comments
 (0)