Skip to content

Commit 61eb38a

Browse files
committed
Auto merge of #7418 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
2 parents 753bce3 + d446d5e commit 61eb38a

22 files changed

+49
-52
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ We have prioritization labels and a sync-blocker label, which are described belo
342342
- [P-low][p-low]: Requires attention (fix/response/evaluation) by a team member but isn't urgent.
343343
- [P-medium][p-medium]: Should be addressed by a team member until the next sync.
344344
- [P-high][p-high]: Should be immediately addressed and will require an out-of-cycle sync or a backport.
345-
- [L-sync-blocker][l-sync-blocker]: An issue that "blocks" a sync.
345+
- [L-sync-blocker][l-sync-blocker]: An issue that "blocks" a sync.
346346
Or rather: before the sync this should be addressed,
347347
e.g. by removing a lint again, so it doesn't hit beta/stable.
348348

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ As with `cargo check`, this includes dependencies that are members of the worksp
9595
If you want to run Clippy **only** on the given crate, use the `--no-deps` option like this:
9696

9797
```terminal
98-
cargo clippy -p example -- --no-deps
98+
cargo clippy -p example -- --no-deps
9999
```
100100

101101
### As a rustc replacement (`clippy-driver`)

clippy_lints/src/derive.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -410,13 +410,8 @@ impl<'tcx> Visitor<'tcx> for UnsafeVisitor<'_, 'tcx> {
410410
}
411411

