]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #6033 - flip1995:rustup, r=flip1995
bors [Sun, 13 Sep 2020 06:01:21 +0000 (06:01 +0000)]
Auto merge of #6033 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Sat, 12 Sep 2020 13:58:41 +0000 (15:58 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoAuto merge of #75800 - Aaron1011:feature/full-nt-tokens, r=petrochenkov
bors [Fri, 11 Sep 2020 02:35:01 +0000 (02:35 +0000)]
Auto merge of #75800 - Aaron1011:feature/full-nt-tokens, r=petrochenkov

Attach tokens to all AST types used in `Nonterminal`

We perform token capturing when we have outer attributes (for nonterminals that support attributes - e.g. `Stmt`), or when we parse a `Nonterminal` for a `macro_rules!` argument. The full list of `Nonterminals` affected by this PR is:

* `NtBlock`
* `NtStmt`
* `NtTy`
* `NtMeta`
* `NtPath`
* `NtVis`
* `NtLiteral`

Of these nonterminals, only `NtStmt` and `NtLiteral` (which is actually just an `Expr`), support outer attributes - the rest only ever have token capturing perform when they match a `macro_rules!` argument.

This makes progress towards solving https://github.com/rust-lang/rust/issues/43081 - we now collect tokens for everything that might need them. However, we still need to handle `#[cfg]`, inner attributes, and misc pretty-printing issues (e.g. #75734)

I've separated the changes into (mostly) independent commits, which could be split into individual PRs for each `Nonterminal` variant. The purpose of having them all in one PR is to do a single Crater run for all of them.

Most of the changes in this PR are trivial (adding `tokens: None` everywhere we construct the various AST structs). The significant changes are:

* `ast::Visibility` is changed from `type Visibility = Spanned<VisibilityKind>` to a `struct Visibility { kind, span, tokens }`.
* `maybe_collect_tokens` is made generic, and used for both `ast::Expr` and `ast::Stmt`.
* Some of the statement-parsing functions are refactored so that we can capture the trailing semicolon.
* `Nonterminal` and `Expr` both grew by 8 bytes, as some of the structs which are stored inline (rather than behind a `P`) now have an `Option<TokenStream>` field. Hopefully the performance impact of doing this is negligible.

3 years agoFully integrate token collection for additional AST structs
Aaron Hill [Sat, 22 Aug 2020 02:11:41 +0000 (22:11 -0400)]
Fully integrate token collection for additional AST structs

This commit contains miscellaneous changes that don't fit into any of
the other commits in this PR

3 years agoAuto merge of #5977 - xvschneider:AddLintPanicInResult, r=matthiaskrgr
bors [Thu, 10 Sep 2020 16:22:20 +0000 (16:22 +0000)]
Auto merge of #5977 - xvschneider:AddLintPanicInResult, r=matthiaskrgr

Add lint panic in result

### Change
Adding a new "restriction" lint that will emit a warning when using "panic", "unimplemented" or "unreachable" in a function of type option/result.

### Motivation
Some codebases must avoid crashes at all costs, and hence functions of type option/result must return an error instead of crashing.

### Test plan
Running:
TESTNAME=panic_in_result cargo uitest ---

changelog: none

3 years agoMerge commit '5034d47f721ff4c3a3ff2aca9ef2ef3e1d067f9f' into clippyup
flip1995 [Thu, 10 Sep 2020 15:47:07 +0000 (17:47 +0200)]
Merge commit '5034d47f721ff4c3a3ff2aca9ef2ef3e1d067f9f' into clippyup

3 years agoAuto merge of #6028 - giraffate:fix_typo, r=flip1995
bors [Thu, 10 Sep 2020 15:41:29 +0000 (15:41 +0000)]
Auto merge of #6028 - giraffate:fix_typo, r=flip1995

Fix typo

changelog: none

3 years agoAuto merge of #6019 - rail-rain:improve_known_probs_mut_key, r=flip1995
bors [Thu, 10 Sep 2020 15:17:09 +0000 (15:17 +0000)]
Auto merge of #6019 - rail-rain:improve_known_probs_mut_key, r=flip1995

Improve the "known problems" section of `interior_mutable_key`

* Remove the mention to `Rc` and `Arc` as these are `Freeze` (despite my intuition) so the lint correctly handles already.
* Instead, explain what could cause a false positive, and mention `bytes` as an example.

---

changelog: Improved the "known problems" section of `interior_mutable_key`

