Skip to content

Commit 3a1b0d3

Browse files
committed
1 parent 7a943a9 commit 3a1b0d3

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

clippy_lints/src/attrs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ fn check_attrs(cx: &LateContext<'_, '_>, span: Span, name: Name, attrs: &[Attrib
424424
};
425425

426426
if attr.style == AttrStyle::Outer {
427-
if attr_item.tokens.is_empty() || !is_present_in_source(cx, attr.span) {
427+
if attr_item.args.inner_tokens().is_empty() || !is_present_in_source(cx, attr.span) {
428428
return;
429429
}
430430

clippy_lints/src/dbg_macro.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ declare_lint_pass!(DbgMacro => [DBG_MACRO]);
3232
impl EarlyLintPass for DbgMacro {
3333
fn check_mac(&mut self, cx: &EarlyContext<'_>, mac: &ast::Mac) {
3434
if mac.path == sym!(dbg) {
35-
if let Some(sugg) = tts_span(mac.tts.clone()).and_then(|span| snippet_opt(cx, span)) {
35+
if let Some(sugg) = tts_span(mac.args.inner_tokens().clone()).and_then(|span| snippet_opt(cx, span)) {
3636
span_lint_and_sugg(
3737
cx,
3838
DBG_MACRO,
39-
mac.span,
39+
mac.span(),
4040
"`dbg!` macro is intended as a debugging tool",
4141
"ensure to avoid having uses of it in version control",
4242
sugg,
@@ -46,7 +46,7 @@ impl EarlyLintPass for DbgMacro {
4646
span_help_and_lint(
4747
cx,
4848
DBG_MACRO,
49-
mac.span,
49+
mac.span(),
5050
"`dbg!` macro is intended as a debugging tool",
5151
"ensure to avoid having uses of it in version control",
5252
);

clippy_lints/src/write.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,13 @@ declare_lint_pass!(Write => [
189189
impl EarlyLintPass for Write {
190190
fn check_mac(&mut self, cx: &EarlyContext<'_>, mac: &Mac) {
191191
if mac.path == sym!(println) {
192-
span_lint(cx, PRINT_STDOUT, mac.span, "use of `println!`");
193-
if let (Some(fmt_str), _) = check_tts(cx, &mac.tts, false) {
192+
span_lint(cx, PRINT_STDOUT, mac.span(), "use of `println!`");
193+
if let (Some(fmt_str), _) = check_tts(cx, &mac.args.inner_tokens(), false) {
194194
if fmt_str.symbol == Symbol::intern("") {
195195
span_lint_and_sugg(
196196
cx,
197197
PRINTLN_EMPTY_STRING,
198-
mac.span,
198+
mac.span(),
199199
"using `println!(\"\")`",
200200
"replace it with",
201201
"println!()".to_string(),
@@ -204,13 +204,13 @@ impl EarlyLintPass for Write {
204204
}
205205
}
206206
} else if mac.path == sym!(print) {
207-
span_lint(cx, PRINT_STDOUT, mac.span, "use of `print!`");
208-
if let (Some(fmt_str), _) = check_tts(cx, &mac.tts, false) {
207+
span_lint(cx, PRINT_STDOUT, mac.span(), "use of `print!`");
208+
if let (Some(fmt_str), _) = check_tts(cx, &mac.args.inner_tokens(), false) {
209209
if check_newlines(&fmt_str) {
210210
span_lint_and_then(
211211
cx,
212212
PRINT_WITH_NEWLINE,
213-
mac.span,
213+
mac.span(),
214214
"using `print!()` with a format string that ends in a single newline",
215215
|err| {
216216
err.multipart_suggestion(
@@ -226,12 +226,12 @@ impl EarlyLintPass for Write {
226226
}
227227
}
228228
} else if mac.path == sym!(write) {
229-
if let (Some(fmt_str), _) = check_tts(cx, &mac.tts, true) {
229+
if let (Some(fmt_str), _) = check_tts(cx, &mac.args.inner_tokens(), true) {
230230
if check_newlines(&fmt_str) {
231231
span_lint_and_then(
232232
cx,
233233
WRITE_WITH_NEWLINE,
234-
mac.span,
234+
mac.span(),
235235
"using `write!()` with a format string that ends in a single newline",
236236
|err| {
237237
err.multipart_suggestion(
@@ -247,7 +247,7 @@ impl EarlyLintPass for Write {
247247
}
248248
}
249249
} else if mac.path == sym!(writeln) {
250-
if let (Some(fmt_str), expr) = check_tts(cx, &mac.tts, true) {
250+
if let (Some(fmt_str), expr) = check_tts(cx, &mac.args.inner_tokens(), true) {
251251
if fmt_str.symbol == Symbol::intern("") {
252252
let mut applicability = Applicability::MachineApplicable;
253253
let suggestion = expr.map_or_else(
@@ -261,7 +261,7 @@ impl EarlyLintPass for Write {
261261
span_lint_and_sugg(
262262
cx,
263263
WRITELN_EMPTY_STRING,
264-
mac.span,
264+
mac.span(),
265265
format!("using `writeln!({}, \"\")`", suggestion).as_str(),
266266
"replace it with",
267267
format!("writeln!({})", suggestion),

0 commit comments

Comments
 (0)