Skip to content

Commit f0fc18a

Browse files
committed
Auto merge of #4878 - flip1995:rustup, r=flip1995
Rustup Included rustups: - rust-lang/rust#66935 (syntax: Unify macro and attribute arguments in AST) - rust-lang/rust#66941 (Remove `ord` lang item) Fixes? #2597 changelog: none
2 parents 7a943a9 + 7162393 commit f0fc18a

File tree

5 files changed

+18
-26
lines changed

5 files changed

+18
-26
lines changed

clippy_lints/src/attrs.rs

+1-1
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

+3-3
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()).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/eq_op.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
7777
BinOpKind::Shr => (cx.tcx.lang_items().shr_trait(), false),
7878
BinOpKind::Ne | BinOpKind::Eq => (cx.tcx.lang_items().eq_trait(), true),
7979
BinOpKind::Lt | BinOpKind::Le | BinOpKind::Ge | BinOpKind::Gt => {
80-
(cx.tcx.lang_items().ord_trait(), true)
80+
(cx.tcx.lang_items().partial_ord_trait(), true)
8181
},
8282
};
8383
if let Some(trait_id) = trait_id {
@@ -155,7 +155,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
155155
left.span,
156156
"use the left value directly",
157157
lsnip,
158-
Applicability::MachineApplicable, // snippet
158+
Applicability::MaybeIncorrect, // FIXME #2597
159159
);
160160
})
161161
}
@@ -173,7 +173,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp {
173173
right.span,
174174
"use the right value directly",
175175
rsnip,
176-
Applicability::MachineApplicable, // snippet
176+
Applicability::MaybeIncorrect, // FIXME #2597
177177
);
178178
})
179179
}

clippy_lints/src/write.rs

+10-10
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),

tests/ui/op_ref.stderr

+1-9
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,6 @@ help: use the values directly
1010
LL | let foo = 5 - 6;
1111
| ^ ^
1212

13-
error: taken reference of right operand
14-
--> $DIR/op_ref.rs:20:8
15-
|
16-
LL | if b < &a {
17-
| ^^^^--
18-
| |
19-
| help: use the right value directly: `a`
20-
2113
error: taken reference of right operand
2214
--> $DIR/op_ref.rs:57:13
2315
|
@@ -26,5 +18,5 @@ LL | let z = x & &y;
2618
| |
2719
| help: use the right value directly: `y`
2820

29-
error: aborting due to 3 previous errors
21+
error: aborting due to 2 previous errors
3022

0 commit comments

Comments
 (0)