3 years agoFix spelling of "Known problems section" of `interior_mutable_key`
Philipp Krones [Thu, 10 Sep 2020 15:08:10 +0000 (17:08 +0200)]
Fix spelling of "Known problems section" of `interior_mutable_key`

3 years agoAuto merge of #6020 - matthiaskrgr:ra_dev_setup_update, r=flip1995
bors [Thu, 10 Sep 2020 14:55:17 +0000 (14:55 +0000)]
Auto merge of #6020 - matthiaskrgr:ra_dev_setup_update, r=flip1995

update cargo dev ra-setup to changed rustc source paths

changelog: none

3 years agoAuto merge of #5980 - matsujika:create-dir, r=flip1995
bors [Thu, 10 Sep 2020 14:34:22 +0000 (14:34 +0000)]
Auto merge of #5980 - matsujika:create-dir, r=flip1995

Add a lint to prevent `create_dir` from being used

This closes #5950
changelog: none

3 years agoAuto merge of #5931 - montrivo:unit-arg, r=flip1995
bors [Thu, 10 Sep 2020 14:11:27 +0000 (14:11 +0000)]
Auto merge of #5931 - montrivo:unit-arg, r=flip1995

improve the suggestion of the lint `unit-arg`

Fixes #5823
Fixes #6015

Changes
```
help: move the expression in front of the call...
  |
3 |     g();
  |
help: ...and use a unit literal instead
  |
3 |     o.map_or((), |i| f(i))
  |
```
into
```
help: move the expression in front of the call and replace it with the unit literal `()`
  |
3 |     g();
  |     o.map_or((), |i| f(i))
  |
```
changelog: improve the suggestion of the lint `unit-arg`

3 years agoAuto merge of #6023 - matthiaskrgr:box, r=flip1995
bors [Thu, 10 Sep 2020 13:49:50 +0000 (13:49 +0000)]
Auto merge of #6023 - matthiaskrgr:box, r=flip1995

link to the Box docs in related lint documentation.

changelog: link to the box docs in lint docs

3 years agoFix typo
Takayuki Nakata [Thu, 10 Sep 2020 13:39:08 +0000 (22:39 +0900)]
Fix typo

3 years agoAuto merge of #6027 - flip1995:rustup, r=flip1995
bors [Thu, 10 Sep 2020 13:25:39 +0000 (13:25 +0000)]
Auto merge of #6027 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

3 years agoCleanup of rustup
flip1995 [Thu, 10 Sep 2020 12:18:05 +0000 (14:18 +0200)]
Cleanup of rustup

3 years agoAuto merge of #6024 - matthiaskrgr:unit_type, r=phansch
bors [Thu, 10 Sep 2020 07:49:07 +0000 (07:49 +0000)]
Auto merge of #6024 - matthiaskrgr:unit_type, r=phansch

print the unit type `()` in related lint messages.

changelog: print the unit type `()` in related lint messages

3 years agoAuto merge of #75573 - Aaron1011:feature/const-mutation-lint, r=oli-obk
bors [Thu, 10 Sep 2020 05:54:26 +0000 (05:54 +0000)]
Auto merge of #75573 - Aaron1011:feature/const-mutation-lint, r=oli-obk

Add CONST_ITEM_MUTATION lint

Fixes #74053
Fixes #55721

This PR adds a new lint `CONST_ITEM_MUTATION`.
Given an item `const FOO: SomeType = ..`, this lint fires on:

* Attempting to write directly to a field (`FOO.field = some_val`) or
  array entry (`FOO.array_field[0] = val`)
* Taking a mutable reference to the `const` item (`&mut FOO`), including
  through an autoderef `FOO.some_mut_self_method()`

The lint message explains that since each use of a constant creates a
new temporary, the original `const` item will not be modified.

3 years agocargo dev update-lints
Vali Schneider [Wed, 9 Sep 2020 21:06:11 +0000 (14:06 -0700)]
cargo dev update-lints

3 years agoremoving if chain and renaming lint
Vali Schneider [Wed, 9 Sep 2020 21:02:34 +0000 (14:02 -0700)]
removing if chain and renaming lint

3 years agoprint the unit type `()` in related lint messages.
Matthias Krüger [Wed, 9 Sep 2020 15:59:13 +0000 (17:59 +0200)]
print the unit type `()` in related lint messages.

