Skip to content

Commit e84902d

Browse files
committed
Auto merge of #133047 - matthiaskrgr:rollup-9se1vth, r=matthiaskrgr
Rollup of 4 pull requests Successful merges: - #128197 (Skip locking span interner for some syntax context checks) - #133040 ([rustdoc] Fix handling of footnote reference in footnote definition) - #133043 (rustdoc-search: case-sensitive only when capitals are used) - #133046 (Clippy subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 90ab8ea + d6a9ded commit e84902d

File tree

100 files changed

+1269
-325
lines changed

Some content is hidden

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

100 files changed

+1269
-325
lines changed

Diff for: compiler/rustc_span/src/lib.rs

-6
Original file line numberDiff line numberDiff line change
@@ -559,12 +559,6 @@ impl Span {
559559
!self.is_dummy() && sm.is_span_accessible(self)
560560
}
561561

562-
/// Returns `true` if this span comes from any kind of macro, desugaring or inlining.
563-
#[inline]
564-
pub fn from_expansion(self) -> bool {
565-
!self.ctxt().is_root()
566-
}
567-
568562
/// Returns `true` if `span` originates in a derive-macro's expansion.
569563
pub fn in_derive_expansion(self) -> bool {
570564
matches!(self.ctxt().outer_expn_data().kind, ExpnKind::Macro(MacroKind::Derive, _))

Diff for: compiler/rustc_span/src/span_encoding.rs

+11-3
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,13 @@ impl Span {
303303
}
304304
}
305305

