Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 23d1142

Browse files
committedDec 17, 2021
Auto merge of rust-lang#8134 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
2 parents 40fd785 + 646a9cf commit 23d1142

32 files changed

+144
-161
lines changed
 

‎clippy_lints/src/asm_syntax.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,15 @@ declare_clippy_lint! {
6565
/// ```rust,no_run
6666
/// # #![feature(asm)]
6767
/// # unsafe { let ptr = "".as_ptr();
68+
/// # use std::arch::asm;
6869
/// asm!("lea {}, [{}]", lateout(reg) _, in(reg) ptr);
6970
/// # }
7071
/// ```
7172
/// Use instead:
7273
/// ```rust,no_run
7374
/// # #![feature(asm)]
7475
/// # unsafe { let ptr = "".as_ptr();
76+
/// # use std::arch::asm;
7577
/// asm!("lea ({}), {}", in(reg) ptr, lateout(reg) _, options(att_syntax));
7678
/// # }
7779
/// ```
@@ -102,13 +104,15 @@ declare_clippy_lint! {
102104
/// ```rust,no_run
103105
/// # #![feature(asm)]
104106
/// # unsafe { let ptr = "".as_ptr();
107+
/// # use std::arch::asm;
105108
/// asm!("lea ({}), {}", in(reg) ptr, lateout(reg) _, options(att_syntax));
106109
/// # }
107110
/// ```
108111
/// Use instead:
109112
/// ```rust,no_run
110113
/// # #![feature(asm)]
111114
/// # unsafe { let ptr = "".as_ptr();
115+
/// # use std::arch::asm;
112116
/// asm!("lea {}, [{}]", lateout(reg) _, in(reg) ptr);
113117
/// # }
114118
/// ```

‎clippy_lints/src/bytecount.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl<'tcx> LateLintPass<'tcx> for ByteCount {
4242
fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) {
4343
if_chain! {
4444
if let ExprKind::MethodCall(count, _, [count_recv], _) = expr.kind;
45-
if count.ident.name == sym!(count);
45+
if count.ident.name == sym::count;
4646
if let ExprKind::MethodCall(filter, _, [filter_recv, filter_arg], _) = count_recv.kind;
4747
if filter.ident.name == sym!(filter);
4848
if let ExprKind::Closure(_, _, body_id, _, _) = filter_arg.kind;

‎clippy_lints/src/future_not_send.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
6868
let mut is_future = false;
6969
for &(p, _span) in preds {
7070
let p = p.subst(cx.tcx, subst);
71-
if let Some(trait_ref) = p.to_opt_poly_trait_ref() {
72-
if Some(trait_ref.value.def_id()) == cx.tcx.lang_items().future_trait() {
71+
if let Some(trait_pred) = p.to_opt_poly_trait_pred() {
72+
if Some(trait_pred.skip_binder().trait_ref.def_id) == cx.tcx.lang_items().future_trait() {
7373
is_future = true;
7474
break;
7575
}

‎clippy_lints/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#![feature(box_patterns)]
44
#![feature(drain_filter)]
55
#![feature(in_band_lifetimes)]
6-
#![feature(iter_zip)]
76
#![feature(once_cell)]
87
#![feature(rustc_private)]
98
#![feature(stmt_expr_attributes)]

‎clippy_lints/src/matches.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use clippy_utils::{
1313
strip_pat_refs,
1414
};
1515
use clippy_utils::{paths, search_same, SpanlessEq, SpanlessHash};
16-
use core::array;
1716
use core::iter::{once, ExactSizeIterator};
1817
use if_chain::if_chain;
1918
use rustc_ast::ast::{Attribute, LitKind};
@@ -1314,7 +1313,7 @@ fn check_match_like_matches<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>)
13141313
return find_matches_sugg(
13151314
cx,
13161315
let_expr,
1317-
array::IntoIter::new([(&[][..], Some(let_pat), if_then, None), (&[][..], None, if_else, None)]),
1316+
IntoIterator::into_iter([(&[][..], Some(let_pat), if_then, None), (&[][..], None, if_else, None)]),
13181317
expr,
13191318
true,
13201319
);

‎clippy_lints/src/methods/str_splitn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ fn parse_iter_usage(
204204
match e.kind {
205205
ExprKind::Call(
206206
Expr {
207-
kind: ExprKind::Path(QPath::LangItem(LangItem::TryTraitBranch, _)),
207+
kind: ExprKind::Path(QPath::LangItem(LangItem::TryTraitBranch, ..)),
208208
..
209209
},
210210
_,

‎clippy_lints/src/needless_late_init.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,14 @@ fn assignment_suggestions<'tcx>(
155155
}
156156

157157
let suggestions = assignments
158-
.into_iter()
159-
.map(|assignment| Some((assignment.span, snippet_opt(cx, assignment.rhs_span)?)))
158+
.iter()
159+
.map(|assignment| Some((assignment.span.until(assignment.rhs_span), String::new())))
160+
.chain(assignments.iter().map(|assignment| {
161+
Some((
162+
assignment.rhs_span.shrink_to_hi().with_hi(assignment.span.hi()),
163+
String::new(),
164+
))
165+
}))
160166
.collect::<Option<Vec<(Span, String)>>>()?;
161167

162168
let applicability = if suggestions.len() > 1 {

‎clippy_lints/src/needless_question_mark.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ fn check(cx: &LateContext<'_>, expr: &Expr<'_>) {
105105
};
106106
if let ExprKind::Match(inner_expr_with_q, _, MatchSource::TryDesugar) = &arg.kind;
107107
if let ExprKind::Call(called, [inner_expr]) = &inner_expr_with_q.kind;
108-
if let ExprKind::Path(QPath::LangItem(LangItem::TryTraitBranch, _)) = &called.kind;
108+
if let ExprKind::Path(QPath::LangItem(LangItem::TryTraitBranch, ..)) = &called.kind;
109109
if expr.span.ctxt() == inner_expr.span.ctxt();
110110
let expr_ty = cx.typeck_results().expr_ty(expr);
111111
let inner_ty = cx.typeck_results().expr_ty(inner_expr);

‎clippy_lints/src/redundant_clone.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use rustc_middle::mir::{
1515
Mutability,
1616
};
1717
use rustc_middle::ty::{self, fold::TypeVisitor, Ty, TyCtxt};
18-
use rustc_mir_dataflow::{Analysis, AnalysisDomain, GenKill, GenKillAnalysis, ResultsCursor};
18+
use rustc_mir_dataflow::{Analysis, AnalysisDomain, CallReturnPlaces, GenKill, GenKillAnalysis, ResultsCursor};
1919
use rustc_session::{declare_lint_pass, declare_tool_lint};
2020
use rustc_span::source_map::{BytePos, Span};
2121
use rustc_span::sym;
@@ -500,11 +500,9 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeStorageLive {
500500

501501
fn call_return_effect(
502502
&self,
503-
_in_out: &mut impl GenKill<Self::Idx>,
503+
_trans: &mut impl GenKill<Self::Idx>,
504504
_block: mir::BasicBlock,
505-
_func: &mir::Operand<'tcx>,
506-
_args: &[mir::Operand<'tcx>],
507-
_return_place: mir::Place<'tcx>,
505+
_return_places: CallReturnPlaces<'_, 'tcx>,
508506
) {
509507
// Nothing to do when a call returns successfully
510508
}

‎clippy_lints/src/strings.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ impl<'tcx> LateLintPass<'tcx> for StringLitAsBytes {
257257
if method_names[0] == sym!(as_bytes);
258258

259259
// Check for slicer
260-
if let ExprKind::Struct(QPath::LangItem(LangItem::Range, _), _, _) = right.kind;
260+
if let ExprKind::Struct(QPath::LangItem(LangItem::Range, ..), _, _) = right.kind;
261261

262262
then {
263263
let mut applicability = Applicability::MachineApplicable;

‎clippy_lints/src/try_err.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl<'tcx> LateLintPass<'tcx> for TryErr {
6565
if let ExprKind::Match(match_arg, _, MatchSource::TryDesugar) = expr.kind;
6666
if let ExprKind::Call(match_fun, try_args) = match_arg.kind;
6767
if let ExprKind::Path(ref match_fun_path) = match_fun.kind;
68-
if matches!(match_fun_path, QPath::LangItem(LangItem::TryTraitBranch, _));
68+
if matches!(match_fun_path, QPath::LangItem(LangItem::TryTraitBranch, ..));
6969
if let Some(try_arg) = try_args.get(0);
7070
if let ExprKind::Call(err_fun, err_args) = try_arg.kind;
7171
if let Some(err_arg) = err_args.get(0);

‎clippy_lints/src/unused_io_amount.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedIoAmount {
4949
if let hir::ExprKind::Call(func, [ref arg_0, ..]) = res.kind {
5050
if matches!(
5151
func.kind,
52-
hir::ExprKind::Path(hir::QPath::LangItem(hir::LangItem::TryTraitBranch, _))
52+
hir::ExprKind::Path(hir::QPath::LangItem(hir::LangItem::TryTraitBranch, ..))
5353
) {
5454
check_map_error(cx, arg_0, expr);
5555
}

‎clippy_lints/src/utils/author.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ impl<'a, 'tcx> PrintVisitor<'a, 'tcx> {
260260
}
261261

262262
fn qpath(&self, qpath: &Binding<&QPath<'_>>) {
263-
if let QPath::LangItem(lang_item, _) = *qpath.value {
263+
if let QPath::LangItem(lang_item, ..) = *qpath.value {
264264
out!("if matches!({qpath}, QPath::LangItem(LangItem::{lang_item:?}, _));");
265265
} else {
266266
out!("if match_qpath({qpath}, &[{}]);", path_to_string(qpath.value));

‎clippy_utils/src/higher.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ impl<'a> Range<'a> {
218218
hir::ExprKind::Call(path, args)
219219
if matches!(
220220
path.kind,
221-
hir::ExprKind::Path(hir::QPath::LangItem(hir::LangItem::RangeInclusiveNew, _))
221+
hir::ExprKind::Path(hir::QPath::LangItem(hir::LangItem::RangeInclusiveNew, ..))
222222
) =>
223223
{
224224
Some(Range {
@@ -228,27 +228,27 @@ impl<'a> Range<'a> {
228228
})
229229
},
230230
hir::ExprKind::Struct(path, fields, None) => match &path {
231-
hir::QPath::LangItem(hir::LangItem::RangeFull, _) => Some(Range {
231+
hir::QPath::LangItem(hir::LangItem::RangeFull, ..) => Some(Range {
232232
start: None,
233233
end: None,
234234
limits: ast::RangeLimits::HalfOpen,
235235
}),
236-
hir::QPath::LangItem(hir::LangItem::RangeFrom, _) => Some(Range {
236+
hir::QPath::LangItem(hir::LangItem::RangeFrom, ..) => Some(Range {
237237
start: Some(get_field("start", fields)?),
238238
end: None,
239239
limits: ast::RangeLimits::HalfOpen,
240240
}),
241-
hir::QPath::LangItem(hir::LangItem::Range, _) => Some(Range {
241+
hir::QPath::LangItem(hir::LangItem::Range, ..) => Some(Range {
242242
start: Some(get_field("start", fields)?),
243243
end: Some(get_field("end", fields)?),
244244
limits: ast::RangeLimits::HalfOpen,
245245
}),
246-
hir::QPath::LangItem(hir::LangItem::RangeToInclusive, _) => Some(Range {
246+
hir::QPath::LangItem(hir::LangItem::RangeToInclusive, ..) => Some(Range {
247247
start: None,
248248
end: Some(get_field("end", fields)?),
249249
limits: ast::RangeLimits::Closed,
250250
}),
251-
hir::QPath::LangItem(hir::LangItem::RangeTo, _) => Some(Range {
251+
hir::QPath::LangItem(hir::LangItem::RangeTo, ..) => Some(Range {
252252
start: None,
253253
end: Some(get_field("end", fields)?),
254254
limits: ast::RangeLimits::HalfOpen,

‎clippy_utils/src/hir_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ impl HirEqInterExpr<'_, '_, '_> {
348348
(&QPath::TypeRelative(lty, lseg), &QPath::TypeRelative(rty, rseg)) => {
349349
self.eq_ty(lty, rty) && self.eq_path_segment(lseg, rseg)
350350
},
351-
(&QPath::LangItem(llang_item, _), &QPath::LangItem(rlang_item, _)) => llang_item == rlang_item,
351+
(&QPath::LangItem(llang_item, ..), &QPath::LangItem(rlang_item, ..)) => llang_item == rlang_item,
352352
_ => false,
353353
}
354354
}

‎clippy_utils/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![feature(box_patterns)]
22
#![feature(in_band_lifetimes)]
3-
#![feature(iter_zip)]
43
#![feature(let_else)]
54
#![feature(rustc_private)]
65
#![feature(control_flow_enum)]

‎rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2021-12-02"
2+
channel = "nightly-2021-12-17"
33
components = ["cargo", "llvm-tools-preview", "rust-src", "rust-std", "rustc", "rustc-dev", "rustfmt"]

‎tests/ui/asm_syntax.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
// only-x86_64
22
// ignore-aarch64
33

4-
#![feature(asm)]
5-
64
#[warn(clippy::inline_asm_x86_intel_syntax)]
75
mod warn_intel {
86
pub(super) unsafe fn use_asm() {
7+
use std::arch::asm;
98
asm!("");
109
asm!("", options());
1110
asm!("", options(nostack));
@@ -17,6 +16,7 @@ mod warn_intel {
1716
#[warn(clippy::inline_asm_x86_att_syntax)]
1817
mod warn_att {
1918
pub(super) unsafe fn use_asm() {
19+
use std::arch::asm;
2020
asm!("");
2121
asm!("", options());
2222
asm!("", options(nostack));

‎tests/ui/asm_syntax.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: Intel x86 assembly syntax used
2-
--> $DIR/asm_syntax.rs:9:9
2+
--> $DIR/asm_syntax.rs:8:9
33
|
44
LL | asm!("");
55
| ^^^^^^^^
@@ -8,15 +8,15 @@ LL | asm!("");
88
= help: use AT&T x86 assembly syntax
99

1010
error: Intel x86 assembly syntax used
11-
--> $DIR/asm_syntax.rs:10:9
11+
--> $DIR/asm_syntax.rs:9:9
1212
|
1313
LL | asm!("", options());
1414
| ^^^^^^^^^^^^^^^^^^^
1515
|
1616
= help: use AT&T x86 assembly syntax
1717

1818
error: Intel x86 assembly syntax used
19-
--> $DIR/asm_syntax.rs:11:9
19+
--> $DIR/asm_syntax.rs:10:9
2020
|
2121
LL | asm!("", options(nostack));
2222
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

‎tests/ui/crashes/ice-6250.stderr

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
error[E0658]: destructuring assignments are unstable
2-
--> $DIR/ice-6250.rs:12:25
3-
|
4-
LL | Some(reference) = cache.data.get(key) {
5-
| --------------- ^
6-
| |
7-
| cannot assign to this expression
8-
|
9-
= note: see issue #71126 <https://github.com/rust-lang/rust/issues/71126> for more information
10-
= help: add `#![feature(destructuring_assignment)]` to the crate attributes to enable
11-
121
error[E0601]: `main` function not found in crate `ice_6250`
132
--> $DIR/ice-6250.rs:4:1
143
|
@@ -41,7 +30,7 @@ error[E0308]: mismatched types
4130
LL | Some(reference) = cache.data.get(key) {
4231
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `()`
4332

44-
error: aborting due to 4 previous errors
33+
error: aborting due to 3 previous errors
4534

46-
Some errors have detailed explanations: E0308, E0601, E0658.
35+
Some errors have detailed explanations: E0308, E0601.
4736
For more information about an error, try `rustc --explain E0308`.

‎tests/ui/entry.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
#![allow(unused, clippy::needless_pass_by_value, clippy::collapsible_if)]
44
#![warn(clippy::map_entry)]
5-
#![feature(asm)]
65

6+
use std::arch::asm;
77
use std::collections::HashMap;
88
use std::hash::Hash;
99

‎tests/ui/entry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
#![allow(unused, clippy::needless_pass_by_value, clippy::collapsible_if)]
44
#![warn(clippy::map_entry)]
5-
#![feature(asm)]
65

6+
use std::arch::asm;
77
use std::collections::HashMap;
88
use std::hash::Hash;
99

‎tests/ui/future_not_send.stderr

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,22 @@ LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
66
|
77
= note: `-D clippy::future-not-send` implied by `-D warnings`
88
note: future is not `Send` as this value is used across an await
9-
--> $DIR/future_not_send.rs:8:5
9+
--> $DIR/future_not_send.rs:8:19
1010
|
1111
LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
1212
| -- has type `std::rc::Rc<[u8]>` which is not `Send`
1313
LL | async { true }.await
14-
| ^^^^^^^^^^^^^^^^^^^^ await occurs here, with `rc` maybe used later
14+
| ^^^^^^ await occurs here, with `rc` maybe used later
1515
LL | }
1616
| - `rc` is later dropped here
1717
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send`
1818
note: future is not `Send` as this value is used across an await
19-
--> $DIR/future_not_send.rs:8:5
19+
--> $DIR/future_not_send.rs:8:19
2020
|
2121
LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
2222
| ---- has type `&std::cell::Cell<usize>` which is not `Send`
2323
LL | async { true }.await
24-
| ^^^^^^^^^^^^^^^^^^^^ await occurs here, with `cell` maybe used later
24+
| ^^^^^^ await occurs here, with `cell` maybe used later
2525
LL | }
2626
| - `cell` is later dropped here
2727
= note: `std::cell::Cell<usize>` doesn't implement `std::marker::Sync`
@@ -33,12 +33,12 @@ LL | pub async fn public_future(rc: Rc<[u8]>) {
3333
| ^ future returned by `public_future` is not `Send`
3434
|
3535
note: future is not `Send` as this value is used across an await
36-
--> $DIR/future_not_send.rs:12:5
36+
--> $DIR/future_not_send.rs:12:19
3737
|
3838
LL | pub async fn public_future(rc: Rc<[u8]>) {
3939
| -- has type `std::rc::Rc<[u8]>` which is not `Send`
4040
LL | async { true }.await;
41-
| ^^^^^^^^^^^^^^^^^^^^ await occurs here, with `rc` maybe used later
41+
| ^^^^^^ await occurs here, with `rc` maybe used later
4242
LL | }
4343
| - `rc` is later dropped here
4444
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send`
@@ -82,12 +82,12 @@ LL | async fn private_future(&self) -> usize {
8282
| ^^^^^ future returned by `private_future` is not `Send`
8383
|
8484
note: future is not `Send` as this value is used across an await
85-
--> $DIR/future_not_send.rs:35:9
85+
--> $DIR/future_not_send.rs:35:23
8686
|
8787
LL | async fn private_future(&self) -> usize {
8888
| ----- has type `&Dummy` which is not `Send`
8989
LL | async { true }.await;
90-
| ^^^^^^^^^^^^^^^^^^^^ await occurs here, with `&self` maybe used later
90+
| ^^^^^^ await occurs here, with `&self` maybe used later
9191
LL | self.rc.len()
9292
LL | }
9393
| - `&self` is later dropped here
@@ -100,12 +100,12 @@ LL | pub async fn public_future(&self) {
100100
| ^ future returned by `public_future` is not `Send`
101101
|
102102
note: future is not `Send` as this value is used across an await
103-
--> $DIR/future_not_send.rs:40:9
103+
--> $DIR/future_not_send.rs:40:30
104104
|
105105
LL | pub async fn public_future(&self) {
106106
| ----- has type `&Dummy` which is not `Send`
107107
LL | self.private_future().await;
108-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ await occurs here, with `&self` maybe used later
108+
| ^^^^^^ await occurs here, with `&self` maybe used later
109109
LL | }
110110
| - `&self` is later dropped here
111111
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Sync`
@@ -117,12 +117,12 @@ LL | async fn generic_future<T>(t: T) -> T
117117
| ^ future returned by `generic_future` is not `Send`
118118
|
119119
note: future is not `Send` as this value is used across an await
120-
--> $DIR/future_not_send.rs:54:5
120+
--> $DIR/future_not_send.rs:54:19
121121
|
122122
LL | let rt = &t;
123123
| -- has type `&T` which is not `Send`
124124
LL | async { true }.await;
125-
| ^^^^^^^^^^^^^^^^^^^^ await occurs here, with `rt` maybe used later
125+
| ^^^^^^ await occurs here, with `rt` maybe used later
126126
LL | t
127127
LL | }
128128
| - `rt` is later dropped here

‎tests/ui/missing-doc.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
// When denying at the crate level, be sure to not get random warnings from the
33
// injected intrinsics by the compiler.
44
#![allow(dead_code)]
5-
#![feature(global_asm)]
65
//! Some garbage docs for the crate here
76
#![doc = "More garbage"]
87

8+
use std::arch::global_asm;
9+
910
type Typedef = String;
1011
pub type PubTypedef = String;
1112

‎tests/ui/missing-doc.stderr

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
error: missing documentation for a type alias
2-
--> $DIR/missing-doc.rs:9:1
2+
--> $DIR/missing-doc.rs:10:1
33
|
44
LL | type Typedef = String;
55
| ^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: `-D clippy::missing-docs-in-private-items` implied by `-D warnings`
88

99
error: missing documentation for a type alias
10-
--> $DIR/missing-doc.rs:10:1
10+
--> $DIR/missing-doc.rs:11:1
1111
|
1212
LL | pub type PubTypedef = String;
1313
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1414

1515
error: missing documentation for a module
16-
--> $DIR/missing-doc.rs:12:1
16+
--> $DIR/missing-doc.rs:13:1
1717
|
1818
LL | mod module_no_dox {}
1919
| ^^^^^^^^^^^^^^^^^^^^
2020

2121
error: missing documentation for a module
22-
--> $DIR/missing-doc.rs:13:1
22+
--> $DIR/missing-doc.rs:14:1
2323
|
2424
LL | pub mod pub_module_no_dox {}
2525
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2626

2727
error: missing documentation for a function
28-
--> $DIR/missing-doc.rs:17:1
28+
--> $DIR/missing-doc.rs:18:1
2929
|
3030
LL | pub fn foo2() {}
3131
| ^^^^^^^^^^^^^^^^
3232

3333
error: missing documentation for a function
34-
--> $DIR/missing-doc.rs:18:1
34+
--> $DIR/missing-doc.rs:19:1
3535
|
3636
LL | fn foo3() {}
3737
| ^^^^^^^^^^^^
3838

3939
error: missing documentation for an enum
40-
--> $DIR/missing-doc.rs:32:1
40+
--> $DIR/missing-doc.rs:33:1
4141
|
4242
LL | / enum Baz {
4343
LL | | BazA { a: isize, b: isize },
@@ -46,75 +46,75 @@ LL | | }
4646
| |_^
4747

4848
error: missing documentation for a variant
49-
--> $DIR/missing-doc.rs:33:5
49+
--> $DIR/missing-doc.rs:34:5
5050
|
5151
LL | BazA { a: isize, b: isize },
5252
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
5353

5454
error: missing documentation for a struct field
55-
--> $DIR/missing-doc.rs:33:12
55+
--> $DIR/missing-doc.rs:34:12
5656
|
5757
LL | BazA { a: isize, b: isize },
5858
| ^^^^^^^^
5959

6060
error: missing documentation for a struct field
61-
--> $DIR/missing-doc.rs:33:22
61+
--> $DIR/missing-doc.rs:34:22
6262
|
6363
LL | BazA { a: isize, b: isize },
6464
| ^^^^^^^^
6565

6666
error: missing documentation for a variant
67-
--> $DIR/missing-doc.rs:34:5
67+
--> $DIR/missing-doc.rs:35:5
6868
|
6969
LL | BarB,
7070
| ^^^^
7171

7272
error: missing documentation for an enum
73-
--> $DIR/missing-doc.rs:37:1
73+
--> $DIR/missing-doc.rs:38:1
7474
|
7575
LL | / pub enum PubBaz {
7676
LL | | PubBazA { a: isize },
7777
LL | | }
7878
| |_^
7979

8080
error: missing documentation for a variant
81-
--> $DIR/missing-doc.rs:38:5
81+
--> $DIR/missing-doc.rs:39:5
8282
|
8383
LL | PubBazA { a: isize },
8484
| ^^^^^^^^^^^^^^^^^^^^
8585

8686
error: missing documentation for a struct field
87-
--> $DIR/missing-doc.rs:38:15
87+
--> $DIR/missing-doc.rs:39:15
8888
|
8989
LL | PubBazA { a: isize },
9090
| ^^^^^^^^
9191

9292
error: missing documentation for a constant
93-
--> $DIR/missing-doc.rs:58:1
93+
--> $DIR/missing-doc.rs:59:1
9494
|
9595
LL | const FOO: u32 = 0;
9696
| ^^^^^^^^^^^^^^^^^^^
9797

9898
error: missing documentation for a constant
99-
--> $DIR/missing-doc.rs:65:1
99+
--> $DIR/missing-doc.rs:66:1
100100
|
101101
LL | pub const FOO4: u32 = 0;
102102
| ^^^^^^^^^^^^^^^^^^^^^^^^
103103

104104
error: missing documentation for a static
105-
--> $DIR/missing-doc.rs:67:1
105+
--> $DIR/missing-doc.rs:68:1
106106
|
107107
LL | static BAR: u32 = 0;
108108
| ^^^^^^^^^^^^^^^^^^^^
109109

110110
error: missing documentation for a static
111-
--> $DIR/missing-doc.rs:74:1
111+
--> $DIR/missing-doc.rs:75:1
112112
|
113113
LL | pub static BAR4: u32 = 0;
114114
| ^^^^^^^^^^^^^^^^^^^^^^^^^
115115

116116
error: missing documentation for a module
117-
--> $DIR/missing-doc.rs:76:1
117+
--> $DIR/missing-doc.rs:77:1
118118
|
119119
LL | / mod internal_impl {
120120
LL | | /// dox
@@ -126,31 +126,31 @@ LL | | }
126126
| |_^
127127

128128
error: missing documentation for a function
129-
--> $DIR/missing-doc.rs:79:5
129+
--> $DIR/missing-doc.rs:80:5
130130
|
131131
LL | pub fn undocumented1() {}
132132
| ^^^^^^^^^^^^^^^^^^^^^^^^^
133133

134134
error: missing documentation for a function
135-
--> $DIR/missing-doc.rs:80:5
135+
--> $DIR/missing-doc.rs:81:5
136136
|
137137
LL | pub fn undocumented2() {}
138138
| ^^^^^^^^^^^^^^^^^^^^^^^^^
139139

140140
error: missing documentation for a function
141-
--> $DIR/missing-doc.rs:81:5
141+
--> $DIR/missing-doc.rs:82:5
142142
|
143143
LL | fn undocumented3() {}
144144
| ^^^^^^^^^^^^^^^^^^^^^
145145

146146
error: missing documentation for a function
147-
--> $DIR/missing-doc.rs:86:9
147+
--> $DIR/missing-doc.rs:87:9
148148
|
149149
LL | pub fn also_undocumented1() {}
150150
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
151151

152152
error: missing documentation for a function
153-
--> $DIR/missing-doc.rs:87:9
153+
--> $DIR/missing-doc.rs:88:9
154154
|
155155
LL | fn also_undocumented2() {}
156156
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

‎tests/ui/needless_late_init.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,19 @@ fn main() {
3939
e = format!("{}", c);
4040
}
4141

42+
let f;
43+
match 1 {
44+
1 => f = "three",
45+
_ => return,
46+
}; // has semi
47+
48+
let g: usize;
49+
if true {
50+
g = 5;
51+
} else {
52+
panic!();
53+
}
54+
4255
println!("{}", a);
4356
}
4457

‎tests/ui/needless_late_init.stderr

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,43 @@ LL | };
105105
| +
106106

107107
error: unneeded late initalization
108-
--> $DIR/needless_late_init.rs:50:5
108+
--> $DIR/needless_late_init.rs:42:5
109+
|
110+
LL | let f;
111+
| ^^^^^^
112+
|
113+
help: declare `f` here
114+
|
115+
LL | let f = match 1 {
116+
| +++++++
117+
help: remove the assignments from the `match` arms
118+
|
119+
LL - 1 => f = "three",
120+
LL + 1 => "three",
121+
|
122+
123+
error: unneeded late initalization
124+
--> $DIR/needless_late_init.rs:48:5
125+
|
126+
LL | let g: usize;
127+
| ^^^^^^^^^^^^^
128+
|
129+
help: declare `g` here
130+
|
131+
LL | let g: usize = if true {
132+
| ++++++++++++++
133+
help: remove the assignments from the branches
134+
|
135+
LL - g = 5;
136+
LL + 5
137+
|
138+
help: add a semicolon after the `if` expression
139+
|
140+
LL | };
141+
| +
142+
143+
error: unneeded late initalization
144+
--> $DIR/needless_late_init.rs:63:5
109145
|
110146
LL | let a;
111147
| ^^^^^^
@@ -126,7 +162,7 @@ LL | };
126162
| +
127163

128164
error: unneeded late initalization
129-
--> $DIR/needless_late_init.rs:67:5
165+
--> $DIR/needless_late_init.rs:80:5
130166
|
131167
LL | let a;
132168
| ^^^^^^
@@ -146,5 +182,5 @@ help: add a semicolon after the `match` expression
146182
LL | };
147183
| +
148184

149-
error: aborting due to 7 previous errors
185+
error: aborting due to 9 previous errors
150186

‎tests/ui/needless_late_init_fixable.fixed

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,6 @@ fn main() {
1919
e = 2;
2020

2121

22-
let f = match 1 {
23-
1 => "three",
24-
_ => return,
25-
}; // has semi
26-
27-
28-
let g: usize = if true {
29-
5
30-
} else {
31-
panic!();
32-
};
33-
34-
3522
let h = format!("{}", e);
3623

3724
println!("{}", a);

‎tests/ui/needless_late_init_fixable.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,6 @@ fn main() {
1818
e = 1;
1919
e = 2;
2020

21-
let f;
22-
match 1 {
23-
1 => f = "three",
24-
_ => return,
25-
}; // has semi
26-
27-
let g: usize;
28-
if true {
29-
g = 5;
30-
} else {
31-
panic!();
32-
}
33-
3421
let h;
3522
h = format!("{}", e);
3623

‎tests/ui/needless_late_init_fixable.stderr

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -57,40 +57,6 @@ LL | let mut e = 1;
5757
error: unneeded late initalization
5858
--> $DIR/needless_late_init_fixable.rs:21:5
5959
|
60-
LL | let f;
61-
| ^^^^^^
62-
|
63-
help: declare `f` here
64-
|
65-
LL | let f = match 1 {
66-
| +++++++
67-
help: remove the assignments from the `match` arms
68-
|
69-
LL | 1 => "three",
70-
| ~~~~~~~
71-
72-
error: unneeded late initalization
73-
--> $DIR/needless_late_init_fixable.rs:27:5
74-
|
75-
LL | let g: usize;
76-
| ^^^^^^^^^^^^^
77-
|
78-
help: declare `g` here
79-
|
80-
LL | let g: usize = if true {
81-
| ++++++++++++++
82-
help: remove the assignments from the branches
83-
|
84-
LL | 5
85-
|
86-
help: add a semicolon after the `if` expression
87-
|
88-
LL | };
89-
| +
90-
91-
error: unneeded late initalization
92-
--> $DIR/needless_late_init_fixable.rs:34:5
93-
|
9460
LL | let h;
9561
| ^^^^^^
9662
|
@@ -99,5 +65,5 @@ help: declare `h` here
9965
LL | let h = format!("{}", e);
10066
| ~~~~~
10167

102-
error: aborting due to 8 previous errors
68+
error: aborting due to 6 previous errors
10369

‎tests/ui/trailing_empty_array.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![warn(clippy::trailing_empty_array)]
2-
#![feature(const_generics_defaults)]
32

43
// Do lint:
54

‎tests/ui/trailing_empty_array.stderr

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
2-
--> $DIR/trailing_empty_array.rs:6:1
2+
--> $DIR/trailing_empty_array.rs:5:1
33
|
44
LL | / struct RarelyUseful {
55
LL | | field: i32,
@@ -11,7 +11,7 @@ LL | | }
1111
= help: consider annotating `RarelyUseful` with `#[repr(C)]` or another `repr` attribute
1212

1313
error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
14-
--> $DIR/trailing_empty_array.rs:11:1
14+
--> $DIR/trailing_empty_array.rs:10:1
1515
|
1616
LL | / struct OnlyField {
1717
LL | | first_and_last: [usize; 0],
@@ -21,7 +21,7 @@ LL | | }
2121
= help: consider annotating `OnlyField` with `#[repr(C)]` or another `repr` attribute
2222

2323
error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
24-
--> $DIR/trailing_empty_array.rs:15:1
24+
--> $DIR/trailing_empty_array.rs:14:1
2525
|
2626
LL | / struct GenericArrayType<T> {
2727
LL | | field: i32,
@@ -32,7 +32,7 @@ LL | | }
3232
= help: consider annotating `GenericArrayType` with `#[repr(C)]` or another `repr` attribute
3333

3434
error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
35-
--> $DIR/trailing_empty_array.rs:21:1
35+
--> $DIR/trailing_empty_array.rs:20:1
3636
|
3737
LL | / struct OnlyAnotherAttribute {
3838
LL | | field: i32,
@@ -43,7 +43,7 @@ LL | | }
4343
= help: consider annotating `OnlyAnotherAttribute` with `#[repr(C)]` or another `repr` attribute
4444

4545
error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
46-
--> $DIR/trailing_empty_array.rs:27:1
46+
--> $DIR/trailing_empty_array.rs:26:1
4747
|
4848
LL | / struct OnlyADeriveAttribute {
4949
LL | | field: i32,
@@ -54,7 +54,7 @@ LL | | }
5454
= help: consider annotating `OnlyADeriveAttribute` with `#[repr(C)]` or another `repr` attribute
5555

5656
error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
57-
--> $DIR/trailing_empty_array.rs:33:1
57+
--> $DIR/trailing_empty_array.rs:32:1
5858
|
5959
LL | / struct ZeroSizedWithConst {
6060
LL | | field: i32,
@@ -65,7 +65,7 @@ LL | | }
6565
= help: consider annotating `ZeroSizedWithConst` with `#[repr(C)]` or another `repr` attribute
6666

6767
error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
68-
--> $DIR/trailing_empty_array.rs:42:1
68+
--> $DIR/trailing_empty_array.rs:41:1
6969
|
7070
LL | / struct ZeroSizedWithConstFunction {
7171
LL | | field: i32,
@@ -76,7 +76,7 @@ LL | | }
7676
= help: consider annotating `ZeroSizedWithConstFunction` with `#[repr(C)]` or another `repr` attribute
7777

7878
error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
79-
--> $DIR/trailing_empty_array.rs:50:1
79+
--> $DIR/trailing_empty_array.rs:49:1
8080
|
8181
LL | / struct ZeroSizedWithConstFunction2 {
8282
LL | | field: i32,
@@ -87,23 +87,23 @@ LL | | }
8787
= help: consider annotating `ZeroSizedWithConstFunction2` with `#[repr(C)]` or another `repr` attribute
8888

8989
error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
90-
--> $DIR/trailing_empty_array.rs:55:1
90+
--> $DIR/trailing_empty_array.rs:54:1
9191
|
9292
LL | struct ZeroSizedArrayWrapper([usize; 0]);
9393
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9494
|
9595
= help: consider annotating `ZeroSizedArrayWrapper` with `#[repr(C)]` or another `repr` attribute
9696

9797
error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
98-
--> $DIR/trailing_empty_array.rs:57:1
98+
--> $DIR/trailing_empty_array.rs:56:1
9999
|
100100
LL | struct TupleStruct(i32, [usize; 0]);
101101
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
102102
|
103103
= help: consider annotating `TupleStruct` with `#[repr(C)]` or another `repr` attribute
104104

105105
error: trailing zero-sized array in a struct which is not marked with a `repr` attribute
106-
--> $DIR/trailing_empty_array.rs:59:1
106+
--> $DIR/trailing_empty_array.rs:58:1
107107
|
108108
LL | / struct LotsOfFields {
109109
LL | | f1: u32,

0 commit comments

Comments
 (0)
Please sign in to comment.