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 the @ boxes from extra::json #10727

Merged
merged 5 commits into from
Nov 30, 2013
Merged

Remove the @ boxes from extra::json #10727

merged 5 commits into from
Nov 30, 2013

Conversation

erickt
Copy link
Contributor

@erickt erickt commented Nov 29, 2013

This PR does some small modernizations to the json library. First is to remove the @ boxes, second is to rename the constructors to new.

@alexcrichton
Copy link
Member

This is awesome! Last time I tried doing this lifetimes got the best of me and the compiler gave me lots of ICEs, but I'm glad to see that it's all working now.

I think that @pcwalton is actually trying to change new => init in order to prepare for the placement-new change, so would you mind changing the constructors to ::init instead?

@erickt
Copy link
Contributor Author

erickt commented Nov 29, 2013

@alexcrichton: Sure. I updated the PR with init constructors.

let s = @mut MemWriter::new();
self.to_pretty_writer(s as @mut io::Writer);
let mut s = MemWriter::new();
self.to_pretty_writer(&mut s as &mut io::Writer);
str::from_utf8(s.inner_ref().as_slice())
Copy link
Member

Choose a reason for hiding this comment

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

Could you convert this to str::from_utf8_owned(s.inner()) to save a copy? (Similarly for all the other places (librustdoc, etc.) that use (@mut MemWriter).inner_ref(); including the ToStr for Json instance in this file, which you appear to have not removed @mut from?)

bors added a commit that referenced this pull request Nov 30, 2013
This PR does some small modernizations to the json library. First is to remove the `@` boxes, second is to rename the constructors to `new`.
@bors bors closed this Nov 30, 2013
@bors bors merged commit a7b311a into rust-lang:master Nov 30, 2013
flip1995 pushed a commit to flip1995/rust that referenced this pull request May 20, 2023
…shearth

Extend `trait_duplication_in_bounds` to cover trait objects

This PR extends `trait_duplication_in_bounds` to cover trait objects.

Currently,
```rs
fn foo(_a: &(dyn Any + Send + Send)) {}
```

generates no warnings. With this PR, it will complain about a duplicate trait and can remove it

Moved from rust-lang#110991

changelog: [`trait_duplication_in_bounds`]: warn on duplicate trait object constraints
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