306+
/// Returns `true` if this span comes from any kind of macro, desugaring or inlining.
307+
#[inline]
308+
pub fn from_expansion(self) -> bool {
309+
// If the span is fully inferred then ctxt > MAX_CTXT
310+
self.inline_ctxt().map_or(true, |ctxt| !ctxt.is_root())
311+
}
312+
306313
/// Returns `true` if this is a dummy span with any hygienic context.
307314
#[inline]
308315
pub fn is_dummy(self) -> bool {
@@ -370,9 +377,10 @@ impl Span {
370377
pub fn eq_ctxt(self, other: Span) -> bool {
371378
match (self.inline_ctxt(), other.inline_ctxt()) {
372379
(Ok(ctxt1), Ok(ctxt2)) => ctxt1 == ctxt2,
373-
(Ok(ctxt), Err(index)) | (Err(index), Ok(ctxt)) => {
374-
with_span_interner(|interner| ctxt == interner.spans[index].ctxt)
375-
}
380+
// If `inline_ctxt` returns `Ok` the context is <= MAX_CTXT.
381+
// If it returns `Err` the span is fully interned and the context is > MAX_CTXT.
382+
// As these do not overlap an `Ok` and `Err` result cannot have an equal context.
383+
(Ok(_), Err(_)) | (Err(_), Ok(_)) => false,
376384
(Err(index1), Err(index2)) => with_span_interner(|interner| {
377385
interner.spans[index1].ctxt == interner.spans[index2].ctxt
378386
}),

Diff for: src/librustdoc/html/markdown/footnotes.rs

+34-26
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Markdown footnote handling.
22
use std::fmt::Write as _;
33

4-
use pulldown_cmark::{Event, Tag, TagEnd, html};
4+
use pulldown_cmark::{CowStr, Event, Tag, TagEnd, html};
55
use rustc_data_structures::fx::FxIndexMap;
66

77
use super::SpannedEvent;
@@ -21,7 +21,7 @@ struct FootnoteDef<'a> {
2121
id: usize,
2222
}
2323

24-
impl<'a, 'b, I> Footnotes<'a, 'b, I> {
24+
impl<'a, 'b, I: Iterator<Item = SpannedEvent<'a>>> Footnotes<'a, 'b, I> {
2525
pub(super) fn new(iter: I, existing_footnotes: &'b mut usize) -> Self {
2626
Footnotes { inner: iter, footnotes: FxIndexMap::default(), existing_footnotes }
2727
}
@@ -34,31 +34,50 @@ impl<'a, 'b, I> Footnotes<'a, 'b, I> {
3434
// Don't allow changing the ID of existing entrys, but allow changing the contents.
3535
(content, *id)
3636
}
37+
38+
fn handle_footnote_reference(&mut self, reference: &CowStr<'a>) -> Event<'a> {
39+
// When we see a reference (to a footnote we may not know) the definition of,
40+
// reserve a number for it, and emit a link to that number.
41+
let (_, id) = self.get_entry(reference);
42+
let reference = format!(
43+
"<sup id=\"fnref{0}\"><a href=\"#fn{0}\">{1}</a></sup>",
44+
id,
45+
// Although the ID count is for the whole page, the footnote reference
46+
// are local to the item so we make this ID "local" when displayed.
47+
id - *self.existing_footnotes
48+
);
49+
Event::Html(reference.into())
50+
}
51+
52+
fn collect_footnote_def(&mut self) -> Vec<Event<'a>> {
53+
let mut content = Vec::new();
54+
while let Some((event, _)) = self.inner.next() {
55+
match event {
56+
Event::End(TagEnd::FootnoteDefinition) => break,
57+
Event::FootnoteReference(ref reference) => {
58+
content.push(self.handle_footnote_reference(reference));
59+
}
60+
event => content.push(event),
61+
}
62+
}
63+
content
64+
}
3765
}
3866

3967
impl<'a, 'b, I: Iterator<Item = SpannedEvent<'a>>> Iterator for Footnotes<'a, 'b, I> {
4068
type Item = SpannedEvent<'a>;
4169

4270
fn next(&mut self) -> Option<Self::Item> {
4371
loop {
44-
match self.inner.next() {
72+
let next = self.inner.next();
73+
match next {
4574
Some((Event::FootnoteReference(ref reference), range)) => {
46-
// When we see a reference (to a footnote we may not know) the definition of,
47-
// reserve a number for it, and emit a link to that number.
48-
let (_, id) = self.get_entry(reference);
49-
let reference = format!(
50-
"<sup id=\"fnref{0}\"><a href=\"#fn{0}\">{1}</a></sup>",
51-
id,
52-
// Although the ID count is for the whole page, the footnote reference
53-
// are local to the item so we make this ID "local" when displayed.
54-
id - *self.existing_footnotes
55-
);
56-
return Some((Event::Html(reference.into()), range));
75+
return Some((self.handle_footnote_reference(reference), range));
5776
}
5877
Some((Event::Start(Tag::FootnoteDefinition(def)), _)) => {
5978
// When we see a footnote definition, collect the assocated content, and store
6079
// that for rendering later.
61-
let content = collect_footnote_def(&mut self.inner);
80+
let content = self.collect_footnote_def();
6281
let (entry_content, _) = self.get_entry(&def);
6382
*entry_content = content;
6483
}
@@ -80,17 +99,6 @@ impl<'a, 'b, I: Iterator<Item = SpannedEvent<'a>>> Iterator for Footnotes<'a, 'b
8099
}
81100
}
82101

83-
fn collect_footnote_def<'a>(events: impl Iterator<Item = SpannedEvent<'a>>) -> Vec<Event<'a>> {
84-
let mut content = Vec::new();
85-
for (event, _) in events {
86-
if let Event::End(TagEnd::FootnoteDefinition) = event {
87-
break;
88-
}
89-
content.push(event);
90-
}
91-
content
92-
}
93-
94102
fn render_footnotes_defs(mut footnotes: Vec<FootnoteDef<'_>>) -> String {
95103
let mut ret = String::from("<div class=\"footnotes\"><hr><ol>");
96104

Diff for: src/librustdoc/html/static/js/search.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -2667,6 +2667,7 @@ class DocSearch {
26672667
const sortResults = async(results, typeInfo, preferredCrate) => {
26682668
const userQuery = parsedQuery.userQuery;
26692669
const normalizedUserQuery = parsedQuery.userQuery.toLowerCase();
2670+
const isMixedCase = normalizedUserQuery !== userQuery;
26702671
const result_list = [];
26712672
for (const result of results.values()) {
26722673
result.item = this.searchIndex[result.id];
@@ -2678,10 +2679,12 @@ class DocSearch {
26782679
let a, b;
26792680

26802681
// sort by exact case-sensitive match
2681-
a = (aaa.item.name !== userQuery);
2682-
b = (bbb.item.name !== userQuery);
2683-
if (a !== b) {
2684-
return a - b;
2682+
if (isMixedCase) {
2683+
a = (aaa.item.name !== userQuery);
2684+
b = (bbb.item.name !== userQuery);
2685+
if (a !== b) {
2686+
return a - b;
2687+
}
26852688
}
26862689

26872690
// sort by exact match with regard to the last word (mismatch goes later)

Diff for: src/tools/clippy/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -6071,6 +6071,7 @@ Released 2018-09-13
60716071
[`unnecessary_literal_bound`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_literal_bound
60726072
[`unnecessary_literal_unwrap`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_literal_unwrap
60736073
[`unnecessary_map_on_constructor`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_on_constructor
6074+
[`unnecessary_map_or`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or
60746075
[`unnecessary_min_or_max`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_min_or_max
60756076
[`unnecessary_mut_passed`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed
60766077
[`unnecessary_operation`]: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_operation

Diff for: src/tools/clippy/clippy_dev/src/setup/vscode.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ fn delete_vs_task_file(path: &Path) -> bool {
8484
/// It may fail silently.
8585
fn try_delete_vs_directory_if_empty() {
8686
let path = Path::new(VSCODE_DIR);
87-
if path.read_dir().map_or(false, |mut iter| iter.next().is_none()) {
87+
if path.read_dir().is_ok_and(|mut iter| iter.next().is_none()) {
8888
// The directory is empty. We just try to delete it but allow a silence
8989
// fail as an empty `.vscode` directory is still valid
9090
let _silence_result = fs::remove_dir(path);

Diff for: src/tools/clippy/clippy_lints/src/attrs/useless_attribute.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub(super) fn check(cx: &EarlyContext<'_>, item: &Item, attrs: &[Attribute]) {
1616
return;
1717
}
1818
if let Some(lint_list) = &attr.meta_item_list() {
19-
if attr.ident().map_or(false, |ident| is_lint_level(ident.name, attr.id)) {
19+
if attr.ident().is_some_and(|ident| is_lint_level(ident.name, attr.id)) {
2020
for lint in lint_list {
2121
match item.kind {
2222
ItemKind::Use(..) => {

Diff for: src/tools/clippy/clippy_lints/src/attrs/utils.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fn is_relevant_block(cx: &LateContext<'_>, typeck_results: &ty::TypeckResults<'_
5050
block
5151
.expr
5252
.as_ref()
53-
.map_or(false, |e| is_relevant_expr(cx, typeck_results, e)),
53+
.is_some_and(|e| is_relevant_expr(cx, typeck_results, e)),
5454
|stmt| match &stmt.kind {
5555
StmtKind::Let(_) => true,
5656
StmtKind::Expr(expr) | StmtKind::Semi(expr) => is_relevant_expr(cx, typeck_results, expr),
@@ -60,7 +60,7 @@ fn is_relevant_block(cx: &LateContext<'_>, typeck_results: &ty::TypeckResults<'_
6060
}
6161

6262
fn is_relevant_expr(cx: &LateContext<'_>, typeck_results: &ty::TypeckResults<'_>, expr: &Expr<'_>) -> bool {
63-
if macro_backtrace(expr.span).last().map_or(false, |macro_call| {
63+
if macro_backtrace(expr.span).last().is_some_and(|macro_call| {
6464
is_panic(cx, macro_call.def_id) || cx.tcx.item_name(macro_call.def_id) == sym::unreachable
6565
}) {
6666
return false;

Diff for: src/tools/clippy/clippy_lints/src/bool_assert_comparison.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ fn is_impl_not_trait_with_bool_out<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -
6060
trait_id,
6161
)
6262
})
63-
.map_or(false, |assoc_item| {
64-
let proj = Ty::new_projection_from_args(cx.tcx, assoc_item.def_id, cx.tcx.mk_args_trait(ty, []));
63+
.is_some_and(|assoc_item| {
64+
let proj = Ty::new_projection(cx.tcx, assoc_item.def_id, cx.tcx.mk_args_trait(ty, []));
6565
let nty = cx.tcx.normalize_erasing_regions(cx.param_env, proj);
6666

6767
nty.is_bool()

Diff for: src/tools/clippy/clippy_lints/src/booleans.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -667,5 +667,5 @@ fn implements_ord(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
667667
let ty = cx.typeck_results().expr_ty(expr);
668668
cx.tcx
669669
.get_diagnostic_item(sym::Ord)
670-
.map_or(false, |id| implements_trait(cx, ty, id, &[]))
670+
.is_some_and(|id| implements_trait(cx, ty, id, &[]))
671671
}

Diff for: src/tools/clippy/clippy_lints/src/box_default.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl LateLintPass<'_> for BoxDefault {
4545
// And that method is `new`
4646
&& seg.ident.name == sym::new
4747
// And the call is that of a `Box` method
48-
&& path_def_id(cx, ty).map_or(false, |id| Some(id) == cx.tcx.lang_items().owned_box())
48+
&& path_def_id(cx, ty).is_some_and(|id| Some(id) == cx.tcx.lang_items().owned_box())
4949
// And the single argument to the call is another function call
5050
// This is the `T::default()` (or default equivalent) of `Box::new(T::default())`
5151
&& let ExprKind::Call(arg_path, _) = arg.kind
@@ -83,9 +83,9 @@ fn is_plain_default(cx: &LateContext<'_>, arg_path: &Expr<'_>) -> bool {
8383
}
8484

8585
fn is_local_vec_expn(cx: &LateContext<'_>, expr: &Expr<'_>, ref_expr: &Expr<'_>) -> bool {
86-
macro_backtrace(expr.span).next().map_or(false, |call| {
87-
cx.tcx.is_diagnostic_item(sym::vec_macro, call.def_id) && call.span.eq_ctxt(ref_expr.span)
88-
})
86+
macro_backtrace(expr.span)
87+
.next()
88+
.is_some_and(|call| cx.tcx.is_diagnostic_item(sym::vec_macro, call.def_id) && call.span.eq_ctxt(ref_expr.span))
8989
}
9090

9191
#[derive(Default)]

Diff for: src/tools/clippy/clippy_lints/src/casts/unnecessary_cast.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,7 @@ pub(super) fn check<'tcx>(
159159
// The same is true if the expression encompassing the cast expression is a unary
160160
// expression or an addressof expression.
161161
let needs_block = matches!(cast_expr.kind, ExprKind::Unary(..) | ExprKind::AddrOf(..))
162-
|| get_parent_expr(cx, expr)
163-
.map_or(false, |e| matches!(e.kind, ExprKind::Unary(..) | ExprKind::AddrOf(..)));
162+
|| get_parent_expr(cx, expr).is_some_and(|e| matches!(e.kind, ExprKind::Unary(..) | ExprKind::AddrOf(..)));
164163

165164
span_lint_and_sugg(
166165
cx,

Diff for: src/tools/clippy/clippy_lints/src/comparison_chain.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl<'tcx> LateLintPass<'tcx> for ComparisonChain {
110110
let is_ord = cx
111111
.tcx
112112
.get_diagnostic_item(sym::Ord)
113-
.map_or(false, |id| implements_trait(cx, ty, id, &[]));
113+
.is_some_and(|id| implements_trait(cx, ty, id, &[]));
114114

115115
if !is_ord {
116116
return;

Diff for: src/tools/clippy/clippy_lints/src/copies.rs

+6-10
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ fn eq_binding_names(s: &Stmt<'_>, names: &[(HirId, Symbol)]) -> bool {
345345
let mut i = 0usize;
346346
let mut res = true;
347347
l.pat.each_binding_or_first(&mut |_, _, _, name| {
348-
if names.get(i).map_or(false, |&(_, n)| n == name.name) {
348+
if names.get(i).is_some_and(|&(_, n)| n == name.name) {
349349
i += 1;
350350
} else {
351351
res = false;
@@ -389,12 +389,10 @@ fn eq_stmts(
389389
let new_bindings = &moved_bindings[old_count..];
390390
blocks
391391
.iter()
392-
.all(|b| get_stmt(b).map_or(false, |s| eq_binding_names(s, new_bindings)))
392+
.all(|b| get_stmt(b).is_some_and(|s| eq_binding_names(s, new_bindings)))
393393
} else {
394394
true
395-
}) && blocks
396-
.iter()
397-
.all(|b| get_stmt(b).map_or(false, |s| eq.eq_stmt(s, stmt)))
395+
}) && blocks.iter().all(|b| get_stmt(b).is_some_and(|s| eq.eq_stmt(s, stmt)))
398396
}
399397

400398
#[expect(clippy::too_many_lines)]
@@ -451,9 +449,7 @@ fn scan_block_for_eq<'tcx>(
451449
// x + 50
452450
let expr_hash_eq = if let Some(e) = block.expr {
453451
let hash = hash_expr(cx, e);
454-
blocks
455-
.iter()
456-
.all(|b| b.expr.map_or(false, |e| hash_expr(cx, e) == hash))
452+
blocks.iter().all(|b| b.expr.is_some_and(|e| hash_expr(cx, e) == hash))
457453
} else {
458454
blocks.iter().all(|b| b.expr.is_none())
459455
};
@@ -514,7 +510,7 @@ fn scan_block_for_eq<'tcx>(
514510
});
515511
if let Some(e) = block.expr {
516512
for block in blocks {
517-
if block.expr.map_or(false, |expr| !eq.eq_expr(expr, e)) {
513+
if block.expr.is_some_and(|expr| !eq.eq_expr(expr, e)) {
518514
moved_locals.truncate(moved_locals_at_start);
519515
return BlockEq {
520516
start_end_eq,
@@ -533,7 +529,7 @@ fn scan_block_for_eq<'tcx>(
533529
}
534530

535531
fn check_for_warn_of_moved_symbol(cx: &LateContext<'_>, symbols: &[(HirId, Symbol)], if_expr: &Expr<'_>) -> bool {
536-
get_enclosing_block(cx, if_expr.hir_id).map_or(false, |block| {
532+
get_enclosing_block(cx, if_expr.hir_id).is_some_and(|block| {
537533
let ignore_span = block.span.shrink_to_lo().to(if_expr.span);
538534

539535
symbols

Diff for: src/tools/clippy/clippy_lints/src/declared_lints.rs

+1
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,7 @@ pub static LINTS: &[&crate::LintInfo] = &[
481481
crate::methods::UNNECESSARY_JOIN_INFO,
482482
crate::methods::UNNECESSARY_LAZY_EVALUATIONS_INFO,
483483
crate::methods::UNNECESSARY_LITERAL_UNWRAP_INFO,
484+
crate::methods::UNNECESSARY_MAP_OR_INFO,
484485
crate::methods::UNNECESSARY_MIN_OR_MAX_INFO,
485486
crate::methods::UNNECESSARY_RESULT_MAP_OR_ELSE_INFO,
486487
crate::methods::UNNECESSARY_SORT_BY_INFO,

Diff for: src/tools/clippy/clippy_lints/src/default_numeric_fallback.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,6 @@ impl<'tcx> From<Ty<'tcx>> for ExplicitTyBound {
253253

254254
impl<'tcx> From<Option<Ty<'tcx>>> for ExplicitTyBound {
255255
fn from(v: Option<Ty<'tcx>>) -> Self {
256-
Self(v.map_or(false, Ty::is_numeric))
256+
Self(v.is_some_and(Ty::is_numeric))
257257
}
258258
}

Diff for: src/tools/clippy/clippy_lints/src/derivable_impls.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ fn is_path_self(e: &Expr<'_>) -> bool {
8181
fn contains_trait_object(ty: Ty<'_>) -> bool {
8282
match ty.kind() {
8383
ty::Ref(_, ty, _) => contains_trait_object(*ty),
84-
ty::Adt(def, args) => def.is_box() && args[0].as_type().map_or(false, contains_trait_object),
84+
ty::Adt(def, args) => def.is_box() && args[0].as_type().is_some_and(contains_trait_object),
8585
ty::Dynamic(..) => true,
8686
_ => false,
8787
}

Diff for: src/tools/clippy/clippy_lints/src/derive.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ fn check_copy_clone<'tcx>(cx: &LateContext<'tcx>, item: &Item<'_>, trait_ref: &h
327327
// there's a Copy impl for any instance of the adt.
328328
if !is_copy(cx, ty) {
329329
if ty_subs.non_erasable_generics().next().is_some() {
330-
let has_copy_impl = cx.tcx.all_local_trait_impls(()).get(&copy_id).map_or(false, |impls| {
330+
let has_copy_impl = cx.tcx.all_local_trait_impls(()).get(&copy_id).is_some_and(|impls| {
331331
impls.iter().any(|&id| {
332332
matches!(cx.tcx.type_of(id).instantiate_identity().kind(), ty::Adt(adt, _)
333333
if ty_adt.did() == adt.did())

Diff for: src/tools/clippy/clippy_lints/src/doc/missing_headers.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub fn check(
4747
),
4848
_ => (),
4949
}
50-
if !headers.panics && panic_info.map_or(false, |el| !el.1) {
50+
if !headers.panics && panic_info.is_some_and(|el| !el.1) {
5151
span_lint_and_note(
5252
cx,
5353
MISSING_PANICS_DOC,

Diff for: src/tools/clippy/clippy_lints/src/drop_forget_ref.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetRef {
112112
MEM_FORGET,
113113
Cow::Owned(format!(
114114
"usage of `mem::forget` on {}",
115-
if arg_ty.ty_adt_def().map_or(false, |def| def.has_dtor(cx.tcx)) {
115+
if arg_ty.ty_adt_def().is_some_and(|def| def.has_dtor(cx.tcx)) {
116116
"`Drop` type"
117117
} else {
118118
"type with `Drop` fields"

Diff for: src/tools/clippy/clippy_lints/src/eta_reduction.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ fn check_clousure<'tcx>(cx: &LateContext<'tcx>, outer_receiver: Option<&Expr<'tc
196196
{
197197
span_lint_and_then(cx, REDUNDANT_CLOSURE, expr.span, "redundant closure", |diag| {
198198
if let Some(mut snippet) = snippet_opt(cx, callee.span) {
199-
if path_to_local(callee).map_or(false, |l| {
199+
if path_to_local(callee).is_some_and(|l| {
200200
// FIXME: Do we really need this `local_used_in` check?
201201
// Isn't it checking something like... `callee(callee)`?
202202
// If somehow this check is needed, add some test for it,

Diff for: src/tools/clippy/clippy_lints/src/functions/not_unsafe_ptr_arg_deref.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ fn raw_ptr_arg(cx: &LateContext<'_>, arg: &hir::Param<'_>) -> Option<HirId> {
8787
}
8888

8989
fn check_arg(cx: &LateContext<'_>, raw_ptrs: &HirIdSet, arg: &hir::Expr<'_>) {
90-
if path_to_local(arg).map_or(false, |id| raw_ptrs.contains(&id)) {
90+
if path_to_local(arg).is_some_and(|id| raw_ptrs.contains(&id)) {
9191
span_lint(
9292
cx,
9393
NOT_UNSAFE_PTR_ARG_DEREF,

0 commit comments

Comments
 (0)