Skip to content

Commit 080b587

Browse files
committed
Auto merge of #11398 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
2 parents 202c846 + 9334e5d commit 080b587

25 files changed

+52
-39
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy"
3-
version = "0.1.73"
3+
version = "0.1.74"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"

clippy_lints/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "clippy_lints"
3-
version = "0.1.73"
3+
version = "0.1.74"
44
description = "A bunch of helpful lints to avoid common pitfalls in Rust"
55
repository = "https://github.com/rust-lang/rust-clippy"
66
readme = "README.md"

clippy_lints/src/casts/cast_ptr_alignment.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use rustc_hir::{Expr, ExprKind, GenericArg};
55
use rustc_lint::LateContext;
66
use rustc_middle::ty::layout::LayoutOf;
77
use rustc_middle::ty::{self, Ty};
8+
use rustc_span::sym;
89

910
use super::CAST_PTR_ALIGNMENT;
1011

@@ -76,13 +77,14 @@ fn is_used_as_unaligned(cx: &LateContext<'_>, e: &Expr<'_>) -> bool {
7677
ExprKind::Call(func, [arg, ..]) if arg.hir_id == e.hir_id => {
7778
static PATHS: &[&[&str]] = &[
7879
paths::PTR_READ_UNALIGNED.as_slice(),
79-
paths::PTR_WRITE_UNALIGNED.as_slice(),
8080
paths::PTR_UNALIGNED_VOLATILE_LOAD.as_slice(),
8181
paths::PTR_UNALIGNED_VOLATILE_STORE.as_slice(),
8282
];
83+
8384
if let ExprKind::Path(path) = &func.kind
8485
&& let Some(def_id) = cx.qpath_res(path, func.hir_id).opt_def_id()
85-
&& match_any_def_paths(cx, def_id, PATHS).is_some()
86+
&& (match_any_def_paths(cx, def_id, PATHS).is_some()
87+
|| cx.tcx.is_diagnostic_item(sym::ptr_write_unaligned, def_id))
8688
{
8789
true
8890
} else {

clippy_lints/src/dereference.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,8 @@ fn in_postfix_position<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'tcx>) -> boo
802802
match parent.kind {
803803
ExprKind::Call(child, _) | ExprKind::MethodCall(_, child, _, _) | ExprKind::Index(child, _, _)
804804
if child.hir_id == e.hir_id => true,
805-
ExprKind::Field(_, _) | ExprKind::Match(_, _, MatchSource::TryDesugar | MatchSource::AwaitDesugar) => true,
805+
ExprKind::Match(.., MatchSource::TryDesugar(_) | MatchSource::AwaitDesugar)
806+
| ExprKind::Field(_, _) => true,
806807
_ => false,
807808
}
808809
} else {

clippy_lints/src/matches/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ impl<'tcx> LateLintPass<'tcx> for Matches {
10381038
wild_in_or_pats::check(cx, arms);
10391039
}
10401040

1041-
if source == MatchSource::TryDesugar {
1041+
if let MatchSource::TryDesugar(_) = source {
10421042
try_err::check(cx, expr, ex);
10431043
}
10441044

clippy_lints/src/matches/try_err.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, scrutine
8080

8181
/// Finds function return type by examining return expressions in match arms.
8282
fn find_return_type<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx ExprKind<'_>) -> Option<Ty<'tcx>> {
83-
if let ExprKind::Match(_, arms, MatchSource::TryDesugar) = expr {
83+
if let ExprKind::Match(_, arms, MatchSource::TryDesugar(_)) = expr {
8484
for arm in *arms {
8585
if let ExprKind::Ret(Some(ret)) = arm.body.kind {
8686
return Some(cx.typeck_results().expr_ty(ret));

clippy_lints/src/methods/clone_on_copy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub(super) fn check(
6464
ExprKind::Path(QPath::LangItem(rustc_hir::LangItem::TryTraitBranch, _, _))
6565
),
6666
ExprKind::MethodCall(_, self_arg, ..) if expr.hir_id == self_arg.hir_id => true,
67-
ExprKind::Match(_, _, MatchSource::TryDesugar | MatchSource::AwaitDesugar)
67+
ExprKind::Match(_, _, MatchSource::TryDesugar(_) | MatchSource::AwaitDesugar)
6868
| ExprKind::Field(..)
6969
| ExprKind::Index(..) => true,
7070
_ => false,

clippy_lints/src/methods/str_splitn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ fn indirect_usage<'tcx>(
236236
!matches!(
237237
node,
238238
Node::Expr(Expr {
239-
kind: ExprKind::Match(.., MatchSource::TryDesugar),
239+
kind: ExprKind::Match(.., MatchSource::TryDesugar(_)),
240240
..
241241
})
242242
)

clippy_lints/src/missing_inline.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ fn is_executable_or_proc_macro(cx: &LateContext<'_>) -> bool {
7474
use rustc_session::config::CrateType;
7575

7676
cx.tcx
77-
.sess
7877
.crate_types()
7978
.iter()
8079
.any(|t: &CrateType| matches!(t, CrateType::Executable | CrateType::ProcMacro))

clippy_lints/src/needless_question_mark.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ fn check(cx: &LateContext<'_>, expr: &Expr<'_>) {
122122
} else {
123123
return;
124124
};
125-
if let ExprKind::Match(inner_expr_with_q, _, MatchSource::TryDesugar) = &arg.kind;
125+
if let ExprKind::Match(inner_expr_with_q, _, MatchSource::TryDesugar(_)) = &arg.kind;
126126
if let ExprKind::Call(called, [inner_expr]) = &inner_expr_with_q.kind;
127127
if let ExprKind::Path(QPath::LangItem(LangItem::TryTraitBranch, ..)) = &called.kind;
128128
if expr.span.ctxt() == inner_expr.span.ctxt();

0 commit comments

Comments
 (0)