3 years agolink to the Box docs in related lint documentation.
Matthias Krüger [Wed, 9 Sep 2020 14:53:45 +0000 (16:53 +0200)]
link to the Box docs in related lint documentation.

3 years agoupdate cargo dev ra-setup to changed rustc source paths
Matthias Krüger [Wed, 9 Sep 2020 09:57:30 +0000 (11:57 +0200)]
update cargo dev ra-setup to changed rustc source paths

3 years agoImprove "known problems" of `interior_mutable_key`
rail [Wed, 9 Sep 2020 02:18:19 +0000 (14:18 +1200)]
Improve "known problems" of `interior_mutable_key`

* Remove the mention to `Rc` and `Arc` as these are `Freeze`
  so the lint correctly handles already.

* Instead, explain what could cause a false positive,
  and mention `bytes` as an example.

3 years agoAdjust Clippy for CONST_ITEM_MUTATION lint
Aaron Hill [Tue, 8 Sep 2020 21:59:43 +0000 (17:59 -0400)]
Adjust Clippy for CONST_ITEM_MUTATION lint

We no longer lint assignments to const item fields in the
`temporary_assignment` lint, since this is now covered by the
`CONST_ITEM_MUTATION` lint.

Additionally, we `#![allow(const_item_mutation)]` in the
`borrow_interior_mutable_const.rs` test. Clippy UI tests are run with
`-D warnings`, which seems to cause builtin lints to prevent Clippy
lints from running.

3 years agoAuto merge of #6016 - giraffate:restrict_same_item_push, r=ebroto
bors [Tue, 8 Sep 2020 21:34:55 +0000 (21:34 +0000)]
Auto merge of #6016 - giraffate:restrict_same_item_push, r=ebroto

Restrict `same_item_push` to suppress false positives

It only emits a lint when the pushed item is a literal, a constant and an immutable binding that are initialized with those, as discussed in https://github.com/rust-lang/rust-clippy/pull/5997#pullrequestreview-483005186.

Fix https://github.com/rust-lang/rust-clippy/issues/5985

changelog: Restrict `same_item_push` to literals, constants and immutable bindings that are initialized with those.

r? `@ebroto`

3 years agoAuto merge of #6018 - ebroto:rustup, r=ebroto
bors [Tue, 8 Sep 2020 20:43:02 +0000 (20:43 +0000)]
Auto merge of #6018 - ebroto:rustup, r=ebroto

Rustup

r? `@ghost`

