Commit Graph

326 Commits

Author SHA1 Message Date
Cameron Steffen
20fb7f2916 Update rustfmt 2021-10-24 12:52:38 -05:00
Dharma Saputra Wijaya
a5a3e6192d Fix typo on utils/lib 2021-10-23 23:42:31 +08:00
flip1995
122233091a
Bump Clippy Version -> 0.1.58 2021-10-21 12:19:32 +02:00
flip1995
085181e29d
Merge remote-tracking branch 'upstream/master' into rustup 2021-10-21 12:18:12 +02:00
Yuki Okushi
30cc96efce Rollup merge of #88860 - nbdd0121:panic, r=m-ou-se
Deduplicate panic_fmt

std's begin_panic_fmt and core's panic_fmt are duplicates. Merge them to declutter code and remove a lang item.
2021-10-20 04:35:14 +09:00
Andre Bogus
e88c956e1e avoid eq_op in test code 2021-10-19 21:02:30 +02:00
Gary Guo
ebf4f03f7d Remove begin_panic_fmt from clippy 2021-10-19 15:15:59 +01:00
r00ster91
599d9126a2 Some "parenthesis" and "parentheses" fixes 2021-10-17 12:04:01 +02:00
Samuel E. Moelius III
c9599d79a3 Add format_in_format_args and to_string_in_format_args lints
Fixes #7667 and #7729
2021-10-15 12:44:38 -04:00
Yechan Bae
03fed75c89 Address internal lints 2021-10-09 05:59:53 -04:00
Yechan Bae
de0d2b1500 Add testcases 2021-10-09 05:47:07 -04:00
Yechan Bae
b1aa3064b6 Address PR comments 2021-10-09 05:47:06 -04:00
Yechan Bae
dd9c8d32f2 Extract get_vec_init_kind and share it 2021-10-09 05:43:58 -04:00
Yechan Bae
759200b699 Handle PR feedbacks first round 2021-10-09 05:38:19 -04:00
Yechan Bae
452181c69d Implement uninit_vec lint 2021-10-09 05:38:19 -04:00
bors
a04a7cd9f9 Auto merge of #7779 - rust-lang:test_module, r=flip1995
make test module detection more strict

I started with some small improvements to clippy_utils/src/lib.rs, but then found that our "test" module detection would also catch words containing "test" like e.g. "attestation". So I made this a bit more strict (splitting by `'_'` and checking for `test` or `tests`), adding a test case as I went.

---

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: none
2021-10-07 09:36:51 +00:00
flip1995
5cf4984872 Merge commit 'b7f3f7f6082679da2da9a0b3faf1b5adef3afd3b' into clippyup 2021-10-07 11:21:30 +02:00
flip1995
9613df9c85
Allow invalid-paths for regex paths 2021-10-07 11:12:02 +02:00
flip1995
1f955158dd
Merge remote-tracking branch 'upstream/master' into rustup 2021-10-07 11:11:23 +02:00
Andre Bogus
86811e9b1b make test module detection more strict 2021-10-07 00:14:06 +02:00
Klim Tsoutsman
8b37928131
Fix typos
I'm not sure whether I should add links to `bool`, `char`, and `str`. `slice` could also be linked to.
2021-10-06 23:32:22 +11:00
dswij
42f2304ce4 Drop exponent suggestion when 0
This commit changes numeric literal formatting to drop exponent when
exponent is 0.
2021-10-06 15:02:38 +08:00
hkalbasi
388a3d0983 Implement equatable if let lint 2021-10-04 22:16:42 +03:30
Cameron Steffen
e165c12932 Make diangostic item names consistent 2021-10-02 19:38:19 -05:00
Manish Goregaokar
6bf5c0b185 Correctly handle signs in exponents in numeric_literal::format() 2021-10-01 17:27:47 -07:00
Manish Goregaokar
6d18c9912f Rollup merge of #88963 - fee1-dead:const-iterator, r=oli-obk
Coerce const FnDefs to implement const Fn traits

You can now pass a FnDef to a function expecting `F` where `F: ~const FnTrait`.

r? ``@oli-obk``

``@rustbot`` label T-compiler F-const_trait_impl
2021-10-01 14:46:48 -07:00
Cameron Steffen
a17359c696 Remove shadow allows 2021-09-30 14:07:58 -05:00
bors
ab99eec15f Auto merge of #7684 - surechen:solve_derivable_impls, r=flip1995
fix for issue #7683

Fixes #7683.

For Repeat  [x; y] (x is the type and y is the times to repeat) . When y > 32, the compiler will report an error:

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=7148558162685e91056e0550797ea74c

Because 6cdd42f9f8/library/std/src/primitive_docs.rs (L538)
/// Arrays of sizes from 0 to 32 (inclusive) implement [`Default`] trait
/// if the element type allows it. As a stopgap, trait implementations are
/// statically generated up to size 32.

So here to detect this situation.

