Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weak keyword union oddity #27

Open
cyqsimon opened this issue Jan 23, 2022 · 0 comments
Open

Weak keyword union oddity #27

cyqsimon opened this issue Jan 23, 2022 · 0 comments

Comments

@cyqsimon
Copy link

The "weak keyword" (see https://doc.rust-lang.org/reference/keywords.html#weak-keywords) union when used in the context of the function HashSet::union, sometimes receives erroneous highlighting.

Problematic code sample

use std::collections::HashSet;

fn main() {
    let set_a = HashSet::from([0, 1]);
    let set_b = HashSet::from([2, 3]);

    let set_c: HashSet<_> = set_a.union(&set_b).collect();
    dbg!(set_c);

    let set_d: HashSet<_> = [set_a, set_b]
        .into_iter()
        .reduce(|acc, set| acc.union(&set).cloned().collect())
        .unwrap();
    dbg!(set_d);
}

Observe that the two calls to HashSet::union are highlighted differently.

shot-20220121-195731

P.S. This issue was originally raised here: microsoft/vscode#141141

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant