Skip to content

filter_map_bool_then should not show the macro definition in suggestions #15047

Open
@profetia

Description

@profetia

Summary

filter_map_bool_then wrongly showed the macro definition instead of its call site in suggestions

Reproducer

I tried this code:

    tokenize_with_text(&snippet)
        .filter_map(|(t, s, inner)| {
            matches!(t, TokenKind::Ident if s == keyword).then(|| {
                span.split_at(inner.start as u32)
                    .1
                    .split_at((inner.end - inner.start) as u32)
                    .0
            })
        })

I expected to see this happen:

.filter(|&(t, s, inner)| matches!(t, TokenKind::Ident if s == keyword))
.map(..)

Instead, this happened:

.filter(|&(t, s, inner)| match $expression {
    $pattern $(if $guard)? => true,
    _ => false
}).map(..)

Version


Additional Labels

@rustbot label + I-suggestion-causes-error

Metadata

Metadata

Assignees

Labels

C-bugCategory: Clippy is not doing the correct thing

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions