]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agobuild: use release build of RTIM
Lzu Tao [Fri, 18 Oct 2019 07:58:26 +0000 (14:58 +0700)]
build: use release build of RTIM

rustup-toolchain-install-master on Travis Windows builds is
unexpectedly slower when it was running on other OSes.
This commit tries to use release build of RTIM as a mean to
improve performance there.

4 years agoAuto merge of #4685 - HMPerson1:patch-1, r=Manishearth
bors [Fri, 18 Oct 2019 02:51:04 +0000 (02:51 +0000)]
Auto merge of #4685 - HMPerson1:patch-1, r=Manishearth

Update adding_lints.md

changelog: none

4 years agoAuto merge of #4686 - lzutao:fix-travis-windows-stuck, r=Manishearth
bors [Fri, 18 Oct 2019 01:02:08 +0000 (01:02 +0000)]
Auto merge of #4686 - lzutao:fix-travis-windows-stuck, r=Manishearth

travis: Windows build might be stuck as non-supported languages

See <https://docs.travis-ci.com/user/reference/windows/#supported-languages>
for list of Windows supported languages.

I'm sorry for making Travis Windows build stuck.

changelog: none

4 years agoAuto merge of #4683 - HMPerson1:inefficient_to_string, r=Manishearth
bors [Thu, 17 Oct 2019 23:48:55 +0000 (23:48 +0000)]
Auto merge of #4683 - HMPerson1:inefficient_to_string, r=Manishearth

Add `inefficient_to_string` lint

Closes #4586

changelog: Add `inefficient_to_string` lint, which checks for calling `to_string` on `&&str`, which would bypass the `str`'s specialization

4 years agoUpdate help text in `inefficient_to_string`
Michael Zhang [Thu, 17 Oct 2019 23:11:51 +0000 (19:11 -0400)]
Update help text in `inefficient_to_string`

Co-Authored-By: Manish Goregaokar <manishsmail@gmail.com>
4 years agoAuto merge of #4689 - Manishearth:rustup, r=Yaahc
bors [Thu, 17 Oct 2019 23:00:08 +0000 (23:00 +0000)]
Auto merge of #4689 - Manishearth:rustup, r=Yaahc

Rustup to rustc 1.40.0-nightly (fa0f7d008 2019-10-17)

changelog: none

4 years agosyntax::ext -> syntax_expand
Manish Goregaokar [Thu, 17 Oct 2019 22:47:28 +0000 (15:47 -0700)]
syntax::ext -> syntax_expand

4 years agotravis: Windows build might be stuck as non-supported languages
Lzu Tao [Thu, 17 Oct 2019 17:50:59 +0000 (00:50 +0700)]
travis: Windows build might be stuck as non-supported languages

See <https://docs.travis-ci.com/user/reference/windows/#supported-languages>
for list of Windows supported languages.

4 years agoAuto merge of #4659 - lzutao:caching, r=phansch
bors [Thu, 17 Oct 2019 17:16:36 +0000 (17:16 +0000)]
Auto merge of #4659 - lzutao:caching, r=phansch

Cache cargo binaries

changelog: none

4 years agoAdd `run-rustfix` to `inefficient_to_string`
HMPerson1 [Thu, 17 Oct 2019 16:41:45 +0000 (12:41 -0400)]
Add `run-rustfix` to `inefficient_to_string`

4 years agoUpdate adding_lints.md
Michael Zhang [Thu, 17 Oct 2019 16:33:42 +0000 (12:33 -0400)]
Update adding_lints.md

4 years agoDogfood for `inefficient_to_string`
HMPerson1 [Wed, 16 Oct 2019 21:12:41 +0000 (17:12 -0400)]
Dogfood for `inefficient_to_string`

4 years agoAdd `inefficient_to_string` lint
HMPerson1 [Wed, 16 Oct 2019 19:54:20 +0000 (15:54 -0400)]
Add `inefficient_to_string` lint

4 years agoUse CI caching and cargo feature install-upgrade
Lzu Tao [Wed, 16 Oct 2019 06:14:24 +0000 (13:14 +0700)]
Use CI caching and cargo feature install-upgrade