412412
if let ExprKind::Block(block, _) = expr.kind {
413-
match block.rules {
414-
BlockCheckMode::UnsafeBlock(UnsafeSource::UserProvided)
415-
| BlockCheckMode::PushUnsafeBlock(UnsafeSource::UserProvided)
416-
| BlockCheckMode::PopUnsafeBlock(UnsafeSource::UserProvided) => {
417-
self.has_unsafe = true;
418-
},
419-
_ => {},
413+
if let BlockCheckMode::UnsafeBlock(UnsafeSource::UserProvided) = block.rules {
414+
self.has_unsafe = true;
420415
}
421416
}
422417

clippy_lints/src/get_last_with_len.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl<'tcx> LateLintPass<'tcx> for GetLastWithLen {
7474

7575
// LHS of subtraction is "x.len()"
7676
if let ExprKind::MethodCall(arg_lhs_path, _, lhs_args, _) = &lhs.kind;
77-
if arg_lhs_path.ident.name == sym!(len);
77+
if arg_lhs_path.ident.name == sym::len;
7878
if let Some(arg_lhs_struct) = lhs_args.get(0);
7979

8080
// The two vectors referenced (x in x.get(...) and in x.len())

clippy_lints/src/len_zero.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl<'tcx> LateLintPass<'tcx> for LenZero {
128128

129129
fn check_impl_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx ImplItem<'_>) {
130130
if_chain! {
131-
if item.ident.as_str() == "len";
131+
if item.ident.name == sym::len;
132132
if let ImplItemKind::Fn(sig, _) = &item.kind;
133133
if sig.decl.implicit_self.has_implicit_self();
134134
if cx.access_levels.is_exported(item.hir_id());
@@ -189,8 +189,8 @@ impl<'tcx> LateLintPass<'tcx> for LenZero {
189189
}
190190

191191
fn check_trait_items(cx: &LateContext<'_>, visited_trait: &Item<'_>, trait_items: &[TraitItemRef]) {
192-
fn is_named_self(cx: &LateContext<'_>, item: &TraitItemRef, name: &str) -> bool {
193-
item.ident.name.as_str() == name
192+
fn is_named_self(cx: &LateContext<'_>, item: &TraitItemRef, name: Symbol) -> bool {
193+
item.ident.name == name
194194
&& if let AssocItemKind::Fn { has_self } = item.kind {
195195
has_self && { cx.tcx.fn_sig(item.id.def_id).inputs().skip_binder().len() == 1 }
196196
} else {
@@ -207,7 +207,9 @@ fn check_trait_items(cx: &LateContext<'_>, visited_trait: &Item<'_>, trait_items
207207
}
208208
}
209209

210-
if cx.access_levels.is_exported(visited_trait.hir_id()) && trait_items.iter().any(|i| is_named_self(cx, i, "len")) {
210+
if cx.access_levels.is_exported(visited_trait.hir_id())
211+
&& trait_items.iter().any(|i| is_named_self(cx, i, sym::len))
212+
{
211213
let mut current_and_super_traits = DefIdSet::default();
212214
fill_trait_set(visited_trait.def_id.to_def_id(), &mut current_and_super_traits, cx);
213215

@@ -401,7 +403,7 @@ fn check_len(
401403
return;
402404
}
403405

404-
if method_name.as_str() == "len" && args.len() == 1 && has_is_empty(cx, &args[0]) {
406+
if method_name == sym::len && args.len() == 1 && has_is_empty(cx, &args[0]) {
405407
let mut applicability = Applicability::MachineApplicable;
406408
span_lint_and_sugg(
407409
cx,

clippy_lints/src/loops/manual_memcpy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ fn build_manual_memcpy_suggestion<'tcx>(
118118
let print_limit = |end: &Expr<'_>, end_str: &str, base: &Expr<'_>, sugg: MinifyingSugg<'static>| {
119119
if_chain! {
120120
if let ExprKind::MethodCall(method, _, len_args, _) = end.kind;
121-
if method.ident.name == sym!(len);
121+
if method.ident.name == sym::len;
122122
if len_args.len() == 1;
123123
if let Some(arg) = len_args.get(0);
124124
if path_to_local(arg) == path_to_local(base);

clippy_lints/src/loops/needless_range_loop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ fn is_len_call(expr: &Expr<'_>, var: Symbol) -> bool {
192192
if_chain! {
193193
if let ExprKind::MethodCall(method, _, len_args, _) = expr.kind;
194194
if len_args.len() == 1;
195-
if method.ident.name == sym!(len);
195+
if method.ident.name == sym::len;
196196
if let ExprKind::Path(QPath::Resolved(_, path)) = len_args[0].kind;
197197
if path.segments.len() == 1;
198198
if path.segments[0].ident.name == var;

clippy_lints/src/methods/or_fun_call.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ pub(super) fn check<'tcx>(
8787
];
8888

8989
if let hir::ExprKind::MethodCall(path, _, args, _) = &arg.kind {
90-
if path.ident.as_str() == "len" {
90+
if path.ident.name == sym::len {
9191
let ty = cx.typeck_results().expr_ty(&args[0]).peel_refs();
9292

9393
match ty.kind() {

clippy_lints/src/no_effect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ fn reduce_expression<'a>(cx: &LateContext<'_>, expr: &'a Expr<'a>) -> Option<Vec
167167
BlockCheckMode::UnsafeBlock(UnsafeSource::UserProvided) => None,
168168
BlockCheckMode::DefaultBlock => Some(vec![&**e]),
169169
// in case of compiler-inserted signaling blocks
170-
_ => reduce_expression(cx, e),
170+
BlockCheckMode::UnsafeBlock(_) => reduce_expression(cx, e),
171171
}
172172
})
173173
} else {

clippy_lints/src/ranges.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ fn check_range_zip_with_len(cx: &LateContext<'_>, path: &PathSegment<'_>, args:
329329
if is_integer_const(cx, start, 0);
330330
// `.len()` call
331331
if let ExprKind::MethodCall(len_path, _, len_args, _) = end.kind;
332-
if len_path.ident.name == sym!(len) && len_args.len() == 1;
332+
if len_path.ident.name == sym::len && len_args.len() == 1;
333333
// `.iter()` and `.len()` called on same `Path`
334334
if let ExprKind::Path(QPath::Resolved(_, iter_path)) = iter_args[0].kind;
335335
if let ExprKind::Path(QPath::Resolved(_, len_path)) = len_args[0].kind;

0 commit comments

Comments
 (0)