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

lint: add lint for use of a ~[T]. #12861

Merged
merged 2 commits into from
Mar 14, 2014
Merged

Conversation

huonw
Copy link
Member

@huonw huonw commented Mar 13, 2014

lint: add lint for use of a ~[T].

This is useless at the moment (since pretty much every crate uses
~[]), but should help avoid regressions once completely removed from a
crate.

@huonw
Copy link
Member Author

huonw commented Mar 13, 2014

r? @pcwalton

I don't know how far you are along with your de-vecing. This is probably pointless if it's going to being landing very soon.

@@ -1107,6 +1116,17 @@ fn check_unused_result(cx: &Context, s: &ast::Stmt) {
}
}

fn check_deprecated_owned_vector(cx: &Context, e: &ast::Expr) {
let t = ty::expr_ty(cx.tcx, e);
Copy link
Contributor

Choose a reason for hiding this comment

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

Couldn't this be expressed with just:

match e.node {
    ast::ExprVstore(_, ast::ExprVstoreUniq) => {...}
    _ => {}
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Matching on the AST itself doesn't handle using functions like with_capacity, from_elem or .collect(). This actually checks the type of such expressions.

(See the test case... which I just added ;P )

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah right, that makes sense! Thanks 👍

@huonw
Copy link
Member Author

huonw commented Mar 13, 2014

Just added a commit that makes the Vec docs appear online, because the lint is recommending people use std::vec_ng::Vec and so it's useful if there's at least a page for it.

(It is a really good candidate for the doc sprint: most of the docs can be written by copying over from std::vec, and updating/adding examples.)

huonw added 2 commits March 14, 2014 11:28
This is useless at the moment (since pretty much every crate uses
`~[]`), but should help avoid regressions once completely removed from a
crate.
These are wildly incomplete, but having something there is better than
nothing, e.g. so that people know it exists, and many of the functions
behaviour can be guessed from the name or by checking the source: it's
knowing they exist at all that's the hard part.
bors added a commit that referenced this pull request Mar 14, 2014
lint: add lint for use of a `~[T]`.

This is useless at the moment (since pretty much every crate uses
`~[]`), but should help avoid regressions once completely removed from a
crate.
@bors bors closed this Mar 14, 2014
@bors bors merged commit adc357a into rust-lang:master Mar 14, 2014
Kroisse added a commit to Kroisse/rust-mustache that referenced this pull request Mar 17, 2014
@huonw huonw deleted the lint-owned-vecs branch December 4, 2014 02:03
fasterthanlime pushed a commit to fasterthanlime/rust that referenced this pull request Jul 26, 2022
…, r=DorianListens

fix: Autocomplete for struct fields includes receiver

fixes rust-lang#12857
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