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

Remove references to guide-conditions #12539

Merged
merged 1 commit into from
Feb 26, 2014
Merged

Remove references to guide-conditions #12539

merged 1 commit into from
Feb 26, 2014

Conversation

gmjosack
Copy link
Contributor

std::condition was removed in 454882d
but there are still links to the guide. Removing them.

std::condition was removed in 454882d
but there are still links to the guide. Removing them.
@flaper87
Copy link
Contributor

LGTM

@alexcrichton
Copy link
Member

Can you remove the merge commit as well?

@gmjosack
Copy link
Contributor Author

Done.

bors added a commit that referenced this pull request Feb 26, 2014
std::condition was removed in 454882d
but there are still links to the guide. Removing them.
@bors bors closed this Feb 26, 2014
@bors bors merged commit 7e85431 into rust-lang:master Feb 26, 2014
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 25, 2022
…ykril

Automatically instaciate trivially instaciable structs in "Generate new" and "Fill struct fields"

As proposed in rust-lang#12535 this PR changes the "Generate new" and "Fill struct fields" assist/diagnostic to instanciate structs with no fields and enums with a single empty variant.

For example:
```rust
pub enum Bar {
    Bar {},
}
struct Foo<T> {
    a: usize,
    bar: Bar,
    _phantom: std::marker::PhantomData<T>,
}
impl<T> Foo<T> {
    /* generate new */

    fn random() -> Self {
        Self { /* Fill struct fields */ }
    }
}
```

was previously:
```rust
impl<T> Foo<T> {
    fn new(a: usize, bar: Bar, _phantom: std::marker::PhantomData<T>) -> Self {
        Self { a, bar, _phantom }
    }

    fn random() -> Self {
        Self {
            a: todo!(),
            bar: todo!(),
            _phantom: todo!(),
        }
    }
}
```

and is now:
```rust
impl<T> Foo<T> {
  fn new(a: usize) -> Self {
      Self {
          a,
          bar: Bar::Bar {},
          _phantom: std::marker::PhantomData
      }
  }

  fn random() -> Self {
      Self {
          a: todo!(),
          bar: Bar::Bar {},
          _phantom: std::marker::PhantomData,
      }
  }
}
```

I'd be happy about any suggestions.

## TODO
   - [x]  deduplicate `use_trivial_constructor` (unclear how to do as it's used in two separate crates)
   - [x]  write tests

Closes rust-lang#12535
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.

4 participants