Fix unnecessary keyword intern dogfood

This commit is contained in:
Cameron Steffen 2020-12-29 15:43:18 -06:00
parent 121c65f0cf
commit 76ccfb4ae2

View file

@ -10,7 +10,8 @@ use rustc_lexer::unescape::{self, EscapeError};
use rustc_lint::{EarlyContext, EarlyLintPass};
use rustc_parse::parser;
use rustc_session::{declare_tool_lint, impl_lint_pass};
use rustc_span::{sym, BytePos, Span, Symbol};
use rustc_span::symbol::kw;
use rustc_span::{sym, BytePos, Span};
declare_clippy_lint! {
/// **What it does:** This lint warns when you use `println!("")` to
@ -301,7 +302,7 @@ impl EarlyLintPass for Write {
}
} else if mac.path == sym!(writeln) {
if let (Some(fmt_str), expr) = self.check_tts(cx, mac.args.inner_tokens(), true) {
if fmt_str.symbol == Symbol::intern("") {
if fmt_str.symbol == kw::Empty {
let mut applicability = Applicability::MachineApplicable;
// FIXME: remove this `#[allow(...)]` once the issue #5822 gets fixed
#[allow(clippy::option_if_let_else)]
@ -484,7 +485,7 @@ impl Write {
fn lint_println_empty_string(&self, cx: &EarlyContext<'_>, mac: &MacCall) {
if let (Some(fmt_str), _) = self.check_tts(cx, mac.args.inner_tokens(), false) {
if fmt_str.symbol == Symbol::intern("") {
if fmt_str.symbol == kw::Empty {
let name = mac.path.segments[0].ident.name;
span_lint_and_sugg(
cx,