* do not force to install rustfmt
* use cargo-cache
* disable bash trace
* clone single branch

4 years agoAuto merge of #4669 - lzutao:minimal-rustup, r=phansch
bors [Wed, 16 Oct 2019 04:13:38 +0000 (04:13 +0000)]
Auto merge of #4669 - lzutao:minimal-rustup, r=phansch

build: use rustup minimal profile to speed up Rust installation time

changelog: none

4 years agoAuto merge of #4673 - Manishearth:rustup, r=phansch
bors [Tue, 15 Oct 2019 19:58:52 +0000 (19:58 +0000)]
Auto merge of #4673 - Manishearth:rustup, r=phansch

Rustup to rustc 1.40.0-nightly (237d54ff6 2019-10-15)

changelog: none

4 years agobuild: use rustup minimal profile to speed up Rust installation time
Lzu Tao [Tue, 15 Oct 2019 10:02:11 +0000 (17:02 +0700)]
build: use rustup minimal profile to speed up Rust installation time

4 years agoRustup to rustc 1.40.0-nightly (237d54ff6 2019-10-15)
Manish Goregaokar [Tue, 15 Oct 2019 19:29:28 +0000 (12:29 -0700)]
Rustup to rustc 1.40.0-nightly (237d54ff6 2019-10-15)

4 years agoAuto merge of #4668 - lzutao:update-rtim, r=flip1995
bors [Tue, 15 Oct 2019 18:34:30 +0000 (18:34 +0000)]
Auto merge of #4668 - lzutao:update-rtim, r=flip1995

 build: switch back to latest official RTIM release

Closes #4666

changelog: none

4 years agoAuto merge of #4671 - flip1995:ice-4671, r=phansch
bors [Tue, 15 Oct 2019 17:57:10 +0000 (17:57 +0000)]
Auto merge of #4671 - flip1995:ice-4671, r=phansch

Fix ICE in `use_self` lint

The ICE is produced by building this span:
https://github.com/rust-lang/rust-clippy/blob/55e7818a06c8d83bead9c81e10e73ba33fb20890/clippy_lints/src/use_self.rs#L55-L60

`span` can start in the file the macro is defined in and end where the macro is called.

changelog: Fix ICE in `use_self` lint

4 years agoEnable integration tests again
flip1995 [Tue, 15 Oct 2019 13:13:09 +0000 (15:13 +0200)]
Enable integration tests again

futures-rs, hyper, rls

4 years agoFix ICE in use_self lint
flip1995 [Tue, 15 Oct 2019 13:11:29 +0000 (15:11 +0200)]
Fix ICE in use_self lint

4 years agoAdd regression test for ICE in use-self lint
flip1995 [Tue, 15 Oct 2019 12:57:54 +0000 (14:57 +0200)]
Add regression test for ICE in use-self lint

4 years agotravis: break out before_script stage to test setup-toolchain work
Lzu Tao [Mon, 14 Oct 2019 18:21:25 +0000 (01:21 +0700)]
travis: break out before_script stage to test setup-toolchain work

4 years agobuild: do not trace deploy step
Lzu Tao [Mon, 14 Oct 2019 17:56:27 +0000 (00:56 +0700)]
build: do not trace deploy step

4 years agoEarly exit if there is any errors
Lzu Tao [Mon, 14 Oct 2019 17:51:41 +0000 (00:51 +0700)]
Early exit if there is any errors

4 years agobuild: switch back to latest official RTIM release
Lzu Tao [Mon, 14 Oct 2019 17:45:48 +0000 (00:45 +0700)]
build: switch back to latest official RTIM release

4 years agoAuto merge of #4619 - james9909:unused-self, r=flip1995
bors [Tue, 15 Oct 2019 08:16:39 +0000 (08:16 +0000)]
Auto merge of #4619 - james9909:unused-self, r=flip1995

Add a lint for unused self

changelog: Adds a new lint: `unused_self`

Closes #4550.

4 years agoChange terminology from static to associated
James Wang [Mon, 14 Oct 2019 19:23:24 +0000 (14:23 -0500)]
Change terminology from static to associated