changelog: none

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
Eduardo Broto [Tue, 8 Sep 2020 20:26:31 +0000 (22:26 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoChange suggestion to `create_dir_all({})` from `std::fs::create_dir_all({})`
Hirochika Matsumoto [Tue, 8 Sep 2020 14:35:19 +0000 (23:35 +0900)]
Change suggestion to `create_dir_all({})` from `std::fs::create_dir_all({})`

3 years agoAddress `items_after_statement`
Takayuki Nakata [Tue, 8 Sep 2020 14:12:04 +0000 (23:12 +0900)]
Address `items_after_statement`

3 years agoRefactoring: tests in `same_item_push`
Takayuki Nakata [Tue, 8 Sep 2020 14:03:15 +0000 (23:03 +0900)]
Refactoring: tests in `same_item_push`

3 years agoAdd some tests to `same_item_push`
Takayuki Nakata [Tue, 8 Sep 2020 13:45:27 +0000 (22:45 +0900)]
Add some tests to `same_item_push`

Add tests in which the variable is initialized with a match expression and function call

3 years agoSome refactoring
Takayuki Nakata [Mon, 7 Sep 2020 23:34:51 +0000 (08:34 +0900)]
Some refactoring

3 years agoRefactoring: use inner function
Takayuki Nakata [Mon, 7 Sep 2020 23:25:31 +0000 (08:25 +0900)]
Refactoring: use inner function

3 years agoAuto merge of #76044 - ecstatic-morse:dataflow-lattice, r=oli-obk
bors [Mon, 7 Sep 2020 21:29:43 +0000 (21:29 +0000)]
Auto merge of #76044 - ecstatic-morse:dataflow-lattice, r=oli-obk

Support dataflow problems on arbitrary lattices

This PR implements last of the proposed extensions I mentioned in the design meeting for the original dataflow refactor. It extends the current dataflow framework to work with arbitrary lattices, not just `BitSet`s. This is a prerequisite for dataflow-enabled MIR const-propagation. Personally, I am skeptical of the usefulness of doing const-propagation pre-monomorphization, since many useful constants only become known after monomorphization (e.g. `size_of::<T>()`) and users have a natural tendency to hand-optimize the rest. It's probably worth exprimenting with, however, and others have shown interest cc `@rust-lang/wg-mir-opt.`

The `Idx` associated type is moved from `AnalysisDomain` to `GenKillAnalysis` and replaced with an associated `Domain` type that must implement `JoinSemiLattice`. Like before, each `Analysis` defines the "bottom value" for its domain, but can no longer override the dataflow join operator. Analyses that want to use set intersection must now use the `lattice::Dual` newtype. `GenKillAnalysis` impls have an additional requirement that `Self::Domain: BorrowMut<BitSet<Self::Idx>>`, which effectively means that they must use `BitSet<Self::Idx>` or `lattice::Dual<BitSet<Self::Idx>>` as their domain.

Most of these changes were mechanical. However, because a `Domain` is no longer always a powerset of some index type, we can no longer use an `IndexVec<BasicBlock, GenKillSet<A::Idx>>>` to store cached block transfer functions. Instead, we use a boxed `dyn Fn` trait object. I discuss a few alternatives to the current approach in a commit message.

The majority of new lines of code are to preserve existing Graphviz diagrams for those unlucky enough to have to debug dataflow analyses. I find these diagrams incredibly useful when things are going wrong and considered regressing them unacceptable, especially the pretty-printing of `MovePathIndex`s, which are used in many dataflow analyses. This required a parallel `fmt` trait used only for printing dataflow domains, as well as a refactoring of the `graphviz` module now that we cannot expect the domain to be a `BitSet`. Some features did have to be removed, such as the gen/kill display mode (which I didn't use but existed to mirror the output of the old dataflow framework) and line wrapping. Since I had to rewrite much of it anyway, I took the opportunity to switch to a `Visitor` for printing dataflow state diffs instead of using cursors, which are error prone for code that must be generic over both forward and backward analyses. As a side-effect of this change, we no longer have quadratic behavior when writing graphviz diagrams for backward dataflow analyses.

r? `@pnkfelix`

3 years agoRestrict `same_item_push` to suppress false positives
Takayuki Nakata [Mon, 7 Sep 2020 13:17:31 +0000 (22:17 +0900)]
Restrict `same_item_push` to suppress false positives

It emits a lint when the pushed item is a literal, a constant and an immutable binding that are initialized with those.

3 years agoAuto merge of #6006 - ebroto:6001_unnecessary_sort_by, r=Manishearth
bors [Sun, 6 Sep 2020 22:37:46 +0000 (22:37 +0000)]
Auto merge of #6006 - ebroto:6001_unnecessary_sort_by, r=Manishearth

Restrict unnecessary_sort_by to non-reference, Copy types

`Vec::sort_by_key` closure parameter is `F: FnMut(&T) -> K`. The lint's suggestion destructures the `T` parameter; this was probably done to avoid different unnamed lifetimes when `K = Reverse<&T>`.

This change fixes two issues:
* Destructuring T when T is non-reference requires the type to be Copy, otherwise we would try to move from a shared reference. We make sure `T: Copy` holds.
* Make sure `T` is actually non-reference. I didn't go for destructuring multiple levels of references, as we would have to compensate in the closure body by removing derefs and maybe adding parens, which would add more complexity.

changelog: Restrict [`unnecessary_sort_by`] to non-reference, Copy types

Fixes #6001

3 years agoRestrict unnecessary_sort_by to non-ref copy types
Eduardo Broto [Fri, 4 Sep 2020 09:56:54 +0000 (11:56 +0200)]
Restrict unnecessary_sort_by to non-ref copy types

3 years agoAuto merge of #5997 - giraffate:fix_fp_about_clone_in_same_item_push, r=ebroto
bors [Sat, 5 Sep 2020 20:27:17 +0000 (20:27 +0000)]
Auto merge of #5997 - giraffate:fix_fp_about_clone_in_same_item_push, r=ebroto

Fix FP in `same_item_push`

Don't emit a lint when the pushed item doesn't have Clone trait

Fix #5979

changelog: Fix FP in `same_item_push` not to emit a lint when the pushed item doesn't have Clone trait

3 years agoFix FP when coercion kicks in
Takayuki Nakata [Sat, 5 Sep 2020 15:02:35 +0000 (00:02 +0900)]
Fix FP when coercion kicks in

3 years agoAuto merge of #6009 - Ryan1729:show-line_count-and-max_lines-in-too_many_lines-lint...
bors [Sat, 5 Sep 2020 06:05:29 +0000 (06:05 +0000)]
Auto merge of #6009 - Ryan1729:show-line_count-and-max_lines-in-too_many_lines-lint-message, r=phansch

Show line count and max lines in too_many_lines lint message

This PR adds the current amount of lines and the current maximum number of lines in the message for the `too_many_lines` lint, in a similar way as the `too_many_arguments` lint currently does.

changelog: show the line count and the maximum lines in the message for the `too_many_lines` lint.

3 years agorun the specific script suggested by the error message
Ryan1729 [Sat, 5 Sep 2020 03:12:16 +0000 (21:12 -0600)]
run the specific script suggested by the error message

```
./tests/ui-toml/update-references.sh './target/debug/test_build_base' 'functions_maxlines/test.rs'
```

3 years agorun tests/ui/update-all-references.sh
Ryan1729 [Sat, 5 Sep 2020 02:16:02 +0000 (20:16 -0600)]
run tests/ui/update-all-references.sh

3 years agoadd line_count and max_lines to too_many_lines lint message
Ryan1729 [Sat, 5 Sep 2020 01:26:35 +0000 (19:26 -0600)]
add line_count and max_lines to too_many_lines lint message

3 years agoAuto merge of #6007 - ebroto:sync-from-rust, r=ebroto
bors [Fri, 4 Sep 2020 22:19:01 +0000 (22:19 +0000)]
Auto merge of #6007 - ebroto:sync-from-rust, r=ebroto

Rustup

r? @ghost

changelog: none

3 years agoRun cargo dev fmt
Eduardo Broto [Fri, 4 Sep 2020 21:30:55 +0000 (23:30 +0200)]
Run cargo dev fmt

3 years agoFix fallout from rustup
Eduardo Broto [Fri, 4 Sep 2020 21:30:06 +0000 (23:30 +0200)]
Fix fallout from rustup

3 years agoMerge remote-tracking branch 'upstream/master' into sync-from-rust
Eduardo Broto [Fri, 4 Sep 2020 21:27:01 +0000 (23:27 +0200)]
Merge remote-tracking branch 'upstream/master' into sync-from-rust

3 years agoty.flags -> ty.flags()
LeSeulArtichaut [Thu, 6 Aug 2020 15:49:46 +0000 (17:49 +0200)]
ty.flags -> ty.flags()

3 years ago`ty.kind` -> `ty.kind()` in rustdoc and clippy
LeSeulArtichaut [Mon, 3 Aug 2020 22:18:29 +0000 (00:18 +0200)]
`ty.kind` -> `ty.kind()` in rustdoc and clippy

3 years agoAuto merge of #6004 - mikerite:default-trait-access-20200904, r=ebroto
bors [Fri, 4 Sep 2020 06:31:04 +0000 (06:31 +0000)]
Auto merge of #6004 - mikerite:default-trait-access-20200904, r=ebroto

Simplify `clippy::default_trait_access`

Remove repeated matching on the same QPath.

changelog: none

3 years agoSimplify `clippy::default_trait_access`
Michael Wright [Fri, 4 Sep 2020 03:15:31 +0000 (05:15 +0200)]
Simplify `clippy::default_trait_access`

Remove repeated matching on the same QPath.

3 years agoAuto merge of #5994 - taiki-e:useless_attribute, r=phansch
bors [Thu, 3 Sep 2020 05:33:03 +0000 (05:33 +0000)]
Auto merge of #5994 - taiki-e:useless_attribute, r=phansch

useless_attribute: Permit wildcard_imports and enum_glob_use

Fixes #5918

changelog: `useless_attribute`: Permit `wildcard_imports` and `enum_glob_use` on `use` items

3 years agoAuto merge of #6003 - mikerite:fix-tests-20200903, r=phansch
bors [Thu, 3 Sep 2020 05:12:26 +0000 (05:12 +0000)]
Auto merge of #6003 - mikerite:fix-tests-20200903, r=phansch

Update ui stderr with improved rustc output

Related rust pull request: rust-lang/rust#76160

changelog: none

3 years agoUpdate ui stderr with improved rustc output
Michael Wright [Thu, 3 Sep 2020 02:58:14 +0000 (04:58 +0200)]
Update ui stderr with improved rustc output

Related rust pull request: rust-lang/rust#76160

3 years agounit-arg - pr remarks
Tim Nielens [Wed, 2 Sep 2020 21:30:40 +0000 (23:30 +0200)]
unit-arg - pr remarks

3 years agoAuto merge of #76160 - scileo:format-recovery, r=petrochenkov
bors [Wed, 2 Sep 2020 19:29:27 +0000 (19:29 +0000)]
Auto merge of #76160 - scileo:format-recovery, r=petrochenkov

Improve recovery on malformed format call

The token following a format expression should be a comma. However, when it is replaced with a similar token (such as a dot), then the corresponding error is emitted, but the token is treated as a comma, and the parsing step continues.

r? @petrochenkov

3 years agoMerge branch 'master' into unit-arg
Tim Nielens [Wed, 2 Sep 2020 17:39:54 +0000 (19:39 +0200)]
Merge branch 'master' into unit-arg

3 years agoAuto merge of #5996 - Koxiaet:master, r=ebroto
bors [Wed, 2 Sep 2020 12:24:31 +0000 (12:24 +0000)]
Auto merge of #5996 - Koxiaet:master, r=ebroto

Allow GraphQL in docs without backticks

changelog: Allow "GraphQL" in [`doc_markdown`] without backticks.

3 years agoAdd tests for allowed non-backticked identifiers in doc
Koxiaet [Wed, 2 Sep 2020 11:51:44 +0000 (12:51 +0100)]
Add tests for allowed non-backticked identifiers in doc

3 years agoImprove recovery on malformed format call
Sasha [Mon, 31 Aug 2020 09:45:50 +0000 (11:45 +0200)]
Improve recovery on malformed format call

If a comma in a format call is replaced with a similar token, then we
emit an error and continue parsing, instead of stopping at this point.

3 years agoAuto merge of #6000 - ebroto:sync-from-rust, r=ebroto
bors [Wed, 2 Sep 2020 07:56:44 +0000 (07:56 +0000)]
Auto merge of #6000 - ebroto:sync-from-rust, r=ebroto

Sync from rust

r? @ghost

changelog: none

3 years agoRun cargo dev fmt
Eduardo Broto [Wed, 2 Sep 2020 06:57:00 +0000 (08:57 +0200)]
Run cargo dev fmt

3 years agoMerge remote-tracking branch 'upstream/master' into sync-from-rust
Eduardo Broto [Wed, 2 Sep 2020 06:53:29 +0000 (08:53 +0200)]
Merge remote-tracking branch 'upstream/master' into sync-from-rust

3 years agoAuto merge of #5999 - rail-rain:fix_fp_transmute_ptr_to_ptr_in_consts, r=ebroto
bors [Tue, 1 Sep 2020 22:28:55 +0000 (22:28 +0000)]
Auto merge of #5999 - rail-rain:fix_fp_transmute_ptr_to_ptr_in_consts, r=ebroto

Fix a fp in `transmute_ptr_to_ptr`

fixes #5959

changelog: Fix a false positive in `transmute_ptr_to_ptr` that the lint fires when `transmute` is used to cast a reference in const contexts although dereferencing raw pointers in consts is unstable.

3 years agoAuto merge of #5993 - taiki-e:default_trait_access, r=phansch
bors [Tue, 1 Sep 2020 15:05:16 +0000 (15:05 +0000)]
Auto merge of #5993 - taiki-e:default_trait_access, r=phansch

default_trait_access: Fix wrong suggestion

https://github.com/rust-lang/rust-clippy/issues/5975#issuecomment-683751131
> I think the underlying problem is clippy suggests code with complete parameters, not clippy triggers this lint even for complex types. AFAIK, If code compiles with `Default::default`, it doesn't need to specify any parameters, as type inference is working. (So, in this case, `default_trait_access` should suggest `RefCell::default`.)

Fixes #5975 Fixes #5990

changelog: `default_trait_access`: fixed wrong suggestion

3 years agoFix FP in `same_item_push`
Takayuki Nakata [Tue, 1 Sep 2020 13:39:09 +0000 (22:39 +0900)]
Fix FP in `same_item_push`

Don't emit a lint when the pushed item doesn't have Clone trait

3 years agoAllow GraphQL in doc without backticks
Koxiaet [Tue, 1 Sep 2020 13:05:19 +0000 (14:05 +0100)]
Allow GraphQL in doc without backticks

3 years agouseless_attribute: Permit wildcard_imports and enum_glob_use
Taiki Endo [Tue, 1 Sep 2020 03:09:32 +0000 (12:09 +0900)]
useless_attribute: Permit wildcard_imports and enum_glob_use

3 years agoFix a fp in `transmute_ptr_to_ptr`
rail [Mon, 31 Aug 2020 23:21:48 +0000 (11:21 +1200)]
Fix a fp in `transmute_ptr_to_ptr`

Avoid firing the lint when `transmute` in const contexts
as dereferencing raw pointers in consts is unstable. cc #5959

3 years agofixed bug
Vali Schneider [Mon, 31 Aug 2020 20:32:05 +0000 (13:32 -0700)]
fixed bug

3 years agoAuto merge of #5992 - giraffate:fix_wrong_seggestion_in_collapsible_if, r=yaahc
bors [Mon, 31 Aug 2020 19:41:13 +0000 (19:41 +0000)]
Auto merge of #5992 - giraffate:fix_wrong_seggestion_in_collapsible_if, r=yaahc

Fix the wrong suggestion when using macro in `collapsible_if`

Fix #5962

changelog: Fix the wrong suggestion when using macro in `collapsible_if`

3 years agoAuto merge of #5909 - khuey:async_yields_async, r=yaahc
bors [Mon, 31 Aug 2020 19:20:30 +0000 (19:20 +0000)]
Auto merge of #5909 - khuey:async_yields_async, r=yaahc

Add a lint for an async block/closure that yields a type that is itself awaitable.

This catches bugs of the form

tokio::spawn(async move {
    let f = some_async_thing();
    f // Oh no I forgot to await f so that work will never complete.
});

See the two XXXkhuey comments and the unfixed `_l` structure for things that need more thought.

*Please keep the line below*
changelog: none

3 years agodefault_trait_access: Fix wrong suggestion
Taiki Endo [Mon, 31 Aug 2020 15:31:53 +0000 (00:31 +0900)]
default_trait_access: Fix wrong suggestion

3 years agoFix the wrong suggestion when using macro in `collapsible_if`
Takayuki Nakata [Mon, 31 Aug 2020 15:05:53 +0000 (00:05 +0900)]
Fix the wrong suggestion when using macro in `collapsible_if`

3 years agoUse `match_def_path` instead of `match_qpath`
Hirochika Matsumoto [Mon, 31 Aug 2020 13:40:47 +0000 (22:40 +0900)]
Use `match_def_path` instead of `match_qpath`

3 years agoAuto merge of #5984 - ebroto:5693_const_assoc_fn, r=flip1995
bors [Mon, 31 Aug 2020 10:43:58 +0000 (10:43 +0000)]
Auto merge of #5984 - ebroto:5693_const_assoc_fn, r=flip1995

or_fn_call: ignore nullary associated const fns

The fix in #5889 was missing associated functions.

changelog: Ignore also `const fn` methods in [`or_fun_call`]

Fixes #5693

3 years agoFix clippy
Aaron Hill [Sun, 30 Aug 2020 23:17:17 +0000 (19:17 -0400)]
Fix clippy

3 years agoAuto merge of #5988 - camelid:patch-2, r=ebroto
bors [Sun, 30 Aug 2020 20:21:00 +0000 (20:21 +0000)]
Auto merge of #5988 - camelid:patch-2, r=ebroto

Syntax-highlight `single_char_push_str` lint

It wasn't being syntax highlighted in the online lint index:

![image](https://user-images.githubusercontent.com/37223377/91666682-8fc02000-eab3-11ea-95fa-6671472712c8.png)

changelog: none

3 years agoSyntax-highlight `single_char_push_str` lint
Camelid [Sun, 30 Aug 2020 18:24:15 +0000 (11:24 -0700)]
Syntax-highlight `single_char_push_str` lint

3 years agoUpdate dataflow analyses to use new interface
Dylan MacKenzie [Fri, 28 Aug 2020 20:26:25 +0000 (13:26 -0700)]
Update dataflow analyses to use new interface

3 years agouncommented fn
Vali Schneider [Sat, 29 Aug 2020 23:22:15 +0000 (16:22 -0700)]
uncommented fn

3 years agochanged check_impl_item to check_fn and added a few more test cases
Vali Schneider [Sat, 29 Aug 2020 23:17:53 +0000 (16:17 -0700)]
changed check_impl_item to check_fn and added a few more test cases

3 years agoFormatting changes requested by ThibsG.
Kyle Huey [Sun, 23 Aug 2020 04:40:01 +0000 (21:40 -0700)]
Formatting changes requested by ThibsG.

3 years agoAdd a test for an async function.
Kyle Huey [Sun, 23 Aug 2020 04:36:39 +0000 (21:36 -0700)]
Add a test for an async function.

3 years agoAdd a lint for an async block/closure that yields a type that is itself awaitable.
Kyle Huey [Sat, 15 Aug 2020 00:30:48 +0000 (17:30 -0700)]
Add a lint for an async block/closure that yields a type that is itself awaitable.

This catches bugs of the form

tokio::spawn(async move {
    let f = some_async_thing();
    f // Oh no I forgot to await f so that work will never complete.
});

3 years agoDowngrade applicability of `create_dir`
Hirochika Matsumoto [Sat, 29 Aug 2020 05:20:01 +0000 (14:20 +0900)]
Downgrade applicability of `create_dir`

3 years agoor_fn_call: ignore nullary associated const fns
Eduardo Broto [Fri, 28 Aug 2020 23:18:42 +0000 (01:18 +0200)]
or_fn_call: ignore nullary associated const fns

3 years agoMerge commit '3d0b0e66afdfaa519d8855b338b35b4605775945' into clippyup
flip1995 [Fri, 28 Aug 2020 14:10:16 +0000 (16:10 +0200)]
Merge commit '3d0b0e66afdfaa519d8855b338b35b4605775945' into clippyup

3 years agoAuto merge of #5970 - ebroto:changelog_beta_1_47, r=flip1995
bors [Fri, 28 Aug 2020 13:08:29 +0000 (13:08 +0000)]
Auto merge of #5970 - ebroto:changelog_beta_1_47, r=flip1995

Update changelog to beta 1.47

[Rendered](https://github.com/ebroto/rust-clippy/blob/changelog_beta_1_47/CHANGELOG.md)

changelog: none

3 years agoAuto merge of #5774 - ThibsG:FixNewRetNoSelf, r=ebroto
bors [Fri, 28 Aug 2020 11:54:07 +0000 (11:54 +0000)]
Auto merge of #5774 - ThibsG:FixNewRetNoSelf, r=ebroto

Fix FP in `new_ret_no_self`: trigger in trait def instead of impl block

Lint in trait def instead of impl block.

Fixes: #5435
changelog: none

3 years agoFix errors
Hirochika Matsumoto [Fri, 28 Aug 2020 10:56:03 +0000 (19:56 +0900)]
Fix errors

3 years agoFix clippy error
Hirochika Matsumoto [Fri, 28 Aug 2020 10:35:04 +0000 (19:35 +0900)]
Fix clippy error

3 years agoAdd STD_FS_CREATE_DIR into paths
Hirochika Matsumoto [Fri, 28 Aug 2020 09:53:15 +0000 (18:53 +0900)]
Add STD_FS_CREATE_DIR into paths

3 years agoAdd a new lint to prevent `create_dir` from being used
Hirochika Matsumoto [Fri, 28 Aug 2020 09:40:22 +0000 (18:40 +0900)]
Add a new lint to prevent `create_dir` from being used

3 years agoUpdate clippy_lints/src/methods/mod.rs
Thibaud [Fri, 28 Aug 2020 07:33:05 +0000 (09:33 +0200)]
Update clippy_lints/src/methods/mod.rs

Co-authored-by: Eduardo Broto <ebroto@tutanota.com>
3 years agoUpdate clippy_lints/src/utils/mod.rs
Thibaud [Fri, 28 Aug 2020 07:31:29 +0000 (09:31 +0200)]
Update clippy_lints/src/utils/mod.rs

Co-authored-by: Eduardo Broto <ebroto@tutanota.com>
3 years agoUpdate clippy_lints/src/utils/mod.rs
Thibaud [Fri, 28 Aug 2020 07:31:12 +0000 (09:31 +0200)]
Update clippy_lints/src/utils/mod.rs

Co-authored-by: Eduardo Broto <ebroto@tutanota.com>
3 years agoadded lint for todo and removed option
Vali Schneider [Thu, 27 Aug 2020 23:55:23 +0000 (16:55 -0700)]
added lint for todo and removed option

3 years agoran cargo dev update lints
Vali Schneider [Thu, 27 Aug 2020 23:30:49 +0000 (16:30 -0700)]
ran cargo dev update lints