about summary refs log tree commit diff
path: root/src/tools/clippy
AgeCommit message (Collapse)AuthorLines
2020-11-14Introduce `TypeVisitor::BreakTy`LeSeulArtichaut-1/+1
2020-11-14Auto merge of #78809 - vn-ki:fix-issue-76064, r=oli-obkbors-16/+2
add error_occured field to ConstQualifs, fix #76064 I wasn't sure what `in_return_place` actually did and not sure why it returns `ConstQualifs` while it's sibling functions return `bool`. So I tried to make as minimal changes to the structure as possible. Please point out whether I have to refactor it or not. r? `@oli-obk` cc `@RalfJung`
2020-11-14Add underscore expressions for destructuring assignmentsFabian Zaiser-0/+1
Co-authored-by: varkor <github@varkor.com>
2020-11-13update clippy test ouputVishnunarayan K I-16/+2
2020-11-12Rollup merge of #78836 - fanzier:struct-and-slice-destructuring, r=petrochenkovMara Bos-8/+32
Implement destructuring assignment for structs and slices This is the second step towards implementing destructuring assignment (RFC: rust-lang/rfcs#2909, tracking issue: #71126). This PR is the second part of #71156, which was split up to allow for easier review. Note that the first PR (#78748) is not merged yet, so it is included as the first commit in this one. I thought this would allow the review to start earlier because I have some time this weekend to respond to reviews. If ``@petrochenkov`` prefers to wait until the first PR is merged, I totally understand, of course. This PR implements destructuring assignment for (tuple) structs and slices. In order to do this, the following *parser change* was necessary: struct expressions are not required to have a base expression, i.e. `Struct { a: 1, .. }` becomes legal (in order to act like a struct pattern). Unfortunately, this PR slightly regresses the diagnostics implemented in #77283. However, it is only a missing help message in `src/test/ui/issues/issue-77218.rs`. Other instances of this diagnostic are not affected. Since I don't exactly understand how this help message works and how to fix it yet, I was hoping it's OK to regress this temporarily and fix it in a follow-up PR. Thanks to ``@varkor`` who helped with the implementation, particularly around the struct rest changes. r? ``@petrochenkov``
2020-11-12Auto merge of #78782 - petrochenkov:nodoctok, r=Aaron1011bors-4/+4
Do not collect tokens for doc comments Doc comment is a single token and AST has all the information to re-create it precisely. Doc comments are also responsible for majority of calls to `collect_tokens` (with `num_calls == 1` and `num_calls == 0`, cc https://github.com/rust-lang/rust/pull/78736). (I also moved token collection into `fn parse_attribute` to deduplicate code a bit.) r? `@Aaron1011`
2020-11-11Implement destructuring assignment for structs and slicesFabian Zaiser-8/+32
Co-authored-by: varkor <github@varkor.com>
2020-11-11Fix typo in commentIkko Ashimine-1/+1
occurences -> occurrences
2020-11-09Rollup merge of #78710 - petrochenkov:macvisit, r=davidtwcoDylan DPC-7/+1
rustc_ast: Do not panic by default when visiting macro calls Panicking by default made sense when we didn't have HIR or MIR and everything worked on AST, but now all AST visitors run early and majority of them have to deal with macro calls, often by ignoring them. The second commit renames `visit_mac` to `visit_mac_call`, the corresponding structures were renamed earlier in https://github.com/rust-lang/rust/pull/69589.
2020-11-09Do not collect tokens for doc commentsVadim Petrochenkov-4/+4
2020-11-03rustc_ast: `visit_mac` -> `visit_mac_call`Vadim Petrochenkov-1/+1
2020-11-03rustc_ast: Do not panic by default when visiting macro callsVadim Petrochenkov-6/+0
2020-10-18Rollup merge of #77851 - exrook:split-btreemap, r=dtolnayYuki Okushi-1/+1
BTreeMap: refactor Entry out of map.rs into its own file btree/map.rs is approaching the 3000 line mark, splitting out the entry code buys about 500 lines of headroom. I've created this PR because the changes I've made in #77438 will push `map.rs` over the 3000 line limit and cause tidy to complain. I picked `Entry` to factor out because it feels less tightly coupled to the rest of `BTreeMap` than the various iterator implementations. Related: #60302
2020-10-17Appease the almightly lord clippy, hallowed be thy nameJacob Hughes-1/+1
2020-10-16Handle ExprKind::ConstBlock on clippySantiago Pastorino-1/+17
2020-10-16Rollup merge of #77493 - ↵Dylan DPC-3/+5
hosseind88:ICEs_should_always_print_the_top_of_the_query_stack, r=oli-obk ICEs should always print the top of the query stack see #76920
2020-10-15Remove rustc_session::config::Configest31-3/+3
The wrapper type led to tons of target.target across the compiler. Its ptr_width field isn't required any more, as target_pointer_width is already present in parsed form.
2020-10-14fix stderr file of clippy/custom_ice_message testhosseind88-1/+1
2020-10-13Auto merge of #77796 - jonas-schievink:switchint-refactor, r=oli-obkbors-1/+0
Refactor how SwitchInt stores jump targets Closes https://github.com/rust-lang/rust/issues/65693
2020-10-11Auto merge of #77649 - dash2507:replace_run_compiler, r=matthewjasperbors-2/+2
Replace run_compiler with RunCompiler builder pattern Fixes #77286. Replaces rustc_driver:run_compiler with RunCompiler builder pattern.
2020-10-10Refactor how SwitchInt stores jump targetsJonas Schievink-1/+0
2020-10-09rebase with masterhosseind75-1/+3
2020-10-09add new linehosseind75-1/+1
2020-10-09fix clippy custom_ice_message testhosseind75-0/+2
2020-10-09run full query stack print just when RUST_BACKTRACE is sethosseind75-1/+4
2020-10-09ICEs should print the top of the query stackhosseind75-6/+1
2020-10-09Merge commit '2f6439ae6a6803d030cceb3ee14c9150e91b328b' into clippyupflip1995-616/+1502
2020-10-08Replace run_compiler with RunCompiler builder pattern.Darshan Kathiriya-2/+2
RunCompiler::new takes non-optional params, and optional params can be set using set_*field_name* method. finally `run` will forward all fields to `run_compiler`.
2020-10-06Fix toolsMatthew Jasper-8/+18
2020-10-06Rollup merge of #77560 - rschoon:fix-litkind-rc-bytebuf, r=lcnrYuki Okushi-1/+1
Fix LitKind's byte buffer to use refcounted slice While working on adding a new lint for clippy (see https://github.com/rust-lang/rust-clippy/pull/6044) for avoiding shared ownership of "mutable buffer" types (such as using `Rc<Vec<T>>` instead of `Rc<[T]>`), I noticed a type exported from rustc_ast and used by clippy gets caught by the lint. This PR fixes the exported type. This PR includes the actual change to clippy too, but I will open a PR directly against clippy for that part (although it will currently fail to build there).
2020-10-06Rollup merge of #77534 - ↵Yuki Okushi-13/+4
Mark-Simulacrum:issue-70819-disallow-override-forbid-in-same-scope, r=petrochenkov Disallow overriding forbid in same scope Rebased #73379. Fixes #70819.
2020-10-04clippy: `(Body, DefId)` -> `Body`Dylan MacKenzie-3/+4
2020-10-04Change clippy's Constant back to refcount clone byte stringsRobin Schoonover-1/+1
2020-10-04Prevent forbid from being ignored if overriden at the same level.Felix S. Klock II-13/+4
That is, this changes `#[forbid(foo)] #[allow(foo)]` from allowing foo to forbidding foo.
2020-10-02Deprecate clippy lintMichael Howell-111/+21
2020-09-28Rollup merge of #76474 - bjorn3:driver_selected_codegen, r=oli-obkRalf Jung-2/+2
Add option to pass a custom codegen backend from a driver This allows the driver to pass information to the codegen backend. For example the headcrab debugger may in the future want to use cg_clif to JIT code to be injected in the debuggee. This would PR make it possible to tell cg_clif which symbol can be found at which address and to tell it to inject the JITed code into the right process. This PR may also help with https://github.com/rust-lang/miri/pull/1540 by allowing miri to provide a codegen backend that only emits metadata and doesn't perform any codegen. cc @nbaksalyar (headcrab) cc @RalfJung (miri)
2020-09-27Add option to pass a custom codegen backend from a driverbjorn3-2/+2
2020-09-26Remove all unstable feature support in the `missing_const_for_fn` lintOliver Scherer-97/+25
2020-09-26Move `qualify_min_const_fn` out of rustc into clippyOliver Scherer-1/+465
2020-09-25Auto merge of #77144 - flip1995:clippyup, r=Manishearthbors-965/+3418
Update Clippy Bi-weekly Clippy update. This includes a `Cargo.lock` update (d445493479711389f4dea3a0f433041077ba2088), so probably needs `rollup=never`. r? `@Manishearth`
2020-09-25Rollup merge of #76724 - ecstatic-morse:dataflow-pass-names, r=lcnrJonas Schievink-0/+1
Allow a unique name to be assigned to dataflow graphviz output Previously, if the same analysis were invoked multiple times in a single compilation session, the graphviz output for later runs would overwrite that of previous runs. Allow callers to add a unique identifier to each run so this can be avoided.
2020-09-24Merge commit 'e636b88aa180e8cab9e28802aac90adbc984234d' into clippyupflip1995-965/+3418
2020-09-21Remove `can_suggest` from Clippy.Christiaan Dirkx-62/+16
Removes `can_suggest` from as it is no longer used. Reverts rust-clippy#5724.
2020-09-20Update Clippy testcasesChristiaan Dirkx-65/+91
Update the test `redundant_pattern_matching`: check if `is_some` and `is_none` are suggested within const contexts.
2020-09-20Auto merge of #76136 - CDirkx:const-result, r=dtolnaybors-187/+97
Stabilize some Result methods as const Stabilize the following methods of Result as const: - `is_ok` - `is_err` - `as_ref` A test is also included, analogous to the test for `const_option`. These methods are currently const under the unstable feature `const_result` (tracking issue: #67520). I believe these methods to be eligible for stabilization because of the stabilization of #49146 (Allow if and match in constants) and the trivial implementations, see also: [PR#75463](https://github.com/rust-lang/rust/pull/75463) and [PR#76135](https://github.com/rust-lang/rust/pull/76135). Note: these methods are the only methods currently under the `const_result` feature, thus this PR results in the removal of the feature. Related: #76225
2020-09-20Update src/tools/clippy/clippy_lints/src/matches.rsCDirkx-1/+1
Co-authored-by: Ralf Jung <post@ralfj.de>
2020-09-20Remove `can_suggest` check for `is_ok` and `is_err`.Christiaan Dirkx-4/+4
`is_ok` and `is_err` are stabilized as const and can thus always be suggested.
2020-09-20Update Clippy testcasesChristiaan Dirkx-183/+93
Update the test `redundant_pattern_matching`: check if `is_ok` and `is_err` are suggested within const contexts. Also removes the `redundant_pattern_matching_const_result` test, as it is no longer needed.
2020-09-15Fix clippy hard-code slice::Iter pathLzu Tao-1/+1
2020-09-14Add pass names to some common dataflow analysesDylan MacKenzie-0/+1