fix: extra semicolon, only create callsite once

This commit is contained in:
Jane Lusby
2018-10-24 11:49:39 -04:00
parent c209fc9349
commit f9020bb2dd
3 changed files with 5 additions and 4 deletions

View File

@@ -171,7 +171,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for StringLitAsBytes {
if path.ident.name == "as_bytes" {
if let ExprKind::Lit(ref lit) = args[0].node {
if let LitKind::Str(ref lit_content, _) = lit.node {
let callsite = snippet(cx, args[0].span.source_callsite(), "");
let callsite = snippet(cx, args[0].span.source_callsite(), r#""foo""#);
let expanded = format!("\"{}\"", lit_content.as_str());
if callsite.starts_with("include_str!") {
span_lint_and_sugg(