4 years agoSwitch to OnlyBodies
James Wang [Sun, 6 Oct 2019 18:12:07 +0000 (13:12 -0500)]
Switch to OnlyBodies

4 years agoChange lint to be pedantic
James Wang [Fri, 4 Oct 2019 17:18:52 +0000 (12:18 -0500)]
Change lint to be pedantic

4 years agoRemove prints
James Wang [Thu, 3 Oct 2019 19:38:33 +0000 (14:38 -0500)]
Remove prints

4 years agoAdd a new lint for unused self
James Wang [Thu, 3 Oct 2019 19:09:32 +0000 (14:09 -0500)]
Add a new lint for unused self

4 years agoAuto merge of #4560 - rust-lang:must-use-pure, r=phansch
bors [Mon, 14 Oct 2019 17:33:30 +0000 (17:33 +0000)]
Auto merge of #4560 - rust-lang:must-use-pure, r=phansch

new lints around`#[must_use]`

changelog: Add `must_use_candidate` lint,  add `must-use-unit` lint, add `double_must_use` lint

The first one checks if an public function or method has no mutable argument and mutates no non-local data and lints if it has no `#[must_use]` attribute. It will skip inner functions, because those are usually highly local and the attribute doesn't have as much benefit there.

The second lints `#[must_use]` attributes on functions and methods that return unit. Those attributes are likely a remnant from a refactoring that removed the return value.

The last one lints for `#[must_use]` attributrs without text on functions that return a type which is already marked `#[must_use]`. This has no auto-suggestion, because while it would be easy to do, there may be value in writing a detailed text for the attribute instead.

This fixes #4526

4 years agoAuto merge of #4663 - lzutao:rustup, r=phansch
bors [Mon, 14 Oct 2019 17:00:46 +0000 (17:00 +0000)]
Auto merge of #4663 - lzutao:rustup, r=phansch

Rustup

changelog: none

Suppresses #4662.

r? @phansch

4 years agonew lints around `#[must_use]` fns
Andre Bogus [Wed, 18 Sep 2019 06:37:41 +0000 (08:37 +0200)]
new lints around `#[must_use]` fns

`must_use_unit` lints unit-returning functions with a `#[must_use]`
attribute, suggesting to remove it.

`double_must_use` lints functions with a plain `#[must_use]`
attribute, but which return a type which is already `#[must_use]`,
so the attribute has no benefit.

`must_use_candidate` is a pedantic lint that lints functions and
methods that return some non-unit type that is not already
`#[must_use]` and suggests to add the annotation.

4 years agorustc-dev has been temporarily removed
Lzu Tao [Mon, 14 Oct 2019 03:25:05 +0000 (10:25 +0700)]
rustc-dev has been temporarily removed

4 years agoUse my RTIM fork
Lzu Tao [Sun, 13 Oct 2019 17:47:36 +0000 (00:47 +0700)]
Use my RTIM fork

4 years agoBump compiletest
Manish Goregaokar [Sun, 13 Oct 2019 14:46:14 +0000 (07:46 -0700)]
Bump compiletest

4 years agoAuto merge of #4649 - Lythenas:use_match_function_call, r=phansch
bors [Sat, 12 Oct 2019 06:40:13 +0000 (06:40 +0000)]
Auto merge of #4649 - Lythenas:use_match_function_call, r=phansch

Use match_function_call wherever possible

Move `match_function_call` to `utils` and use it wherever possible as discussed in #4635.

changelog: none

4 years agoAuto merge of #4654 - lzutao:rustc-dev, r=phansch
bors [Sat, 12 Oct 2019 06:00:52 +0000 (06:00 +0000)]
Auto merge of #4654 - lzutao:rustc-dev, r=phansch

Rustup for rustc-dev

cc https://github.com/rust-lang/rust/pull/64823
Closes #4651
changelog: none

4 years agouse git version
Lzu Tao [Sat, 12 Oct 2019 03:18:31 +0000 (10:18 +0700)]
use git version