changelog: [`derivable_impls`]: No longer lints when arrays bigger than 32 elements are involved
2021-09-30 08:19:58 +00:00
surechen
a3d3735515 Arrays of sizes from 0 to 32 (inclusive) implement [Default] trait, edit method is_default_equivalent() to satisfy with this. 2021-09-30 10:41:36 +08:00
flip1995
23d5457e6d Merge commit 'cb7915b00c235e9b5861564f3be78dba330980ee' into clippyup 2021-09-28 18:03:12 +01:00
flip1995
ec38746b4a
Allow internal lint INVALID_PATHS for itertools path
Since clippy_utils doesn't depend on the itertools crate anymore, the
lint can't find the path.
2021-09-28 17:07:51 +01:00
flip1995
707494eca9
Merge remote-tracking branch 'upstream/master' into rustup 2021-09-28 10:52:31 +01:00
Matthias Krüger
c3515c301d bump clippy crates to edition 2021 2021-09-25 22:40:58 +02:00
bors
aef45770f8 Auto merge of #89030 - nbdd0121:box2, r=jonas-schievink
Introduce `Rvalue::ShallowInitBox`

Polished version of #88700.

Implements MCP rust-lang/compiler-team#460, and should allow #43596 to go forward.

In short, creating an empty box is split from a nullary-op `NullOp::Box` into two steps, first a call to `exchange_malloc`, then a `Rvalue::ShallowInitBox` which transmutes `*mut u8` to a shallow-initialized `Box<T>`. This allows the `exchange_malloc` call to unwind. Details can be found in the MCP.

`NullOp::Box` is not yet removed, purely to make reverting easier in case anything goes wrong as the result of this PR. If revert is needed a reversion of "Use Rvalue::ShallowInitBox for box expression" commit followed by a test bless should be sufficient.

Experiments in #88700 showed a very slight compile-time perf regression due to (supposedly) slightly more time spent in LLVM. We could omit unwind edge generation (in non-`oom=panic` case) in box expression MIR construction to restore perf; but I don't think it's necessary since runtime perf isn't affected and perf difference is rather small.
2021-09-25 11:01:13 +00:00
Gary Guo
fc8edf12cd Introduce Rvalue::ShallowInitBox 2021-09-25 01:08:41 +01:00
Labelray
543b638dbe Add new lint if_then_panic 2021-09-24 22:14:20 +08:00
bors
edaeacfbbb Auto merge of #89139 - camsteffen:write-perf, r=Mark-Simulacrum
Use ZST for fmt unsafety

as suggested here - https://github.com/rust-lang/rust/pull/83302#issuecomment-923529151.
2021-09-23 02:10:26 +00:00
Cameron Steffen
4873ebee4c Use ZST for fmt unsafety
This allows the format_args! macro to keep the pre-expansion code out of
the unsafe block without doing gymnastics with nested `match`
expressions. This reduces codegen.
2021-09-21 10:04:44 -05:00
Cameron Steffen
19a3116feb Remove needless hir Map ref 2021-09-18 15:55:34 -05:00
Deadbeef
3e5f80f009 Move is_const_fn to under TyCtxt 2021-09-15 11:27:34 +00:00
David Tolnay
c2783c1dcb
Downgrade many_single_char_names to pedantic 2021-09-14 09:59:06 -07:00
Guillaume Gomez
d37f1091e8 Update permissions path for clippy lint 2021-09-13 21:27:53 +02:00
bors
1add837c91 Auto merge of #88517 - smoelius:without-patch-versions, r=flip1995
Update Clippy dependencies without patch versions

Trial run for https://github.com/rust-lang/rust-clippy/pull/7606
2021-09-13 02:45:18 +00:00
bors
00d45fe5b7 Auto merge of #88839 - nbdd0121:alignof, r=nagisa
Introduce NullOp::AlignOf

This PR introduces `Rvalue::NullaryOp(NullOp::AlignOf, ty)`, which will be lowered from `align_of`, similar to `size_of` lowering to `Rvalue::NullaryOp(NullOp::SizeOf, ty)`.

The changes are originally part of #88700 but since it's not dependent on other changes and could have performance impact on its own, it's separated into its own PR.
2021-09-12 23:49:24 +00:00
Gary Guo
5d93d9d040 Introduce NullOp::AlignOf 2021-09-13 00:08:35 +01:00
Vadim Petrochenkov
9163ac9595 rustc: Remove local variable IDs from Exports
Local variables can never be exported.
2021-09-10 23:41:48 +03:00
Cameron Steffen
ae2a95fadc Eat dogfood 2021-09-09 17:10:59 -05:00
Samuel E. Moelius III
43ed2065cc Update dependencies 2021-09-09 07:47:16 -04:00
bors
261e34d534 Auto merge of #88615 - flip1995:clippyup, r=Manishearth
Update Clippy

r? `@Manishearth`
2021-09-08 23:52:31 +00:00
flip1995
091ed44b50 Merge commit '27afd6ade4bb1123a8bf82001629b69d23d62aff' into clippyup 2021-09-08 16:31:47 +02:00