Skip to content

Main example for HashSet. - #15667

Merged
bors merged 1 commit into
rust-lang:masterfrom
treeman:set-doc
Jul 16, 2014
Merged

Main example for HashSet.#15667
bors merged 1 commit into
rust-lang:masterfrom
treeman:set-doc

Conversation

@treeman

@treeman treeman commented Jul 14, 2014

Copy link
Copy Markdown
Contributor

Example code for HashSet, similar to the HashMap example.

@treeman

treeman commented Jul 16, 2014

Copy link
Copy Markdown
Contributor Author

@alexcrichton It appears I have accidentally pushed up some more documentation changes to this pull request instead of creating a new. Shall I create a new one or roll with this?

@alexcrichton

Copy link
Copy Markdown
Member

That's ok, I'll take a peek

Comment thread src/libstd/collections/hashmap.rs Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The predominant style in the rest of the documentation is to use one hash mark, why change to two?

@alexcrichton

Copy link
Copy Markdown
Member

Thanks for all the new examples!

@treeman

treeman commented Jul 16, 2014

Copy link
Copy Markdown
Contributor Author

Thanks for the pointers.

@alexcrichton

Copy link
Copy Markdown
Member

Looks good to me! Could you squash the commits into one with a description about what documentation was added?

Add main example and simple examples for the methods.
@treeman

treeman commented Jul 16, 2014

Copy link
Copy Markdown
Contributor Author

Done.

bors added a commit that referenced this pull request Jul 16, 2014
@bors bors closed this Jul 16, 2014
@bors
bors merged commit 80ef6b8 into rust-lang:master Jul 16, 2014
@treeman
treeman deleted the set-doc branch July 20, 2014 11:33
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 13, 2023
…ykril

fix: make bool_to_enum assist create enum at top-level

This pr makes the `bool_to_enum` assist create the `enum` at the next closest module block or at top-level, which fixes a few tricky cases such as with an associated `const` in a trait or module:

```rust
trait Foo {
    const $0BOOL: bool;
}

impl Foo for usize {
    const BOOL: bool = true;
}

fn main() {
    if <usize as Foo>::BOOL {
        println!("foo");
    }
}
```

Which now properly produces:

```rust
#[derive(PartialEq, Eq)]
enum Bool { True, False }

trait Foo {
    const BOOL: Bool;
}

impl Foo for usize {
    const BOOL: Bool = Bool::True;
}

fn main() {
    if <usize as Foo>::BOOL == Bool::True {
        println!("foo");
    }
}
```

I also think it's a bit nicer, especially for local variables, but didn't really know to do it in the first PR :)
flip1995 pushed a commit to flip1995/rust that referenced this pull request Sep 18, 2025
…ust-lang#15667)

Fixes rust-lang/rust-clippy#14157
Fixes rust-lang/rust-clippy#15666

changelog: [`elidable_lifetime_names`]: avoid overlapping spans in
suggestions

r? clippy
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

Successfully merging this pull request may close these issues.

3 participants