4 years agoRustup for rustc-dev
Lzu Tao [Fri, 11 Oct 2019 08:53:55 +0000 (15:53 +0700)]
Rustup for rustc-dev

4 years agoUse match_function_call wherever possible
Matthias Seiffert [Thu, 10 Oct 2019 18:00:43 +0000 (20:00 +0200)]
Use match_function_call wherever possible

4 years agoMove match_function_call to utils
Matthias Seiffert [Thu, 10 Oct 2019 08:57:12 +0000 (10:57 +0200)]
Move match_function_call to utils

4 years agoAuto merge of #4646 - lzutao:make-pr-guides-visible, r=flip1995
bors [Thu, 10 Oct 2019 07:14:41 +0000 (07:14 +0000)]
Auto merge of #4646 - lzutao:make-pr-guides-visible, r=flip1995

PR template might not be stripped by contributors

cc d97fbdbb42c28ec9e051b23138d7898bae6836c4

So I think it would be better to make the template visible.
Also I renamed the template with extension `.md`.

changelog: none

4 years agoPR template might not be stripped by contributors
Lzu Tao [Wed, 9 Oct 2019 17:57:57 +0000 (00:57 +0700)]
PR template might not be stripped by contributors

4 years agoAuto merge of #4616 - mati865:license, r=Manishearth
bors [Wed, 9 Oct 2019 16:09:26 +0000 (16:09 +0000)]
Auto merge of #4616 - mati865:license, r=Manishearth

Fix license in Cargo.toml files

Missed in https://github.com/rust-lang/rust-clippy/pull/3269

changelog: none

r? @Manishearth

4 years agoAuto merge of #4615 - nikofil:suspicious_unary_op_formatting, r=flip1995
bors [Wed, 9 Oct 2019 15:26:33 +0000 (15:26 +0000)]
Auto merge of #4615 - nikofil:suspicious_unary_op_formatting, r=flip1995

New lint: suspicious_unary_op_formatting

fixes #4228

changelog: New lint: [`suspicious_unary_op_formatting`]

4 years agoNew lint: suspicious_unary_op_formatting
Nikos Filippakis [Thu, 3 Oct 2019 15:45:58 +0000 (17:45 +0200)]
New lint: suspicious_unary_op_formatting

Lints when, on the RHS of a BinOp, there is a UnOp without a space
before the operator but with a space after (e.g. foo >- 1).

Signed-off-by: Nikos Filippakis <nikolaos.filippakis@cern.ch>
4 years agoAuto merge of #4635 - Lythenas:suggestions-for-assert-false, r=flip1995
bors [Wed, 9 Oct 2019 08:56:30 +0000 (08:56 +0000)]
Auto merge of #4635 - Lythenas:suggestions-for-assert-false, r=flip1995

Add assert message to suggestion in lint assertions_on_constants

<!--
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.

- [x] Followed [lint naming conventions][lint_naming]
- [x] Added passing UI tests (including committed `.stderr` file)
- [ ] `cargo test` passes locally
- [x] Executed `./util/dev update_lints`
- [ ] Added lint documentation
- [ ] Run `./util/dev fmt`

[lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints

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 -->

- [x] suggest replacing `assert!(false, "msg")` with `panic!("msg")`
- [x] extend to allow ~~variables~~ any expression for `"msg"`
- ~~suggest replacing `assert!(false, "msg {}", "arg")` with `panic!("msg {}", "arg")`~~

changelog: add assert message to suggestion in lint assertions_on_constants

Work towards fixing: #3575

4 years agoAuto merge of #4602 - EthanTheMaster:issue-4001, r=flip1995
bors [Tue, 8 Oct 2019 16:17:48 +0000 (16:17 +0000)]
Auto merge of #4602 - EthanTheMaster:issue-4001, r=flip1995

Add suggestion for mul_add

Issue #4001: Whenever `a*b+c` is found where `a`,`b`, and `c` are floats, a lint is suggested saying to use `a.mul_add(b, c)`. Using `mul_add` may give a performance boost depending on the target architecture and also has higher numerical accuracy as there is no round off when doing `a*b`.

changelog: New lint: `manual_mul_add`

4 years agoAddresses Issue #4001
Ethan Lam [Sat, 28 Sep 2019 18:40:10 +0000 (13:40 -0500)]
Addresses Issue #4001

Fixed typo

Fixes lint name and uses appropriate linting suggestion

changed lint help message

Added autofixable test

Added Autofixable Test

Removed Broken Autofixable File

updated lints

Generated Autofixable/Nonfixable Test Cases

Changed Suggestion Applicability

Updated Lint Count

4 years agoAuto merge of #4641 - sinkuu:revert_workaround, r=phansch
bors [Tue, 8 Oct 2019 08:36:26 +0000 (08:36 +0000)]
Auto merge of #4641 - sinkuu:revert_workaround, r=phansch

Revert "Workaround cargo bug on Windows"

[Cargo is fixed on rust master](https://github.com/rust-lang/rust/pull/65186). This reverts PR #4624.

Fixes #4638

changelog: none

4 years agoAuto merge of #4627 - kerhong:fix-typo-in-inherent-to-string, r=phansch
bors [Tue, 8 Oct 2019 07:52:44 +0000 (07:52 +0000)]
Auto merge of #4627 - kerhong:fix-typo-in-inherent-to-string, r=phansch

Fix typo in inherent_to_string documentation

A simple typo fix in `inherent_to_string` and `inherent_to_string_shadow_display` documentation

changelog: none

4 years agoAuto merge of #4611 - rust-lang:doc-visibility, r=flip1995
bors [Tue, 8 Oct 2019 07:11:26 +0000 (07:11 +0000)]
Auto merge of #4611 - rust-lang:doc-visibility, r=flip1995

account for doc visibility

This fixes #4608.

Also I noticed that the lint failed to look at trait and impl items. There's a small bit of fallout in the code, too, but not enough to warrant its own commit.

changelog: check docs of trait items and impl items, also make `missing_safety_doc` account for visibility

4 years agoAuto merge of #4595 - rust-lang:rustbot, r=flip1995
bors [Tue, 8 Oct 2019 06:30:50 +0000 (06:30 +0000)]
Auto merge of #4595 - rust-lang:rustbot, r=flip1995

Allow everyone to assign labels with rustbot

Also allows people to claim issues even if they aren't part of the org

changelog: none

4 years agoAuto merge of #4592 - rust-lang:transmute-collection, r=flip1995
bors [Tue, 8 Oct 2019 05:51:07 +0000 (05:51 +0000)]
Auto merge of #4592 - rust-lang:transmute-collection, r=flip1995

New lint: `unsound_collection_transmute`

changelog: Add `unsound_collection_transmute` lint

This fixes #4515

4 years agoRevert "Workaround cargo bug on Windows"
Shotaro Yamada [Tue, 8 Oct 2019 05:20:24 +0000 (14:20 +0900)]
Revert "Workaround cargo bug on Windows"

This reverts commit 248251b3b26c5f21e2c2f5bfa5d85cc17b13fc05.
This reverts commit 20b73514395bb442fb16ce913b6c2b3965ff3156.

4 years agoAuto merge of #4628 - flip1995:rustup, r=phansch
bors [Tue, 8 Oct 2019 05:09:53 +0000 (05:09 +0000)]
Auto merge of #4628 - flip1995:rustup, r=phansch

Rustup to rust-lang/rust#64874

TODO:
- [x] replace `rvalue_promotable_map` in [1]
- [ ] ~~fix [2] according to this comment https://github.com/rust-lang/rust/pull/64874#issuecomment-536203626 this should be merged with `consume`, but I didn't figure out how to merge them, yet.~~
- [ ] ~~fix [3]; What to do with `LoanCause`?~~

[2]+[3] probably have to be resolved by a rewrite of the lint. https://github.com/rust-lang/rust-clippy/pull/4628#issuecomment-538574944

[1]
https://github.com/rust-lang/rust-clippy/blob/54bf4ffd626970e831bb80c037f804a3b3450835/clippy_lints/src/methods/mod.rs#L1292-L1299

[2]
https://github.com/rust-lang/rust-clippy/blob/54bf4ffd626970e831bb80c037f804a3b3450835/clippy_lints/src/escape.rs#L126

[3]
https://github.com/rust-lang/rust-clippy/blob/54bf4ffd626970e831bb80c037f804a3b3450835/clippy_lints/src/escape.rs#L166-L176

I could need some help with [1]. The purpose of this is to "don't lint for constant values". cc @matthewjasper

For now I see what I can do with [2].

changelog: Temporary break `boxed_local` lint.

4 years agoReduce duplication
Matthias Seiffert [Mon, 7 Oct 2019 20:08:00 +0000 (22:08 +0200)]
Reduce duplication

4 years agoMatch any expr for panic message
Matthias Seiffert [Mon, 7 Oct 2019 18:40:05 +0000 (20:40 +0200)]
Match any expr for panic message

4 years agoMake if_chain more readable
Matthias Seiffert [Sun, 6 Oct 2019 18:10:30 +0000 (20:10 +0200)]
Make if_chain more readable

4 years agoAdd message to replace assert!(false) help
Matthias Seiffert [Sat, 5 Oct 2019 14:45:02 +0000 (16:45 +0200)]
Add message to replace assert!(false) help

4 years agoMove is_argument check into mutate
flip1995 [Sun, 6 Oct 2019 12:49:26 +0000 (14:49 +0200)]
Move is_argument check into mutate

4 years agoRun util/dev fmt
flip1995 [Sat, 5 Oct 2019 10:42:09 +0000 (12:42 +0200)]
Run util/dev fmt

4 years agoGet rid of rvalue_promotable_map method call
flip1995 [Sat, 5 Oct 2019 10:38:38 +0000 (12:38 +0200)]
Get rid of rvalue_promotable_map method call

4 years agoMerge consume and consume_pat in escape analysis
flip1995 [Sat, 5 Oct 2019 10:23:59 +0000 (12:23 +0200)]
Merge consume and consume_pat in escape analysis

FIXME: This doesn't work and probably needs a rewrite of the lint

See https://github.com/rust-lang/rust-clippy/pull/4628#issuecomment-538574944

4 years agoUse new format of licenses
Mateusz Mikuła [Fri, 4 Oct 2019 15:39:23 +0000 (17:39 +0200)]
Use new format of licenses

Co-Authored-By: lzutao <taolzu@gmail.com>
4 years agoFix needless_pass_by_value
flip1995 [Fri, 4 Oct 2019 13:00:01 +0000 (15:00 +0200)]
Fix needless_pass_by_value

This also accidentally improved the spans of the suggestions

4 years agoRustup to rust-lang/rust#64874
flip1995 [Fri, 4 Oct 2019 12:24:47 +0000 (14:24 +0200)]
Rustup to rust-lang/rust#64874

Episode 1 - The simple cases

4 years agoAuto merge of #4613 - Lythenas:lint-assert_eq-unit_exprs, r=flip1995
bors [Fri, 4 Oct 2019 10:27:44 +0000 (10:27 +0000)]
Auto merge of #4613 - Lythenas:lint-assert_eq-unit_exprs, r=flip1995

Add check for assert_eq macros to unit_cmp lint

changelog: Add check for unit comparisons through `assert_eq!`, `debug_assert_eq!`, `assert_ne!` and `debug_assert_ne!` macros to unit_cmp lint.

fixes #4481

4 years agoFix typo in inherent_to_string documentation
Edgars Baduns [Fri, 4 Oct 2019 09:58:53 +0000 (10:58 +0100)]
Fix typo in inherent_to_string documentation

4 years agoAuto merge of #4621 - JohnTitor:fix-windows, r=phansch
bors [Fri, 4 Oct 2019 09:35:54 +0000 (09:35 +0000)]
Auto merge of #4621 - JohnTitor:fix-windows, r=phansch

Use windows-sdk-10.1 to avoid installation failure

This fixes installation failure on Windows on Travis but we need to fix rustfmt issue first to pass the CI completely.

changelog: none

4 years agoAuto merge of #4625 - phansch:rollup-qp7ki0h, r=phansch
bors [Fri, 4 Oct 2019 06:45:04 +0000 (06:45 +0000)]
Auto merge of #4625 - phansch:rollup-qp7ki0h, r=phansch

Rollup of 2 pull requests

Successful merges:

 - #4509 (Fix false-positive of redundant_clone and move to clippy::perf)
 - #4614 (Allow casts from the result of `abs` to unsigned)

Failed merges:

changelog: none

r? @ghost

4 years agoAuto merge of #4622 - Lythenas:fix-doc-formatting-for-mistyped-literal-suffixes,...
bors [Fri, 4 Oct 2019 06:13:47 +0000 (06:13 +0000)]
Auto merge of #4622 - Lythenas:fix-doc-formatting-for-mistyped-literal-suffixes, r=phansch

Correctly align doc of mistyped literal suffixes

changelog: Fix misaligned markdown list in doc of `mistyped_literal_suffixes`

4 years agoRollup merge of #4614 - HMPerson1:abs_cast_unsigned, r=flip1995
Phil Hansch [Fri, 4 Oct 2019 06:08:59 +0000 (08:08 +0200)]
Rollup merge of #4614 - HMPerson1:abs_cast_unsigned, r=flip1995

Allow casts from the result of `abs` to unsigned

changelog: Allow casts from the result of `abs` to unsigned in `cast_sign_loss`

Fixes #4605

4 years agoRollup merge of #4509 - sinkuu:redundant_clone_fix, r=llogiq
Phil Hansch [Fri, 4 Oct 2019 06:08:58 +0000 (08:08 +0200)]
Rollup merge of #4509 - sinkuu:redundant_clone_fix, r=llogiq

Fix false-positive of redundant_clone and move to clippy::perf

This PR introduces dataflow analysis to `redundant_clone` lint to filter out borrowed variables, which had been incorrectly detected.

Depends on https://github.com/rust-lang/rust/pull/64207.

changelog: Moved `redundant_clone` lint to `perf` group

# What this lint catches

## `clone`/`to_owned`

```rust
let s = String::new();
let t = s.clone();
```

```rust
// MIR
_1 = String::new();
_2 = &_1;
_3 = clone(_2); // (*)
```

We can turn this `clone` call into a move if

1. `_2` is the sole borrow of `_1` at the statement `(*)`
2. `_1` is not used hereafter

## `Deref` + type-specific `to_owned` method

```rust
let s = std::path::PathBuf::new();
let t = s.to_path_buf();
```

```rust
// MIR
_1 = PathBuf::new();
_2 = &1;
_3 = call deref(_2);
_4 = _3;                         // Copies borrow
StorageDead(_2);
_5 = Path::to_path_buf(_4); // (*)
```

We can turn this `to_path_buf` call into a move if

1. `_3` `_4` are the sole borrow of `_1` at `(*)`
2. `_1` is not used hereafter

# What this PR introduces

1. `MaybeStorageLive` that determines whether a local lives at a particular location
2. `PossibleBorrowerVisitor` that constructs [`TransitiveRelation`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_data_structures/transitive_relation/struct.TransitiveRelation.html) of possible borrows, e.g. visiting `_2 = &1; _3 = &_2:` will result in `_3 -> _2 -> _1` relation. Then `_3` and `_2` will be counted as possible borrowers of `_1` in the sole-borrow analysis above.

4 years agoAuto merge of #4624 - sinkuu:workaround_cargo, r=llogiq
bors [Fri, 4 Oct 2019 05:42:25 +0000 (05:42 +0000)]
Auto merge of #4624 - sinkuu:workaround_cargo, r=llogiq

Workaround cargo issue on appveyor

Use absolute paths for `cargo` and `rustfmt` to workaround https://github.com/rust-lang/cargo/issues/7475.

Appveyor passed on my fork: https://ci.appveyor.com/project/sinkuu/rust-clippy/builds/27870367

changelog: none

4 years agoUse home::cargo_home
Shotaro Yamada [Fri, 4 Oct 2019 02:05:44 +0000 (11:05 +0900)]
Use home::cargo_home

4 years agoWorkaround cargo bug on Windows
Shotaro Yamada [Fri, 4 Oct 2019 00:56:45 +0000 (09:56 +0900)]
Workaround cargo bug on Windows

4 years agoCorrectly align doc of mistyped literal suffixes
Matthias Seiffert [Thu, 3 Oct 2019 20:07:51 +0000 (22:07 +0200)]
Correctly align doc of mistyped literal suffixes

4 years agoUse windows-sdk-10.1 to avoid installation failure
Yuki Okushi [Thu, 3 Oct 2019 19:42:46 +0000 (04:42 +0900)]
Use windows-sdk-10.1 to avoid installation failure

4 years agoFix license in Cargo.toml files
Mateusz Mikuła [Thu, 3 Oct 2019 17:55:05 +0000 (19:55 +0200)]
Fix license in Cargo.toml files

4 years agoRemove assert_ne example from doc
Matthias Seiffert [Thu, 3 Oct 2019 17:53:41 +0000 (19:53 +0200)]
Remove assert_ne example from doc

4 years agoUpdate unit_cmp tests to include blocks for asserts
Matthias Seiffert [Thu, 3 Oct 2019 12:38:04 +0000 (14:38 +0200)]
Update unit_cmp tests to include blocks for asserts

4 years agoMention asserts in doc for unit_cmp lint
Matthias Seiffert [Thu, 3 Oct 2019 12:35:05 +0000 (14:35 +0200)]
Mention asserts in doc for unit_cmp lint

4 years agoUpdate the .stderr to include the backticks
Matthias Seiffert [Thu, 3 Oct 2019 10:01:02 +0000 (12:01 +0200)]
Update the .stderr to include the backticks

4 years agoPrint assert macro name in backticks
Matthias Seiffert [Thu, 3 Oct 2019 09:43:39 +0000 (11:43 +0200)]
Print assert macro name in backticks

Co-Authored-By: Philipp Krones <hello@philkrones.com>
4 years agoextern rustc_index
Shotaro Yamada [Tue, 1 Oct 2019 23:02:18 +0000 (08:02 +0900)]
extern rustc_index

4 years agoAdd comments
Shotaro Yamada [Mon, 30 Sep 2019 07:16:09 +0000 (16:16 +0900)]
Add comments

4 years agoResolve reviews
Shotaro Yamada [Sat, 28 Sep 2019 11:29:35 +0000 (20:29 +0900)]
Resolve reviews

4 years agoApply suggestion
Shotaro Yamada [Wed, 18 Sep 2019 05:56:30 +0000 (14:56 +0900)]
Apply suggestion

Co-Authored-By: ecstatic-morse <ecstaticmorse@gmail.com>
4 years agoTest fixes
Shotaro Yamada [Mon, 16 Sep 2019 15:50:36 +0000 (00:50 +0900)]
Test fixes

4 years agoAdd run-rustfix
Shotaro Yamada [Tue, 10 Sep 2019 02:56:34 +0000 (11:56 +0900)]
Add run-rustfix

4 years agoFix false-positive of redundant_clone and move to clippy::perf
Shotaro Yamada [Mon, 16 Sep 2019 15:50:15 +0000 (00:50 +0900)]
Fix false-positive of redundant_clone and move to clippy::perf

4 years agoAllow casts from the result of `abs` to unsigned
HMPerson1 [Wed, 2 Oct 2019 21:23:54 +0000 (17:23 -0400)]
Allow casts from the result of `abs` to unsigned

4 years agoAdd check for assert_eq macros to unit_cmp lint
Matthias Seiffert [Wed, 2 Oct 2019 20:48:19 +0000 (22:48 +0200)]
Add check for assert_eq macros to unit_cmp lint

4 years agoNew lint: unsound_collection_transmute
Andre Bogus [Fri, 27 Sep 2019 17:19:26 +0000 (19:19 +0200)]
New lint: unsound_collection_transmute

4 years agoaccount for doc visibility
Andre Bogus [Wed, 2 Oct 2019 15:19:30 +0000 (17:19 +0200)]
account for doc visibility