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

Main example for HashSet. #15667

Merged
merged 1 commit into from
Jul 16, 2014
Merged

Main example for HashSet. #15667

merged 1 commit into from
Jul 16, 2014

Conversation

treeman
Copy link
Contributor

@treeman treeman commented Jul 14, 2014

Example code for HashSet, similar to the HashMap example.

@treeman
Copy link
Contributor Author

treeman commented Jul 16, 2014

@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
Member

That's ok, I'll take a peek

@@ -689,7 +689,7 @@ impl DefaultResizePolicy {
/// 3. Emmanuel Goossaert. ["Robin Hood hashing: backward shift
/// deletion"](http://codecapsule.com/2013/11/17/robin-hood-hashing-backward-shift-deletion/)
///
/// # Example
/// ## Example
Copy link
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
Member

Thanks for all the new examples!

@treeman
Copy link
Contributor Author

treeman commented Jul 16, 2014

Thanks for the pointers.

@alexcrichton
Copy link
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
Copy link
Contributor Author

treeman commented Jul 16, 2014

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 :)
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