Skip to content

Commit 1d33469

Browse files
committed
Auto merge of #11157 - flip1995:rustup, r=flip1995
Rustup r? `@ghost` changelog: none
2 parents bafde54 + 753c30f commit 1d33469

File tree

92 files changed

+503
-474
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+503
-474
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.72"
3+
version = "0.1.73"
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_dev/src/setup/intellij.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl ClippyProjectInfo {
3737

3838
pub fn setup_rustc_src(rustc_path: &str) {
3939
let Ok(rustc_source_dir) = check_and_get_rustc_dir(rustc_path) else {
40-
return
40+
return;
4141
};
4242

4343
for project in CLIPPY_PROJECTS {

clippy_dev/src/update_lints.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,10 @@ pub fn deprecate(name: &str, reason: Option<&String>) {
340340
let name_upper = name.to_uppercase();
341341

342342
let (mut lints, deprecated_lints, renamed_lints) = gather_all();
343-
let Some(lint) = lints.iter().find(|l| l.name == name_lower) else { eprintln!("error: failed to find lint `{name}`"); return; };
343+
let Some(lint) = lints.iter().find(|l| l.name == name_lower) else {
344+
eprintln!("error: failed to find lint `{name}`");
345+
return;
346+
};
344347

345348
let mod_path = {
346349
let mut mod_path = PathBuf::from(format!("clippy_lints/src/{}", lint.module));

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.72"
3+
version = "0.1.73"
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/assertions_on_constants.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,20 @@ declare_lint_pass!(AssertionsOnConstants => [ASSERTIONS_ON_CONSTANTS]);
3131

3232
impl<'tcx> LateLintPass<'tcx> for AssertionsOnConstants {
3333
fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) {
34-
let Some(macro_call) = root_macro_call_first_node(cx, e) else { return };
34+
let Some(macro_call) = root_macro_call_first_node(cx, e) else {
35+
return;
36+
};
3537
let is_debug = match cx.tcx.get_diagnostic_name(macro_call.def_id) {
3638
Some(sym::debug_assert_macro) => true,
3739
Some(sym::assert_macro) => false,
3840
_ => return,
3941
};
40-
let Some((condition, panic_expn)) = find_assert_args(cx, e, macro_call.expn) else { return };
41-
let Some(Constant::Bool(val)) = constant(cx, cx.typeck_results(), condition) else { return };
42+
let Some((condition, panic_expn)) = find_assert_args(cx, e, macro_call.expn) else {
43+
return;
44+
};
45+
let Some(Constant::Bool(val)) = constant(cx, cx.typeck_results(), condition) else {
46+
return;
47+
};
4248
if val {
4349
span_lint_and_help(
4450
cx,

clippy_lints/src/bool_assert_comparison.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ fn is_impl_not_trait_with_bool_out<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -
6161
)
6262
})
6363
.map_or(false, |assoc_item| {
64-
let proj = cx.tcx.mk_projection(assoc_item.def_id, cx.tcx.mk_substs_trait(ty, []));
64+
let proj = Ty::new_projection(cx.tcx, assoc_item.def_id, cx.tcx.mk_substs_trait(ty, []));
6565
let nty = cx.tcx.normalize_erasing_regions(cx.param_env, proj);
6666

6767
nty.is_bool()
@@ -70,14 +70,18 @@ fn is_impl_not_trait_with_bool_out<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -
7070

7171
impl<'tcx> LateLintPass<'tcx> for BoolAssertComparison {
7272
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
73-
let Some(macro_call) = root_macro_call_first_node(cx, expr) else { return };
73+
let Some(macro_call) = root_macro_call_first_node(cx, expr) else {
74+
return;
75+
};
7476
let macro_name = cx.tcx.item_name(macro_call.def_id);
7577
let eq_macro = match macro_name.as_str() {
7678
"assert_eq" | "debug_assert_eq" => true,
7779
"assert_ne" | "debug_assert_ne" => false,
7880
_ => return,
7981
};
80-
let Some ((a, b, _)) = find_assert_eq_args(cx, expr, macro_call.expn) else { return };
82+
let Some((a, b, _)) = find_assert_eq_args(cx, expr, macro_call.expn) else {
83+
return;
84+
};
8185

8286
let a_span = a.span.source_callsite();
8387
let b_span = b.span.source_callsite();
@@ -126,7 +130,9 @@ impl<'tcx> LateLintPass<'tcx> for BoolAssertComparison {
126130
let mut suggestions = vec![(name_span, non_eq_mac.to_string()), (lit_span, String::new())];
127131

128132
if bool_value ^ eq_macro {
129-
let Some(sugg) = Sugg::hir_opt(cx, non_lit_expr) else { return };
133+
let Some(sugg) = Sugg::hir_opt(cx, non_lit_expr) else {
134+
return;
135+
};
130136
suggestions.push((non_lit_expr.span, (!sugg).to_string()));
131137
}
132138

clippy_lints/src/dbg_macro.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ impl DbgMacro {
7171

7272
impl LateLintPass<'_> for DbgMacro {
7373
fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) {
74-
let Some(macro_call) = root_macro_call_first_node(cx, expr) else { return };
74+
let Some(macro_call) = root_macro_call_first_node(cx, expr) else {
75+
return;
76+
};
7577
if cx.tcx.is_diagnostic_item(sym::dbg_macro, macro_call.def_id) {
7678
// allows `dbg!` in test code if allow-dbg-in-test is set to true in clippy.toml
7779
if self.allow_dbg_in_tests

clippy_lints/src/declared_lints.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
171171
crate::float_literal::LOSSY_FLOAT_LITERAL_INFO,
172172
crate::floating_point_arithmetic::IMPRECISE_FLOPS_INFO,
173173
crate::floating_point_arithmetic::SUBOPTIMAL_FLOPS_INFO,
174-
crate::fn_null_check::FN_NULL_CHECK_INFO,
175174
crate::format::USELESS_FORMAT_INFO,
176175
crate::format_args::FORMAT_IN_FORMAT_ARGS_INFO,
177176
crate::format_args::TO_STRING_IN_FORMAT_ARGS_INFO,

clippy_lints/src/dereference.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,9 @@ fn needless_borrow_impl_arg_position<'tcx>(
11291129
let destruct_trait_def_id = cx.tcx.lang_items().destruct_trait();
11301130
let sized_trait_def_id = cx.tcx.lang_items().sized_trait();
11311131

1132-
let Some(callee_def_id) = fn_def_id(cx, parent) else { return Position::Other(precedence) };
1132+
let Some(callee_def_id) = fn_def_id(cx, parent) else {
1133+
return Position::Other(precedence);
1134+
};
11331135
let fn_sig = cx.tcx.fn_sig(callee_def_id).subst_identity().skip_binder();
11341136
let substs_with_expr_ty = cx
11351137
.typeck_results()

clippy_lints/src/derivable_impls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_hir::{
88
self as hir, Body, Expr, ExprKind, GenericArg, Impl, ImplItemKind, Item, ItemKind, Node, PathSegment, QPath, TyKind,
99
};
1010
use rustc_lint::{LateContext, LateLintPass};
11-
use rustc_middle::ty::adjustment::{Adjust, PointerCast};
11+
use rustc_middle::ty::adjustment::{Adjust, PointerCoercion};
1212
use rustc_middle::ty::{self, Adt, AdtDef, SubstsRef, Ty, TypeckResults};
1313
use rustc_session::{declare_tool_lint, impl_lint_pass};
1414
use rustc_span::sym;
@@ -115,7 +115,7 @@ fn check_struct<'tcx>(
115115
let is_default_without_adjusts = |expr| {
116116
is_default_equivalent(cx, expr)
117117
&& typeck_results.expr_adjustments(expr).iter().all(|adj| {
118-
!matches!(adj.kind, Adjust::Pointer(PointerCast::Unsize)
118+
!matches!(adj.kind, Adjust::Pointer(PointerCoercion::Unsize)
119119
if contains_trait_object(adj.target))
120120
})
121121
};

0 commit comments

Comments
 (0)