Do not trigger redundant_closure for non-function types
fixes#3898
Added a check for the entity being called in the closure body to be a FnDef. This way lint does not trigger for ADTs (Box) but I'm not sure if it's correct and not too restrictive.
<!--
Thank you for making Clippy better!
We're collecting our changelog from pull request descriptions.
If your PR only updates to the latest nightly, you can leave the
`changelog` entry as `none`. Otherwise, please write a short comment
explaining your change.
If your PR fixes an issue, you can add "fixes #issue_number" into this
PR description. This way the issue will be automatically closed when
your PR is merged.
If you added a new lint, here's a checklist for things that will be
checked during review or continuous integration.
- [ ] Followed [lint naming conventions][lint_naming]
- [ ] Added passing UI tests (including committed `.stderr` file)
- [ ] `cargo test` passes locally
- [ ] Executed `util/dev update_lints`
- [ ] Added lint documentation
- [ ] Run `cargo fmt`
Note that you can skip the above if you are just opening a WIP PR in
order to get feedback.
Delete this line and everything above before opening your PR -->
changelog: Fix false positive in `redundant_closure` pertaining to non-function types
Only run AppVeyor on r+, try and the master branch
As it is right now, there is only one worker available in the `rust-lang-libs`
AppVeyor project and there are other repos as well that we share this worker
with. This has been a problem for us because we sometimes hit a bors timeout if there
are too many builds queued up.
To improve the situation, I think we could try to use AppVeyor a bit less
often. The average PR is not going to break windows related things anyway, so
it should be fine to run it on r+/try/master only.
changelog: none
As it is right now, there is only one worker available in the `rust-lang-libs`
AppVeyor project and there are other repos as well that we share this worker
with. This has been a problem for us because we sometimes hit a bors timeout if there
are too many builds queued up.
To improve the situation, I think we could try to use AppVeyor a bit less
often. The average PR is not going to break windows related things anyway, so
it should be fine to run it on r+/try/master only.
Ignore non-const ctor expressions in or_fn_call
Fixes https://github.com/rust-lang/rust-clippy/issues/1338
Should have been fixed by #919, however that focuses on const ctor expressions only, and `.or(Some(local))` isn't const.
This also automatically ignores things like `.or(Some(local.clone())` which we don't actually want to do; I need to figure out what to do here.
changelog: Fixed false positive in [`or_fn_call`] pertaining to enum variant constructors
r? @oli-obk @phansch
compiletest: Disambiguate extern crate deps shared with the compiler
Fixes#4015.
changelog: Handle deps shared with the compiler in the internal compiletest suite
Attempts to fix the multiple matching crates error using the `--extern dep=path` disambiguation. This only includes `serde` at the moment because it's the only problematic dep right now (is inside Rust sysroot and pulled via `extern crate` in the test suite).
I'm not exactly sure this is the right approach (FWIW it fixes the issue locally), please do tell if this should be done differently.
Allow allowing of toplevel_ref_arg lint
I'm not sure why some lints need the `HirId` to be able to recognize the
lint level attributes, but this commit makes the lint level attributes
work for `toplevel_ref_arg`.
Fixes#2332
changelog: Allow allowing of `toplevel_ref_arg` lint
Add run-rustfix for match_as_ref lint
* Extracts `match_as_ref` into separate file
* Adds `// run-rustfix` to `tests/ui/match_as_ref.rs`
cc #3630
changelog: none
Fix false positive in module_name_repetitions lint
This lint was triggering on modules inside expanded attrs, like
for example `#[cfg(test)]` and possibly more.
It was not reporting a location in #3892 because `span.lo()` and `span.hi()` both were 0.
Fixes#3892
changelog: Fix false positive in `module_name_repetitions` lint
I'm not sure why some lints need the `HirId` to be able to recognize the
lint level attributes, but this commit makes the lint level attributes
work for `toplevel_ref_arg`.
Add Lint PathBufPushOverwrite
Closes#3923
This is a very simple Lint that checks if push is being called with a Root Path. Because that can make it overwrite the previous path.
I used std::path::Path to check if it's root, in order to keep it working across windows/linux environments instead of checking for '/'. Is that alright?
On the `if_chain!` block, Is there a way to make it short while getting the value of the first argument? I got the example from other lints.
Note that this is first Lint, I hope I got everything covered 🚀