bors [Mon, 21 Jun 2021 08:27:14 +0000 (08:27 +0000)]
Auto merge of #7380 - popzxc:compile-test-helper, r=flip1995
Improve panic message on "Found multiple rlibs" error in compile-test
Related to #7343
When I first met this error I was pretty much confused, so I thought it may be a good idea to:
- Give a hint on what to do to users that don't want to dig into specifics and just want to quickly resolve the issue.
- Give a link for those who are interested in details.
## Old appearance:
<img width="1121" alt="Screenshot 2021-06-20 at 08 30 34" src="https://user-images.githubusercontent.com/12111581/122663361-df8ae780-d1aa-11eb-9236-775b4fd754d5.png">
## New appearance:
<img width="1121" alt="Screenshot 2021-06-20 at 08 32 18" src="https://user-images.githubusercontent.com/12111581/122663363-e4e83200-d1aa-11eb-9c46-f62d83eb79e2.png">
*Please write a short comment explaining your change (or "none" for internal only changes)*
bors [Sat, 19 Jun 2021 17:56:56 +0000 (17:56 +0000)]
Auto merge of #7299 - DevinR528:macro-brace, r=llogiq
Add macro_braces lint to check for irregular brace use in certain macros
The name is a bit long but this sounds good as `#[allow(unconventional_macro_braces)]` and it seems more clear that we are talking about the macro call not macro definitions, any feedback let me know. Thanks!
fixes #7278
changelog: Add ``[`unconventional_macro_braces`]`` lint that checks for uncommon brace usage with macros.
bors [Tue, 15 Jun 2021 21:44:00 +0000 (21:44 +0000)]
Auto merge of #7352 - camsteffen:metadata-syntax, r=xFrednet
Fix metadata code block syntax highlighting
changelog: none
Fixes code fence block in the metadata collector to change ` ``` ` or ` ```ignore` or ` ```rust,ignore` to ` ```rust`. This makes syntax highlighting work more consistently on the website.
bors [Tue, 15 Jun 2021 15:44:40 +0000 (15:44 +0000)]
Auto merge of #7355 - Pyther99:common-tools-link, r=camsteffen
Fix link in docs
The [docs](https://github.com/rust-lang/rust-clippy/blob/master/doc/common_tools_writing_lints.md) had an incorrect link for "Checking if a type defines a specific method".
bors [Mon, 14 Jun 2021 14:57:56 +0000 (14:57 +0000)]
Auto merge of #7345 - DevinR528:disallowed-fix, r=Manishearth
Remove requirement of fully qualified path for disallowed_method/type
changelog: Remove the need for fully qualified paths in disallowed_method and disallowed_type
After fixing this issue in [import_rename](https://github.com/rust-lang/rust-clippy/pull/7300#discussion_r650127720) I figured I'd fix it for these two.
If this does in fact fix the **Known problems:** section I was planning to remove them from both lints after confirmation.
bors [Fri, 11 Jun 2021 15:58:58 +0000 (15:58 +0000)]
Auto merge of #7160 - flip1995:field_reassign_macros, r=xFrednet,camsteffen
Don't trigger `field_reassign_with_default` in macros
Fixes #7155
Producing a good suggestion for this lint is already hard when no macros
are involved. With macros the lint message and the suggestion are just
confusing. Since both, producing a good suggestion and figuring out if
this pattern can be re-written inside a macro is nearly impossible, just
bail out.
changelog: [`field_reassign_with_default`] No longer triggers in macros
---
No that our reviewing queue is under control, I want to start hacking on Clippy myself again. Starting with an easy issue to get back in :)
bors [Wed, 9 Jun 2021 08:39:56 +0000 (08:39 +0000)]
Auto merge of #7326 - 1c3t3a:1c3t3a-issue-7324, r=flip1995
Fix false positive on `semicolon_if_nothing_returned`
Currently the [`semicolon_if_nothing_returned`](https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned) lint fires in unwanted situations where a block only spans one line. An example of this was given in #7324. This code:
```rust
use std::mem::MaybeUninit;
use std::ptr;
fn main() {
let mut s = MaybeUninit::<String>::uninit();
let _d = || unsafe { ptr::drop_in_place(s.as_mut_ptr()) };
}
```
yields the following clippy error:
```
error: consider adding a `;` to the last statement for consistent formatting
--> src/main.rs:6:26
|
6 | let _d = || unsafe { ptr::drop_in_place(s.as_mut_ptr()) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `ptr::drop_in_place(s.as_mut_ptr());`
|
= note: `-D clippy::semicolon-if-nothing-returned` implied by `-D clippy::pedantic`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
```
I updated the lint to check if the statement is inside an `unsafe` block, a closure or a normal block and if the block only spans one line, in that case the lint is not emitted.
This closes #7324.
changelog: enhanced semicolon if nothing returned according to #7324.
bors [Wed, 9 Jun 2021 08:27:05 +0000 (08:27 +0000)]
Auto merge of #7330 - xFrednet:0000-refactor-map-identity, r=flip1995
Refactoring identity function lints
I've noticed that we have several lints that all check for identity functions and each used their own check implementation. I moved the `is_expr_identity_function` function to `clippy_utils` and adapted all lints to reuse that one function. This should make the addition of new lints like this also easier in the future.
I've also moved the `map_identity` lint into the `methods` module. It's probably the best to review this PR by checking each commit individually. And that's it, have a great day :upside_down_face:
bors [Tue, 1 Jun 2021 00:47:05 +0000 (00:47 +0000)]
Auto merge of #7265 - Jarcho:manual_str_repeat, r=giraffate
Add lint `manual_str_repeat`
fixes: #7260
There's a similar function for slices. Should this be renamed to include it, or should that be a separate lint? If we are going to have them as one lint a better name will be needed. `manual_repeat` isn't exactly clear as it's replacing a call to `iter::repeat`.
bors [Thu, 27 May 2021 17:19:39 +0000 (17:19 +0000)]
Auto merge of #7285 - camsteffen:mini-macro-move, r=flip1995
Move mini-macro to tests/ui/auxilary
changelog: none
Merges `/mini-macro` into `/tests/ui/auxilary/proc_macro_derive.rs`.
The mini-macro crate is an artifact of the distant past. A lot has changed (#2284) and it doesn't make sense as a top-level crate anymore. Especially since we can use the auxilary folder to accompolish the same thing.
bors [Thu, 27 May 2021 04:49:56 +0000 (04:49 +0000)]
Auto merge of #7187 - camsteffen:avoid-break-exported, r=flip1995,phansch
Add avoid_breaking_exported_api config option
changelog: Add `avoid_breaking_exported_api` config option for [`enum_variant_names`], [`large_types_passed_by_value`], [`trivially_copy_pass_by_ref`], [`unnecessary_wraps`], [`upper_case_acronyms`] and [`wrong_self_convention`].
changelog: Deprecates [`pub_enum_variant_names`] and [`wrong_pub_self_convention`] as the non-pub variants are now configurable.
changelog: Fix various false negatives for `pub` items that are not exported from the crate.
A couple changes to late passes in order to use `cx.access_levels.is_exported` rather than `item.vis.kind.is_pub`.
I'm not sure how to better document the config option or lints that are (not) affected (see comments in #6806). Suggestions are welcome. cc `@rust-lang/clippy`
I added `/clippy.toml` to use the config internally and `/tests/clippy.toml` to maintain a default config in ui tests.