Skip to content

Commit 3ba9ac9

Browse files
committed
submodules: update clippy from be5d17f to 868f168
Changes: ```` rustup rust-lang/rust#61836 fix suggestion for floating points inequality ````
1 parent 1e916c4 commit 3ba9ac9

11 files changed

+21
-16
lines changed

clippy_lints/src/derive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ fn check_hash_peq<'a, 'tcx>(
114114
cx, DERIVE_HASH_XOR_EQ, span,
115115
mess,
116116
|db| {
117-
if let Some(node_id) = cx.tcx.hir().as_local_node_id(impl_id) {
117+
if let Some(node_id) = cx.tcx.hir().as_local_hir_id(impl_id) {
118118
db.span_note(
119119
cx.tcx.hir().span(node_id),
120120
"`PartialEq` implemented here"

clippy_lints/src/enum_glob_use.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EnumGlobUse {
3232
let map = cx.tcx.hir();
3333
// only check top level `use` statements
3434
for item in &m.item_ids {
35-
self.lint_item(cx, map.expect_item(map.hir_to_node_id(item.id)));
35+
self.lint_item(cx, map.expect_item(item.id));
3636
}
3737
}
3838
}

clippy_lints/src/escape.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoxedLocal {
9494
span_lint(
9595
cx,
9696
BOXED_LOCAL,
97-
cx.tcx.hir().span_by_hir_id(node),
97+
cx.tcx.hir().span(node),
9898
"local variable doesn't need to be boxed here",
9999
);
100100
}

clippy_lints/src/lifetimes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ impl<'a, 'tcx> Visitor<'tcx> for RefVisitor<'a, 'tcx> {
346346
},
347347
TyKind::Def(item, _) => {
348348
let map = self.cx.tcx.hir();
349-
if let ItemKind::Existential(ref exist_ty) = map.expect_item(map.hir_to_node_id(item.id)).node {
349+
if let ItemKind::Existential(ref exist_ty) = map.expect_item(item.id).node {
350350
for bound in &exist_ty.bounds {
351351
if let GenericBound::Outlives(_) = *bound {
352352
self.record(&None);

clippy_lints/src/methods/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Methods {
947947
}
948948
let name = implitem.ident.name.as_str();
949949
let parent = cx.tcx.hir().get_parent_item(implitem.hir_id);
950-
let item = cx.tcx.hir().expect_item_by_hir_id(parent);
950+
let item = cx.tcx.hir().expect_item(parent);
951951
let def_id = cx.tcx.hir().local_def_id_from_hir_id(item.hir_id);
952952
let ty = cx.tcx.type_of(def_id);
953953
if_chain! {
@@ -1070,7 +1070,7 @@ fn lint_or_fun_call<'a, 'tcx: 'a>(
10701070

10711071
if call_found {
10721072
// don't lint for constant values
1073-
let owner_def = self.cx.tcx.hir().get_parent_did_by_hir_id(expr.hir_id);
1073+
let owner_def = self.cx.tcx.hir().get_parent_did(expr.hir_id);
10741074
let promotable = self
10751075
.cx
10761076
.tcx

clippy_lints/src/misc.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,11 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MiscLints {
387387
db.span_suggestion(
388388
expr.span,
389389
"consider comparing them within some error",
390-
format!("({}).abs() < error", lhs - rhs),
390+
format!(
391+
"({}).abs() {} error",
392+
lhs - rhs,
393+
if op == BinOpKind::Eq { '<' } else { '>' }
394+
),
391395
Applicability::MachineApplicable, // snippet
392396
);
393397
db.span_note(expr.span, "std::f32::EPSILON and std::f64::EPSILON are available.");
@@ -601,7 +605,7 @@ fn in_attributes_expansion(expr: &Expr) -> bool {
601605
/// Tests whether `res` is a variable defined outside a macro.
602606
fn non_macro_local(cx: &LateContext<'_, '_>, res: def::Res) -> bool {
603607
if let def::Res::Local(id) = res {
604-
!in_macro_or_desugar(cx.tcx.hir().span_by_hir_id(id))
608+
!in_macro_or_desugar(cx.tcx.hir().span(id))
605609
} else {
606610
false
607611
}

clippy_lints/src/new_without_default.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault {
146146
if let Some(self_def) = cx.tcx.type_of(self_did).ty_adt_def();
147147
if self_def.did.is_local();
148148
then {
149-
let self_id = cx.tcx.hir().local_def_id_to_node_id(self_def.did.to_local());
150-
if impling_types.contains(&self_id) {
149+
let self_id = cx.tcx.hir().local_def_id_to_hir_id(self_def.did.to_local());
150+
let node_id = cx.tcx.hir().hir_to_node_id(self_id);
151+
if impling_types.contains(&node_id) {
151152
return;
152153
}
153154
}

clippy_lints/src/non_copy_const.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonCopyConst {
170170
fn check_impl_item(&mut self, cx: &LateContext<'a, 'tcx>, impl_item: &'tcx ImplItem) {
171171
if let ImplItemKind::Const(hir_ty, ..) = &impl_item.node {
172172
let item_hir_id = cx.tcx.hir().get_parent_node_by_hir_id(impl_item.hir_id);
173-
let item = cx.tcx.hir().expect_item_by_hir_id(item_hir_id);
173+
let item = cx.tcx.hir().expect_item(item_hir_id);
174174
// Ensure the impl is an inherent impl.
175175
if let ItemKind::Impl(_, _, _, _, None, _, _) = item.node {
176176
let ty = hir_ty_to_ty(cx.tcx, hir_ty);

clippy_lints/src/utils/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ pub fn any_parent_is_automatically_derived(tcx: TyCtxt<'_>, node: HirId) -> bool
978978
let mut prev_enclosing_node = None;
979979
let mut enclosing_node = node;
980980
while Some(enclosing_node) != prev_enclosing_node {
981-
if is_automatically_derived(map.attrs_by_hir_id(enclosing_node)) {
981+
if is_automatically_derived(map.attrs(enclosing_node)) {
982982
return true;
983983
}
984984
prev_enclosing_node = Some(enclosing_node);

tests/ui/float_cmp.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: strict comparison of f32 or f64
22
--> $DIR/float_cmp.rs:60:5
33
|
44
LL | ONE as f64 != 2.0;
5-
| ^^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(ONE as f64 - 2.0).abs() < error`
5+
| ^^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(ONE as f64 - 2.0).abs() > error`
66
|
77
= note: `-D clippy::float-cmp` implied by `-D warnings`
88
note: std::f32::EPSILON and std::f64::EPSILON are available.
@@ -27,7 +27,7 @@ error: strict comparison of f32 or f64
2727
--> $DIR/float_cmp.rs:68:5
2828
|
2929
LL | twice(x) != twice(ONE as f64);
30-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(twice(x) - twice(ONE as f64)).abs() < error`
30+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some error: `(twice(x) - twice(ONE as f64)).abs() > error`
3131
|
3232
note: std::f32::EPSILON and std::f64::EPSILON are available.
3333
--> $DIR/float_cmp.rs:68:5

tests/ui/float_cmp_const.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ error: strict comparison of f32 or f64 constant
2727
--> $DIR/float_cmp_const.rs:20:5
2828
|
2929
LL | TWO != ONE;
30-
| ^^^^^^^^^^ help: consider comparing them within some error: `(TWO - ONE).abs() < error`
30+
| ^^^^^^^^^^ help: consider comparing them within some error: `(TWO - ONE).abs() > error`
3131
|
3232
note: std::f32::EPSILON and std::f64::EPSILON are available.
3333
--> $DIR/float_cmp_const.rs:20:5
@@ -75,7 +75,7 @@ error: strict comparison of f32 or f64 constant
7575
--> $DIR/float_cmp_const.rs:27:5
7676
|
7777
LL | v != ONE;
78-
| ^^^^^^^^ help: consider comparing them within some error: `(v - ONE).abs() < error`
78+
| ^^^^^^^^ help: consider comparing them within some error: `(v - ONE).abs() > error`
7979
|
8080
note: std::f32::EPSILON and std::f64::EPSILON are available.
8181
--> $DIR/float_cmp_const.rs:27:5

0 commit comments

Comments
 (0)