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

Derive Default instead of new in applicable lint #60259

Merged
merged 2 commits into from
Apr 26, 2019
Merged

Derive Default instead of new in applicable lint #60259

merged 2 commits into from
Apr 26, 2019

Conversation

sd234678
Copy link
Contributor

Closes #60181

As far as I can see, at least within the src/librustc_lint directory this is the only place this is applicable.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @zackmdavis (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 25, 2019
@Centril
Copy link
Contributor

Centril commented Apr 25, 2019

This should also be applicable for EllipsisInclusiveRangePatterns.

@Centril
Copy link
Contributor

Centril commented Apr 25, 2019

r? @Centril

@rust-highfive rust-highfive assigned Centril and unassigned zackmdavis Apr 25, 2019
@sd234678
Copy link
Contributor Author

@Centril I can't see use of a new function anywhere on these - only macro usages. Where should Default be derived for them?

@Centril
Copy link
Contributor

Centril commented Apr 25, 2019

@sd234678

pub struct EllipsisInclusiveRangePatterns {
/// If `Some(_)`, suppress all subsequent pattern
/// warnings for better diagnostics.
node_id: Option<ast::NodeId>,
}
impl_lint_pass!(EllipsisInclusiveRangePatterns => [ELLIPSIS_INCLUSIVE_RANGE_PATTERNS]);
impl EllipsisInclusiveRangePatterns {
pub fn new() -> Self {
Self {
node_id: None,
}
}
}

EllipsisInclusiveRangePatterns: EllipsisInclusiveRangePatterns::new(),

@sd234678
Copy link
Contributor Author

@Centril Thanks, my mistake, I've found myself behind master. I'll rebase then update those too

@Centril
Copy link
Contributor

Centril commented Apr 25, 2019

r=me rollup with green travis.

@Centril
Copy link
Contributor

Centril commented Apr 25, 2019

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Apr 25, 2019

📌 Commit ef37f38 has been approved by Centril

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 25, 2019
Centril added a commit to Centril/rust that referenced this pull request Apr 25, 2019
…, r=Centril

Derive Default instead of new in applicable lint

Closes rust-lang#60181

As far as I can see, at least within the `src/librustc_lint` directory this is the only place this is applicable.
Centril added a commit to Centril/rust that referenced this pull request Apr 25, 2019
…, r=Centril

Derive Default instead of new in applicable lint

Closes rust-lang#60181

As far as I can see, at least within the `src/librustc_lint` directory this is the only place this is applicable.
Centril added a commit to Centril/rust that referenced this pull request Apr 26, 2019
…, r=Centril

Derive Default instead of new in applicable lint

Closes rust-lang#60181

As far as I can see, at least within the `src/librustc_lint` directory this is the only place this is applicable.
bors added a commit that referenced this pull request Apr 26, 2019
Rollup of 12 pull requests

Successful merges:

 - #59734 (Prevent failure in case no space left on device in rustdoc)
 - #59940 (Set cfg(test) when rustdoc is running with --test option)
 - #60134 (Fix index-page generation)
 - #60165 (Add Pin::{into_inner,into_inner_unchecked})
 - #60183 (Chalkify: Add builtin Copy/Clone)
 - #60225 (Introduce hir::ExprKind::Use and employ in for loop desugaring.)
 - #60247 (Implement Debug for Place using Place::iterate)
 - #60259 (Derive Default instead of new in applicable lint)
 - #60267 (Add feature-gate for f16c target feature)
 - #60284 (Do not allow const generics to depend on type parameters)
 - #60285 (Do not ICE when checking types against foreign fn)
 - #60289 (Make `-Z allow-features` work for stdlib features)

Failed merges:

r? @ghost
@bors bors merged commit ef37f38 into rust-lang:master Apr 26, 2019
@sd234678 sd234678 deleted the 60181-derive-default-lints branch April 26, 2019 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lints should be initialized via derived Default wherever possible
5 participants