mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
Fix index out of bound in case of empty snippet
This commit is contained in:
parent
1f9993729b
commit
17d445b66d
1 changed files with 2 additions and 1 deletions
|
@ -393,7 +393,8 @@ impl MiscEarlyLints {
|
||||||
// The `line!()` macro is compiler built-in and a special case for these lints.
|
// The `line!()` macro is compiler built-in and a special case for these lints.
|
||||||
let lit_snip = match snippet_opt(cx, lit.span) {
|
let lit_snip = match snippet_opt(cx, lit.span) {
|
||||||
Some(snip) => {
|
Some(snip) => {
|
||||||
if snip.contains('!') {
|
// The snip could be empty in case of expand from procedure macro
|
||||||
|
if snip.is_empty() || snip.contains('!') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
snip
|
snip
|
||||||
|
|
Loading…
Reference in a new issue