mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-31 21:47:15 +03:00
Fix index out of bound in case of empty snippet
This commit is contained in:
@@ -393,7 +393,8 @@ fn check_lit(self, cx: &EarlyContext<'_>, lit: &Lit) {
|
||||
// The `line!()` macro is compiler built-in and a special case for these lints.
|
||||
let lit_snip = match snippet_opt(cx, lit.span) {
|
||||
Some(snip) => {
|
||||
if snip.contains('!') {
|
||||
// The snip could be empty in case of expand from procedure macro
|
||||
if snip.is_empty() || snip.contains('!') {
|
||||
return;
|
||||
}
|
||||
snip
|
||||
|
||||
Reference in New Issue
Block a user