profile
viewpoint
Philipp Krones flip1995 Karlsruhe, Germany

CryZe/crates.io 0

Source code for crates.io

flip1995/blog.rust-lang.org 0

The Rust Programming Language Blog

flip1995/book 0

The Rust Programming Language

flip1995/cargo 0

The Rust package manager

flip1995/chrono 0

Date and time library for Rust

flip1995/comprakt 0

the compiler

flip1995/comprakt-fuzz 0

A fuzzer for the MiniJava language

flip1995/core 0

Some boilerplate code used across the @actions-rs Actions

flip1995/crates.io 0

Source code for crates.io

pull request commentrust-lang/rust-clippy

New lint against `Self` as an arbitrary self type

r? @ebroto

wiomoc

comment created time in 4 hours

pull request commentactions-rs/core

Use GitHub Actions cache in installCached

Thanks for the reply! Personal stuff always comes first. :)

flip1995

comment created time in 9 hours

pull request commentrust-lang/rust-clippy

manual_async_fn: take input lifetimes into account

Hijacking this PR to reopen the queue

@bors treeclosed-

ebroto

comment created time in 11 hours

issue commentrust-lang/rust-clippy

Split `missing_docs_in_private_items` into various lints

I think we should not lint at all on definitions inside a function.

jhpratt

comment created time in 13 hours

delete branch flip1995/rust-clippy

delete branch : rollup-5g8vft5

delete time in 13 hours

delete branch flip1995/rust-clippy

delete branch : rustup

delete time in 13 hours

pull request commentrust-lang/rust-clippy

Rollup of 5 pull requests

@bors retry (forgot changlog)

flip1995

comment created time in 13 hours

pull request commentrust-lang/rust-clippy

Rollup of 5 pull requests

@bors r+ p=6

flip1995

comment created time in 13 hours

PR opened rust-lang/rust-clippy

Rollup of 5 pull requests

Successful merges:

  • #5837 (needless_collect: catch x: Vec<_> = iter.collect(); x.into_iter() ...)
  • #5846 (Handle mapping to Option in map_flatten lint)
  • #5848 (Add derive_ord_xor_partial_ord lint)
  • #5852 (Add lint for duplicate methods of trait bounds)
  • #5856 (Remove old Symbol reexport)

Failed merges:

r? @ghost

+770 -67

0 comment

20 changed files

pr created time in 13 hours

push eventflip1995/rust-clippy

Philipp Hansch

commit sha cb00cdf0d77e6a21cd64558f1e373e696f31d301

Remove old Symbol reexport I couldn't really tell what it was meant to improve. It seems more clear without the renaming to `Name`?

view details

Philipp Hansch

commit sha bb6e857980748b000ba3b88d125c6b29aced0693

fmt

view details

Philipp Krones

commit sha fb7ad956f663dc2e54baf95a4fb3e5b76cd73e39

Rollup merge of #5856 - phansch:remove-symbol-reexport, r=flip1995 Remove old Symbol reexport I couldn't really tell what it was meant to improve. It seems more clear without the renaming to `Name`? changelog: none

view details

push time in 13 hours

push eventflip1995/rust-clippy

Christoph Walcher

commit sha 94c50bc8c913ef58eba0f4f10b682dcf6d6e0991

Lint duplicate methods of trait bounds Fixes #5777

view details

Christoph Walcher

commit sha 2b7fde6a4b18ee837342f5b50a4c4941e919177f

typo fix

view details

Christoph Walcher

commit sha e521c67e5f29ddd84e0ce744dfc27a836d349514

early return on empty parameters/where clause

view details

Philipp Krones

commit sha 84455b211f8d9bfdde766ebb2f3240caa66591a4

Rollup merge of #5852 - wiomoc:feature/lint-duplicate-trait, r=Manishearth Add lint for duplicate methods of trait bounds rel: #5777 changelog: Add [`trait_duplication_in_bounds`] lint

view details

push time in 13 hours

push eventflip1995/rust-clippy

Ryan1729

commit sha 5a644964fc05752a1283dab238b81de7583f7d03

run cargo dev new_lint specifically: cargo dev new_lint --name derive_ord_xor_partial_ord --category correctness --pass late

view details

Ryan1729

commit sha fc20ee63a105c0df78113126e8749f5958d7dc47

move derive_ord_xor_partial_ord into derive mod so we can reuse derive_hash_xor_partial_eq code later

view details

Ryan1729

commit sha 0722991b62fd6e4d7d7a51425274f3288bcc96bc

add test for derive_ord_xor_partial_ord based on test for derive_hash_xor_partial_eq

view details

Ryan1729

commit sha 068acbd27b19a4a7be3a9d00954ecfad8a0e6553

initial implementation based on code for `derive_hash_xor_partial_eq` which is showing one error when there should be four

view details

Ryan1729

commit sha a8d6eda93049f0077c1515bec35fe0359ea43f96

use get_trait_def_id to check for Ord trait

view details

Ryan1729

commit sha 6c3e4591b87e6c690b31166867484675dcb1e48c

update reference since we see the expected four errors

view details

Ryan1729

commit sha 7dc974815ec8736f026dc10a070137e0d4601d52

remove is_local check since getting the def_id directly makes it unnecessary

view details

Ryan1729

commit sha 431924ccf69bc4d4f0597f12749e8b1bcb285710

add description for derive_ord_xor_partial_ord

view details

Ryan1729

commit sha 668b7474b47791c8c9af10130356b681b3bf3a84

run cargo dev fmt and fix overly long line

view details

Ryan1729

commit sha ca03f2b650a022d06df6c02c8947a74944815381

s/pord/partial_ord/ to fix dogfood failure

view details

Ryan1729

commit sha 12a6eee045f30785a1eb7572a4cfea3c5cec8a4c

fill in lint description for DERIVE_ORD_XOR_PARTIAL_ORD

view details

Ryan1729

commit sha 94b10a6e5ab003a03b6c7b60ffe5a3b366e0529a

run cargo dev update_lints

view details

Philipp Krones

commit sha 888067c623387d615504f595c097e2da55f6b123

Rollup merge of #5848 - Ryan1729:add-derive_ord_xor_partial_ord-lint, r=matthiaskrgr Add derive_ord_xor_partial_ord lint Fix #1621 Some remarks: This PR follows the example of the analogous derive_hash_xor_partial_eq lint where possible. I initially tried using the `match_path` function to identify `Ord` implementation like the derive_hash_xor_partial_eq lint currently does, for `Hash` implementations but that didn't work. Specifically, the structs at the top level were getting paths that matched `&["$crate", "cmp", "Ord"]` instead of `&["std", "cmp", "Ord"]`. While trying to figure out what to do instead I saw the comment at the top of [clippy_lints/src/utils/paths.rs](https://github.com/rust-lang/rust-clippy/blob/f5d429cd762423901f946abd800dc2cd91366ccf/clippy_lints/src/utils/paths.rs#L5) that mentioned [this issue](https://github.com/rust-lang/rust-clippy/issues/5393) and suggested to use diagnostic items instead of hardcoded paths whenever possible. I looked for a way to identify `Ord` implementations with diagnostic items, but (possibly because this was the first time I had heard of diagnostic items,) I was unable to find one. Eventually I tried using `get_trait_def_id` and comparing `DefId` values directly and that seems to work as expected. Maybe there's a better approach however? changelog: new lint: derive_ord_xor_partial_ord

view details

push time in 13 hours

push eventflip1995/rust-clippy

Dmitry Murzin

commit sha a427c99f3d2a0b2c55d19af73bcad81f1dc761ab

Handle mapping to Option in `map_flatten` lint

view details

Dmitry Murzin

commit sha d4ba561aafb501972f581c1f8e6d1885959f9306

Review fixes

view details

Philipp Krones

commit sha 378ba2e03e192cbf3a416c151c6fe98e69375e25

Rollup merge of #5846 - dima74:map_flatten.map_to_option, r=flip1995 Handle mapping to Option in `map_flatten` lint Fixes #4496 The existing [`map_flatten`](https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten) lint suggests changing `expr.map(...).flatten()` to `expr.flat_map(...)` when `expr` is `Iterator`. This PR changes suggestion to `filter_map` instead of `flat_map` when mapping to `Option`, because it is more natural Also here are some questions: * If expression has type which implements `Iterator` trait (`match_trait_method(cx, expr, &paths::ITERATOR) == true`), how can I get type of iterator elements? Currently I use return type of closure inside `map`, but probably it is not good way * I would like to change suggestion range to cover only `.map(...).flatten()`, that is from: ``` let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| 0..x).flatten().collect(); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using `flat_map` instead: `vec![5_i8; 6].into_iter().flat_map ``` to ``` let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| 0..x).flatten().collect(); ^^^^^^^^^^^^^^^^^^^^^^^^ help: try using `flat_map` instead: `.flat_map(|x| 0..x)` ``` Is it ok? * Is `map_flatten` lint intentionally in `pedantic` category, or could it be moved to `complexity`? changelog: Handle mapping to Option in [`map_flatten`](https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten) lint

view details

push time in 13 hours

push eventflip1995/rust-clippy

JarredAllen

commit sha 05bb6e6bdb1894de5803f729339a631a9222499f

Create test for wanted behavior

view details

JarredAllen

commit sha 3ee61373fe056efb46b6b1b243b31cec0d7e6099

Write the lint and write tests

view details

JarredAllen

commit sha 3657c92ac978f69667b9c8bb46e51bc602b3d7ee

Check for other things which can be used indirectly

view details

JarredAllen

commit sha c86f4109fdd83fef1ea69c0f3c878ace0aa7c56f

Split indirect collects into their own test case

view details

JarredAllen

commit sha a84948329459e650af4eb2f8cff8f55282316ea5

Fix formatting and dogfood fallout

view details

JarredAllen

commit sha bb2c14e92b5a0eafe9c9f43f3a02e33b544b3f91

Fix a bug causing it to be too trigger-happy

view details

JarredAllen

commit sha 5e10b039a3f215b48a54ce7dd38f95115f92e55a

Implement review suggestions

view details

Philipp Krones

commit sha ca2a25d966de0007dea8676833da1c764c9d5e00

Rollup merge of #5837 - JarredAllen:needless_collect, r=phansch needless_collect: catch x: Vec<_> = iter.collect(); x.into_iter() ... changelog: Expand the needless_collect lint as suggested in #5627 (WIP). This PR is WIP because I can't figure out how to make the multi-part suggestion include its changes in the source code (the fixed is identical to the source, despite the lint making suggestions). Aside from that one issue, I think this should be good.

view details

push time in 13 hours

create barnchflip1995/rust-clippy

branch : rollup-5g8vft5

created branch time in 13 hours

delete branch flip1995/rust-clippy

delete branch : rollup-ovtjqh4

delete time in 13 hours

PR closed rust-lang/rust-clippy

Rollup of 6 pull requests

Successful merges:

  • #5725 (should_impl_trait - ignore methods with lifetime params)
  • #5837 (needless_collect: catch x: Vec<_> = iter.collect(); x.into_iter() ...)
  • #5846 (Handle mapping to Option in map_flatten lint)
  • #5848 (Add derive_ord_xor_partial_ord lint)
  • #5852 (Add lint for duplicate methods of trait bounds)
  • #5856 (Remove old Symbol reexport)

Failed merges:

r? @ghost

changelog: rollup

+1443 -196

6 comments

27 changed files

flip1995

pr closed time in 13 hours

pull request commentrust-lang/rust-clippy

should_impl_trait - ignore methods with lifetime params

Please fix the dogfood errors.

montrivo

comment created time in 13 hours

pull request commentrust-lang/rust-clippy

Remove old Symbol reexport

@bors retry

phansch

comment created time in 13 hours

issue commentrust-lang/rust-clippy

eval_order_dependence shouldn't fire for struct initializers

@hellow554 I added the labels. For the instruction on how to fix this, it is a bit more complicated. This is probably a really easy fix, the question is, where it has to be done. You probably have to just add if some_span.from_expansion() { return } somewhere in the linting code. If you are unable to find the place where this should be added, just ping me again and I'll take a look at the code.

CAD97

comment created time in 14 hours

pull request commentrust-lang/rust-clippy

Rollup of 6 pull requests

@bors retry (yeet)

flip1995

comment created time in 14 hours

pull request commentrust-lang/rust-clippy

Rustup

@bors r+ p=10

flip1995

comment created time in 14 hours

PR opened rust-lang/rust-clippy

Rustup

r? @ghost

changelog: none

+21 -21

0 comment

13 changed files

pr created time in 14 hours

push eventflip1995/rust-clippy

Valentin Lazureanu

commit sha aa3d9ca0e9dfe95ed2fc53a381d4559f3bbe9251

Rename HAIR to THIR (Typed HIR).

view details

liuzhenyu

commit sha 24a6130da21ee4c5f0c57ed2e5257b110a7466ce

fix typos

view details

Vadim Petrochenkov

commit sha 52a9c157d04808b61d245c251c223a81ae2dcb70

rustc_ast: `(Nested)MetaItem::check_name` -> `has_name` For consistency with `Attribute::has_name` which doesn't mark the attribute as used either. Replace all uses of `check_name` with `has_name` outside of rustc

view details

push time in 14 hours

push eventflip1995/rust

Guillaume Gomez

commit sha 633d1a5af96db7eccb8aeeb07ff31b06aaf07b5f

Clean up E0720 explanation

view details

Aaron Hill

commit sha ac9dfc3e7785c9bba96ebac4fd51726189e1bf91

Normalize opaque types when converting `ParamEnv` to `Reveal::All` Fixes #65918

view details

Aaron Hill

commit sha 117a60e1f5045e317d3f76ce60be28d18c694608

Erase regions in try_eval_bits

view details

Aaron Hill

commit sha 90aee14eb95ac0b9ddb7cf5db6d003155e94800c

Skip computing param_env and size if not needed

view details

Aaron Hill

commit sha 5e2e927e0107916b825b164c82be44877ac6ab54

Fix rebase fallout

view details

Bastian Kauschke

commit sha 49b1971263971db49e821f81bb54991b7de5ab43

add const generics

view details

Pietro Albini

commit sha cb76f821942053091706b7bb2c4dc416bb09bfb9

ci: avoid symlinking the build directory on self-hosted builders

view details

Pietro Albini

commit sha fe5a40eb14f233554a30c038cf8944b2d2adf9ff

ci: add aarch64-gnu as a fallible auto builder

view details

Guillaume Gomez

commit sha 403164569170e3f5c06db8b66257ac61db7cff4b

Clean up E0728 explanation

view details

Rich Kadel

commit sha 12ddd6073abecb7a515a43bee37408596e322345

Fixed coverage map issues; better aligned with LLVM APIs Found some problems with the coverage map encoding when testing with more than one counter per function. While debugging, I realized some better ways to structure the Rust implementation of the coverage mapping generator. I refactored somewhat, resulting in less code overall, expanded coverage of LLVM Coverage Map capabilities, and much closer alignment with LLVM data structures, APIs, and naming. This should be easier to follow and easier to maintain.

view details

Guillaume Gomez

commit sha 1d2e3fff69b654c3dfd6a810e193db29bb1868fa

Clean up E0730 explanation

view details

Andy Russell

commit sha 0b320086425937b17bda5ee9e856ac6441d71d96

report kind of deprecated item in message This is important for fields, which are incorrectly referred to as "items".

view details

Guillaume Gomez

commit sha f22a34e84d4dba9b17bb3e68051ee82bd85f3c94

Clean up E0734 explanation

view details

Joseph Ryan

commit sha c692ed468c8dc4b9f549ef839b4b490e3b84d19c

Move `Error` and `RenderInfo` out of `html` module

view details

Joseph Ryan

commit sha 5bc97946ca35a789b690668bb6b27ca41bfeb5b2

Refactor html backend to use generic interface

view details

Joseph Ryan

commit sha 6a4396b98c6fcb405429a9798a9ab6554f015b7e

Extract `Cache` and other types from `html` module

view details

Joseph Ryan

commit sha a7909522547cb35b32a4f11b78b2b54864189295

Pull out more types from html

view details

Joseph Ryan

commit sha 65bf5d5248635152262344770591c367ba6a9890

TODO -> FIXME

view details

Joseph Ryan

commit sha 3d707a008e0822471de4adad047b5cefd281f3ac

Make requested changes

view details

Alan Somers

commit sha 013e1a6e9f73125734cb919d9b6220b3a4710d67

Enable the profiler on FreeBSD FreeBSD has been doing this in our own package builds for two months now. https://svnweb.freebsd.org/ports?view=revision&revision=535771

view details

push time in 14 hours

pull request commentrust-lang/rust-clippy

Rollup of 6 pull requests

@bors treeclosed=6

flip1995

comment created time in 14 hours

push eventflip1995/rust-clippy

push time in 14 hours

push eventflip1995/rust-clippy

flip1995

commit sha 0e44ed5ca9b1436c245a4660b04e76fd99be7420

Fix ui-cargo tests in CI

view details

bors

commit sha bbbc973a842fc515f9b22d10d103bbf2d7827697

Auto merge of #5864 - rust-lang:ci_debug, r=Manishearth Fix ui-cargo tests in CI r? @ebroto The `ui-toml` tests set the `CARGO_MANIFEST_DIR` var, but never reset it, so the `ui-cargo` tests used it also and then found a faulty `clippy.toml` file changelog: none

view details

push time in 14 hours

pull request commentrust-lang/rust-clippy

Rollup of 6 pull requests

@bors r+ p=6

flip1995

comment created time in 14 hours

PR opened rust-lang/rust-clippy

Rollup of 6 pull requests

Successful merges:

  • #5725 (should_impl_trait - ignore methods with lifetime params)
  • #5837 (needless_collect: catch x: Vec<_> = iter.collect(); x.into_iter() ...)
  • #5846 (Handle mapping to Option in map_flatten lint)
  • #5848 (Add derive_ord_xor_partial_ord lint)
  • #5852 (Add lint for duplicate methods of trait bounds)
  • #5856 (Remove old Symbol reexport)

Failed merges:

r? @ghost

+1443 -196

0 comment

27 changed files

pr created time in 14 hours

push eventflip1995/rust-clippy

Philipp Hansch

commit sha cb00cdf0d77e6a21cd64558f1e373e696f31d301

Remove old Symbol reexport I couldn't really tell what it was meant to improve. It seems more clear without the renaming to `Name`?

view details

Philipp Hansch

commit sha bb6e857980748b000ba3b88d125c6b29aced0693

fmt

view details

Philipp Krones

commit sha 59e901c430f50bca0b7627acdfcdd9d773549834

Rollup merge of #5856 - phansch:remove-symbol-reexport, r=flip1995 Remove old Symbol reexport I couldn't really tell what it was meant to improve. It seems more clear without the renaming to `Name`? changelog: none

view details

push time in 14 hours

push eventflip1995/rust-clippy

Christoph Walcher

commit sha 94c50bc8c913ef58eba0f4f10b682dcf6d6e0991

Lint duplicate methods of trait bounds Fixes #5777

view details

Christoph Walcher

commit sha 2b7fde6a4b18ee837342f5b50a4c4941e919177f

typo fix

view details

Christoph Walcher

commit sha e521c67e5f29ddd84e0ce744dfc27a836d349514

early return on empty parameters/where clause

view details

Philipp Krones

commit sha 3e89f053946e0bf92de9f60a13cdaecbdc386034

Rollup merge of #5852 - wiomoc:feature/lint-duplicate-trait, r=Manishearth Add lint for duplicate methods of trait bounds rel: #5777 changelog: Add [`trait_duplication_in_bounds`] lint

view details

push time in 14 hours

push eventflip1995/rust-clippy

Ryan1729

commit sha 5a644964fc05752a1283dab238b81de7583f7d03

run cargo dev new_lint specifically: cargo dev new_lint --name derive_ord_xor_partial_ord --category correctness --pass late

view details

Ryan1729

commit sha fc20ee63a105c0df78113126e8749f5958d7dc47

move derive_ord_xor_partial_ord into derive mod so we can reuse derive_hash_xor_partial_eq code later

view details

Ryan1729

commit sha 0722991b62fd6e4d7d7a51425274f3288bcc96bc

add test for derive_ord_xor_partial_ord based on test for derive_hash_xor_partial_eq

view details

Ryan1729

commit sha 068acbd27b19a4a7be3a9d00954ecfad8a0e6553

initial implementation based on code for `derive_hash_xor_partial_eq` which is showing one error when there should be four

view details

Ryan1729

commit sha a8d6eda93049f0077c1515bec35fe0359ea43f96

use get_trait_def_id to check for Ord trait

view details

Ryan1729

commit sha 6c3e4591b87e6c690b31166867484675dcb1e48c

update reference since we see the expected four errors

view details

Ryan1729

commit sha 7dc974815ec8736f026dc10a070137e0d4601d52

remove is_local check since getting the def_id directly makes it unnecessary

view details

Ryan1729

commit sha 431924ccf69bc4d4f0597f12749e8b1bcb285710

add description for derive_ord_xor_partial_ord

view details

Ryan1729

commit sha 668b7474b47791c8c9af10130356b681b3bf3a84

run cargo dev fmt and fix overly long line

view details

Ryan1729

commit sha ca03f2b650a022d06df6c02c8947a74944815381

s/pord/partial_ord/ to fix dogfood failure

view details

Ryan1729

commit sha 12a6eee045f30785a1eb7572a4cfea3c5cec8a4c

fill in lint description for DERIVE_ORD_XOR_PARTIAL_ORD

view details

Ryan1729

commit sha 94b10a6e5ab003a03b6c7b60ffe5a3b366e0529a

run cargo dev update_lints

view details

Philipp Krones

commit sha e2d2e0e3d94fbb7e36f9d7113430c3de31b5a831

Rollup merge of #5848 - Ryan1729:add-derive_ord_xor_partial_ord-lint, r=matthiaskrgr Add derive_ord_xor_partial_ord lint Fix #1621 Some remarks: This PR follows the example of the analogous derive_hash_xor_partial_eq lint where possible. I initially tried using the `match_path` function to identify `Ord` implementation like the derive_hash_xor_partial_eq lint currently does, for `Hash` implementations but that didn't work. Specifically, the structs at the top level were getting paths that matched `&["$crate", "cmp", "Ord"]` instead of `&["std", "cmp", "Ord"]`. While trying to figure out what to do instead I saw the comment at the top of [clippy_lints/src/utils/paths.rs](https://github.com/rust-lang/rust-clippy/blob/f5d429cd762423901f946abd800dc2cd91366ccf/clippy_lints/src/utils/paths.rs#L5) that mentioned [this issue](https://github.com/rust-lang/rust-clippy/issues/5393) and suggested to use diagnostic items instead of hardcoded paths whenever possible. I looked for a way to identify `Ord` implementations with diagnostic items, but (possibly because this was the first time I had heard of diagnostic items,) I was unable to find one. Eventually I tried using `get_trait_def_id` and comparing `DefId` values directly and that seems to work as expected. Maybe there's a better approach however? changelog: new lint: derive_ord_xor_partial_ord

view details

push time in 14 hours

push eventflip1995/rust-clippy

Dmitry Murzin

commit sha a427c99f3d2a0b2c55d19af73bcad81f1dc761ab

Handle mapping to Option in `map_flatten` lint

view details

Dmitry Murzin

commit sha d4ba561aafb501972f581c1f8e6d1885959f9306

Review fixes

view details

Philipp Krones

commit sha 617dc78136d7983486f5d41796f39aeea8afecfe

Rollup merge of #5846 - dima74:map_flatten.map_to_option, r=flip1995 Handle mapping to Option in `map_flatten` lint Fixes #4496 The existing [`map_flatten`](https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten) lint suggests changing `expr.map(...).flatten()` to `expr.flat_map(...)` when `expr` is `Iterator`. This PR changes suggestion to `filter_map` instead of `flat_map` when mapping to `Option`, because it is more natural Also here are some questions: * If expression has type which implements `Iterator` trait (`match_trait_method(cx, expr, &paths::ITERATOR) == true`), how can I get type of iterator elements? Currently I use return type of closure inside `map`, but probably it is not good way * I would like to change suggestion range to cover only `.map(...).flatten()`, that is from: ``` let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| 0..x).flatten().collect(); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try using `flat_map` instead: `vec![5_i8; 6].into_iter().flat_map ``` to ``` let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| 0..x).flatten().collect(); ^^^^^^^^^^^^^^^^^^^^^^^^ help: try using `flat_map` instead: `.flat_map(|x| 0..x)` ``` Is it ok? * Is `map_flatten` lint intentionally in `pedantic` category, or could it be moved to `complexity`? changelog: Handle mapping to Option in [`map_flatten`](https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten) lint

view details

push time in 14 hours

push eventflip1995/rust-clippy

JarredAllen

commit sha 05bb6e6bdb1894de5803f729339a631a9222499f

Create test for wanted behavior

view details

JarredAllen

commit sha 3ee61373fe056efb46b6b1b243b31cec0d7e6099

Write the lint and write tests

view details

JarredAllen

commit sha 3657c92ac978f69667b9c8bb46e51bc602b3d7ee

Check for other things which can be used indirectly

view details

JarredAllen

commit sha c86f4109fdd83fef1ea69c0f3c878ace0aa7c56f

Split indirect collects into their own test case

view details

JarredAllen

commit sha a84948329459e650af4eb2f8cff8f55282316ea5

Fix formatting and dogfood fallout

view details

JarredAllen

commit sha bb2c14e92b5a0eafe9c9f43f3a02e33b544b3f91

Fix a bug causing it to be too trigger-happy

view details

JarredAllen

commit sha 5e10b039a3f215b48a54ce7dd38f95115f92e55a

Implement review suggestions

view details

Philipp Krones

commit sha ed967e6553c11d14b47932b5a4b6342accd9c6be

Rollup merge of #5837 - JarredAllen:needless_collect, r=phansch needless_collect: catch x: Vec<_> = iter.collect(); x.into_iter() ... changelog: Expand the needless_collect lint as suggested in #5627 (WIP). This PR is WIP because I can't figure out how to make the multi-part suggestion include its changes in the source code (the fixed is identical to the source, despite the lint making suggestions). Aside from that one issue, I think this should be good.

view details

push time in 14 hours

push eventflip1995/rust-clippy

Tim Nielens

commit sha c0aa07d67124991fe14f35ac0ba906cde5931c1b

should_impl_trait - ignore methods with lifetime params

view details

Tim Nielens

commit sha 93812c144bd646d22b1ea081377c30ecf3478154

should_implement_trait - add test cases for every checked trait method

view details

Tim Nielens

commit sha f7a73f1527969cf6686ac4e867d8fb0e1a2fef53

should_implement_trait - pr remarks

view details

Tim Nielens

commit sha d7e3f340513d29367ec2599bfc940446d7357e01

should_implement_trait - filter on explicit lifetime param only

view details

Tim Nielens

commit sha 108032e55e91e57c292c818a43544518e26a9bdb

should_impl_trait - pr comments

view details

Philipp Krones

commit sha b008959fe6828dddc5d8ad6796eb915a97d953e2

Rollup merge of #5725 - montrivo:should-impl-trait, r=flip1995,yaahc should_impl_trait - ignore methods with lifetime params Fixes: #5617 changelog: don't lint should_implement_trait when an `Iterator::next` case has explicit parameters

view details

push time in 14 hours

create barnchflip1995/rust-clippy

branch : rollup-ovtjqh4

created branch time in 14 hours

pull request commentrust-lang/rust-clippy

should_impl_trait - ignore methods with lifetime params

@bors r=flip1995,yaahc rollup=always

montrivo

comment created time in 14 hours

pull request commentrust-lang/rust-clippy

needless_collect: catch x: Vec<_> = iter.collect(); x.into_iter() ...

@bors r=phansch rollup=always

JarredAllen

comment created time in 14 hours

pull request commentrust-lang/rust-clippy

Handle mapping to Option in `map_flatten` lint

@bors r+ rollup=always

dima74

comment created time in 14 hours

pull request commentrust-lang/rust-clippy

Add derive_ord_xor_partial_ord lint

@bors retry rollup=always

Ryan1729

comment created time in 14 hours

pull request commentrust-lang/rust-clippy

Add lint for duplicate methods of trait bounds

@bors r=Manishearth rollup=always

wiomoc

comment created time in 14 hours

pull request commentrust-lang/rust-clippy

Remove old Symbol reexport

@bors r+ rollup=always

phansch

comment created time in 14 hours

pull request commentrust-lang/rust-clippy

Stable sort primitive

Needs a cargo dev fmt

JarredAllen

comment created time in 14 hours

delete branch rust-lang/rust-clippy

delete branch : ci_debug

delete time in a day

pull request commentrust-lang/rust-clippy

Add lint for duplicate methods of trait bounds

Blocked on #5864

wiomoc

comment created time in a day

pull request commentrust-lang/rust-clippy

Add lint for duplicate methods of trait bounds

Yeah, I would probably do this by modifying the ast and pretty printing it

wiomoc

comment created time in a day

pull request commentrust-lang/rust-clippy

Add lint for duplicate methods of trait bounds

A nice thing to do here would be to add a suggestion, that can auto-remove those bounds. But this involves some effort, so it should can be done in another PR.

wiomoc

comment created time in a day

PR opened rust-lang/rust-clippy

Fix ui-cargo tests in CI

r? @ebroto

changelog: none

+3 -1

0 comment

1 changed file

pr created time in a day

push eventrust-lang/rust-clippy

flip1995

commit sha 0e44ed5ca9b1436c245a4660b04e76fd99be7420

Fix ui-cargo tests in CI

view details

push time in a day

pull request commentactions-rs/core

Use GitHub Actions cache in installCached

Hey @svartalf, are you still maintaining the projects in the @actions-rs org? It would be great if you could take a look here, or if you don't have time right now, let me know, so I can find another solution, apart from the actions provided here.

flip1995

comment created time in a day

push eventrust-lang/rust-clippy

flip1995

commit sha 24a8a0fdb985943a84b65d5fb2b9619456630386

Debug

view details

push time in a day

create barnchrust-lang/rust-clippy

branch : ci_debug

created branch time in a day

issue closedrust-lang/rust-clippy

wildcard import rule not fired

  • macOS 10.15.6
  •  $ cargo clippy --version
     clippy 0.0.212 (6c8927b0c 2020-07-26)
    
$ cargo new test1
$ cd test1
$ cat > src/main.rs << EOF
use std::cmp::*;

fn main() {
    println!("Hello, world! {:?}", Ordering::Equal);
}
EOF
$ cargo clippy
    Checking test1 v0.1.0 (/private/tmp/test1)
    Finished dev [unoptimized + debuginfo] target(s) in 0.11s

closed time in a day

yihuang

issue commentrust-lang/rust-clippy

wildcard import rule not fired

This lint is in the pedantic group and has, therefore, to be enabled explicitly: Playground

#![warn(clippy::wildcard_imports)]
yihuang

comment created time in a day

delete branch flip1995/rust-clippy

delete branch : basics

delete time in a day

pull request commentrust-lang/rust-clippy

Remove old Symbol reexport

I can't reproduce the ui-toml failure locally... 🤔

phansch

comment created time in 2 days

issue commentrust-lang/rust-clippy

Lint for soft-deprecated `{integer}::max_value` and `min_value`

Ah I see. This may work with https://github.com/rust-lang/rust-clippy/blob/2e0f8b6cc61c1673991120639d6b104a195f755e/clippy_lints/src/utils/mod.rs#L1358

which you can then compare to the def_id of the min_value function. This can be done with

https://github.com/rust-lang/rust-clippy/blob/2e0f8b6cc61c1673991120639d6b104a195f755e/clippy_lints/src/utils/mod.rs#L1184

lzutao

comment created time in 2 days

Pull request review commentrust-lang/rust-clippy

WIP: Fix unwrap not to lint the #[test]ing code

 fn unwrap_result() {     let _ = res.unwrap(); } +// Should not get linted.+#[test]+fn with_test() {

This doesn't get linted, but not because the linting code prevents this. Code marked with #[test] attributes in an UI test file will get removed, before the test is run.

chansuke

comment created time in 2 days

issue commentrust-lang/rust-clippy

Lint for soft-deprecated `{integer}::max_value` and `min_value`

You have to compare the path of the functions. You can search the Clippy codebase for match_qpath to find out how it is used.

lzutao

comment created time in 3 days

pull request commentrust-lang/rust-clippy

should_impl_trait - ignore methods with lifetime params

Please remove the tests/ui/should_impl_trait/corner_cases.stderr file and this should be good to go.

montrivo

comment created time in 4 days

pull request commentrust-lang/rust-clippy

should_impl_trait - ignore methods with lifetime params

Can you put the tests for this lint in its own directory? There's still an issue with undefined structs in the test cases.

montrivo

comment created time in 4 days

issue commentrust-lang/rust-clippy

also lint on items after statements in macros

#![warn(clippy::items_after_statements)]

macro_rules! m {
    () => {{
        f();
        fn f() { println!("Hi"); }
    }};
}

fn main() {
    m!();
}

Does not emit a warning currently: Playground. I don't see a reason, why we shouldn't lint this in local macros.

oli-obk

comment created time in 4 days

Pull request review commentrust-lang/rust-clippy

should_impl_trait - ignore methods with lifetime params

 impl<'tcx> LateLintPass<'tcx> for Methods {              then {                 if cx.access_levels.is_exported(impl_item.hir_id) {-                // check missing trait implementations-                    for &(method_name, n_args, fn_header, self_kind, out_type, trait_name) in &TRAIT_METHODS {-                        if name == method_name &&-                            sig.decl.inputs.len() == n_args &&-                            out_type.matches(cx, &sig.decl.output) &&-                            self_kind.matches(cx, self_ty, first_arg_ty) &&-                            fn_header_equals(*fn_header, sig.header) {+                    // check missing trait implementations+                    for method_config in &TRAIT_METHODS {+                        if name == method_config.method_name &&+                            sig.decl.inputs.len() == method_config.param_count &&+                            method_config.output_type.matches(cx, &sig.decl.output) &&+                            method_config.self_kind.matches(cx, self_ty, first_arg_ty) &&+                            fn_header_equals(*method_config.fn_header, sig.header) &&+                            method_config.lifetime_param_cond(&impl_item)+                        {                             span_lint(cx, SHOULD_IMPLEMENT_TRAIT, impl_item.span, &format!(                                 "defining a method called `{}` on this type; consider implementing \-                                the `{}` trait or choosing a less ambiguous name", name, trait_name));+                                    the `{}` trait or choosing a less ambiguous name",+                                method_config.method_name, method_config.trait_name));

Splitting this up into span_lint_and_help would also be nice!

montrivo

comment created time in 5 days

Pull request review commentrust-lang/rust-clippy

should_impl_trait - ignore methods with lifetime params

+error[E0412]: cannot find type `T` in this scope+  --> $DIR/should_impl_trait__corner_cases.rs:67:53+   |+LL | pub struct T1;

Please define this struct.

montrivo

comment created time in 5 days

Pull request review commentrust-lang/rust-clippy

should_impl_trait - ignore methods with lifetime params

+// edition:2018++#![warn(clippy::all, clippy::pedantic)]+#![allow(+    clippy::missing_errors_doc,+    clippy::needless_pass_by_value,+    clippy::must_use_candidate,+    clippy::unused_self,+    clippy::needless_lifetimes,+    clippy::missing_safety_doc,+    clippy::wrong_self_convention+)]++use std::ops::Mul;+use std::rc::{self, Rc};+use std::sync::{self, Arc};++fn main() {}+pub struct T;++impl T {+    // *******************************************+    // complete trait method list, should lint all+    // *******************************************+    pub fn add(self, other: T) -> T {+        unimplemented!()+    }++    pub fn as_mut(&mut self) -> &mut T {+        unimplemented!()+    }++    pub fn as_ref(&self) -> &T {+        unimplemented!()+    }++    pub fn bitand(self, rhs: T) -> T {+        unimplemented!()+    }++    pub fn bitor(self, rhs: Self) -> Self {+        unimplemented!()+    }++    pub fn bitxor(self, rhs: Self) -> Self {+        unimplemented!()+    }++    pub fn borrow(&self) -> &str {+        unimplemented!()+    }++    pub fn borrow_mut(&mut self) -> &mut str {+        unimplemented!()+    }++    pub fn clone(&self) -> Self {+        unimplemented!()+    }++    pub fn cmp(&self, other: &Self) -> Self {+        unimplemented!()+    }++    pub fn default() -> Self {+        unimplemented!()+    }++    pub fn deref(&self) -> &Self {+        unimplemented!()+    }++    pub fn deref_mut(&mut self) -> &mut Self {+        unimplemented!()+    }++    pub fn div(self, rhs: Self) -> Self {+        unimplemented!()+    }++    pub fn drop(&mut self) {+        unimplemented!()+    }++    pub fn eq(&self, other: &Self) -> bool {+        unimplemented!()+    }++    pub fn from_iter<T>(iter: T) -> Self {+        unimplemented!()+    }++    pub fn from_str(s: &str) -> Result<Self, Self> {+        unimplemented!()+    }++    pub fn hash(&self, state: &mut T) {+        unimplemented!()+    }++    pub fn index(&self, index: usize) -> &Self {+        unimplemented!()+    }++    pub fn index_mut(&mut self, index: usize) -> &mut Self {+        unimplemented!()+    }++    pub fn into_iter(self) -> Self {+        unimplemented!()+    }++    pub fn mul(self, rhs: Self) -> Self {+        unimplemented!()+    }++    pub fn neg(self) -> Self {+        unimplemented!()+    }++    pub fn next(&mut self) -> Option<Self> {+        unimplemented!()+    }++    pub fn not(self) -> Self {+        unimplemented!()+    }++    pub fn rem(self, rhs: Self) -> Self {+        unimplemented!()+    }++    pub fn shl(self, rhs: Self) -> Self {+        unimplemented!()+    }++    pub fn shr(self, rhs: Self) -> Self {+        unimplemented!()+    }++    pub fn sub(self, rhs: Self) -> Self {

You can split up the test files for bin-/un-ops and the rest.

montrivo

comment created time in 5 days

Pull request review commentrust-lang/rust-clippy

should_impl_trait - ignore methods with lifetime params

 use std::sync::{self, Arc};  use option_helpers::IteratorFalsePositives; -pub struct T;

You have to keep this struct for later in this test file.

montrivo

comment created time in 5 days

Pull request review commentrust-lang/rust-clippy

Don't use `to_string` in impl Display

+error: Using to_string in fmt::Display implementation might lead to infinite recursion+  --> $DIR/to_string_in_display.rs:24:25+   |+LL |         write!(f, "{}", self.to_string())+   |                         ^^^^^^^^^^^^^^^^+   |+   = note: `-D clippy::to-string-in-display` implied by `-D warnings`++error: type `C` implements inherent method `to_string(&self) -> String` which shadows the implementation of `Display`+  --> $DIR/to_string_in_display.rs:35:5+   |+LL | /     pub fn to_string(&self) -> String {+LL | |         "I am C".to_string()+LL | |     }+   | |_____^+   |+   = note: `#[deny(clippy::inherent_to_string_shadow_display)]` on by default+   = help: remove the inherent method from type `C`++error: Using to_string in fmt::Display implementation might lead to infinite recursion+  --> $DIR/to_string_in_display.rs:42:25+   |+LL |         write!(f, "{}", self.to_string())

You have to check if the method is from the ToString trait. You can use code similar to https://github.com/rust-lang/rust-clippy/blob/799eef691969c2f6ecf33359f0b1e1691a060648/clippy_lints/src/loops.rs#L545-L546

for this.

  • next -> to_string
  • match_expr -> expr
  • ITERATOR -> TO_STRING
chansuke

comment created time in 5 days

Pull request review commentrust-lang/rust-clippy

Handle mapping to Option in `map_flatten` lint

 fn lint_ok_expect(cx: &LateContext<'_>, expr: &hir::Expr<'_>, ok_args: &[hir::Ex fn lint_map_flatten<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>, map_args: &'tcx [hir::Expr<'_>]) {     // lint if caller of `.map().flatten()` is an Iterator     if match_trait_method(cx, expr, &paths::ITERATOR) {-        let msg = "called `map(..).flatten()` on an `Iterator`. \-                    This is more succinctly expressed by calling `.flat_map(..)`";-        let self_snippet = snippet(cx, map_args[0].span, "..");+        let map_closure_ty = cx.typeck_results().expr_ty(&map_args[1]);+        let is_map_to_option = match map_closure_ty.kind {+            ty::Closure(_, _) | ty::FnDef(_, _) | ty::FnPtr(_) => {+                let map_closure_sig = match map_closure_ty.kind {+                    ty::Closure(_, substs) => substs.as_closure().sig(),+                    _ => map_closure_ty.fn_sig(cx.tcx),+                };+                let map_closure_return_ty = cx.tcx.erase_late_bound_regions(&map_closure_sig.output());+                is_type_diagnostic_item(cx, map_closure_return_ty, sym!(option_type))+            },+            _ => false,+        };++        let method_to_use = if is_map_to_option {+            // `(...).map(...)` has type `impl Iterator<Item=Option<...>>+            "filter_map"+        } else {+            // `(...).map(...)` has type `impl Iterator<Item=impl Iterator<...>>+            "flat_map"+        };+        let msg = "called `map(..).flatten()` on an `Iterator`";

Binding this isn't necessary anymore.

dima74

comment created time in 5 days

Pull request review commentrust-lang/rust-clippy

Handle mapping to Option in `map_flatten` lint

 fn lint_ok_expect(cx: &LateContext<'_>, expr: &hir::Expr<'_>, ok_args: &[hir::Ex fn lint_map_flatten<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>, map_args: &'tcx [hir::Expr<'_>]) {     // lint if caller of `.map().flatten()` is an Iterator     if match_trait_method(cx, expr, &paths::ITERATOR) {-        let msg = "called `map(..).flatten()` on an `Iterator`. \-                    This is more succinctly expressed by calling `.flat_map(..)`";-        let self_snippet = snippet(cx, map_args[0].span, "..");+        let map_closure_ty = cx.typeck_results().expr_ty(&map_args[1]);+        let is_map_to_option = match map_closure_ty.kind {+            ty::Closure(_, _) | ty::FnDef(_, _) | ty::FnPtr(_) => {+                let map_closure_sig = match map_closure_ty.kind {+                    ty::Closure(_, substs) => substs.as_closure().sig(),+                    _ => map_closure_ty.fn_sig(cx.tcx),+                };+                let map_closure_return_ty = cx.tcx.erase_late_bound_regions(&map_closure_sig.output());+                is_type_diagnostic_item(cx, map_closure_return_ty, sym!(option_type))+            },+            _ => false,+        };++        let method_to_use = if is_map_to_option {+            // `(...).map(...)` has type `impl Iterator<Item=Option<...>>+            "filter_map"+        } else {+            // `(...).map(...)` has type `impl Iterator<Item=impl Iterator<...>>+            "flat_map"+        };+        let msg = "called `map(..).flatten()` on an `Iterator`";         let func_snippet = snippet(cx, map_args[1].span, "..");-        let hint = format!("{0}.flat_map({1})", self_snippet, func_snippet);+        let hint = format!(".{0}({1})", method_to_use, func_snippet);         span_lint_and_sugg(             cx,             MAP_FLATTEN,-            expr.span,+            expr.span.trim_start(map_args[0].span).unwrap(),             msg,-            "try using `flat_map` instead",+            &format!("try using `{}` instead", method_to_use),             hint,             Applicability::MachineApplicable,         );     }      // lint if caller of `.map().flatten()` is an Option     if is_type_diagnostic_item(cx, cx.typeck_results().expr_ty(&map_args[0]), sym!(option_type)) {-        let msg = "called `map(..).flatten()` on an `Option`. \-                    This is more succinctly expressed by calling `.and_then(..)`";-        let self_snippet = snippet(cx, map_args[0].span, "..");+        let msg = "called `map(..).flatten()` on an `Option`";         let func_snippet = snippet(cx, map_args[1].span, "..");-        let hint = format!("{0}.and_then({1})", self_snippet, func_snippet);+        let hint = format!(".and_then({})", func_snippet);         span_lint_and_sugg(             cx,             MAP_FLATTEN,-            expr.span,+            expr.span.trim_start(map_args[0].span).unwrap(),

I would prefer, if you use map_args[0].span.to_hi(expr.span.hi()). That way, no unwrap is necessary.

dima74

comment created time in 5 days

push eventflip1995/rust-clippy

flip1995

commit sha 51f2a6f8b6eea9ebefddff39e87a1ca16c59827c

Add documentation for basic Clippy hacking

view details

flip1995

commit sha 17903f6d7107c6d31ee15f4c46af29d1f4aa363f

Mention lint naming guidelines earlier

view details

flip1995

commit sha 3a4cc9f7f085e73fbfe57e8c896b90a5fe61c4f4

Address review comments

view details

Dmitry Murzin

commit sha b375f1dd20bf07175ec06d13e1e9dc8b20287cd3

Add suggestion for `iter_skip_next` lint

view details

flip1995

commit sha d164ab65f706540f0132268c8ad2237d2e53e08a

Merge commit 'da5a6fb1b65ec6581a67e942a3850f6bc15a552c' into clippyup

view details

Bastian Kauschke

commit sha dfa1af20598da8eaeab979e3f38ad2c2cd80f719

clippy

view details

Bastian Kauschke

commit sha 88787083f43edc49cfa9c9e6191372fbad323791

this might be unqualified, but at least it's now quantified

view details

Bastian Kauschke

commit sha 6ce37fab95ddd9ac8716ae96dc2f86251a8c4a61

introduce PredicateAtom

view details

Bastian Kauschke

commit sha 133e1d677333fe683a75fac6d6344e7073fb96af

clippy

view details

flip1995

commit sha 04f44717614cdd5afd4cb0d47fe694a8f0ae1e2b

Merge remote-tracking branch 'upstream/master' into rustup

view details

bors

commit sha 61eab6e8f9a1f0862aa15e18a939bbcf82affc9a

Auto merge of #5853 - flip1995:rustup, r=flip1995 Rustup r? @ghost changelog: none

view details

bors

commit sha 73764ab8cdea2954927e30e9ed48481f159db1ff

Auto merge of #5840 - flip1995:basics, r=phansch Basic instruction for new contributors While answering a few questions to @AB1908, I realized, that our documentation could use some love. Especially the "Getting Started" part for new contributors. So I wrote together some instruction on how to get the toolchain and how to build and test Clippy. [Rendered](https://github.com/flip1995/rust-clippy/blob/basics/doc/basics.md) r? @phansch changelog: none

view details

bors

commit sha 2e0f8b6cc61c1673991120639d6b104a195f755e

Auto merge of #5843 - dima74:iter_skip_next.add-suggestion, r=phansch Add suggestion for `iter_skip_next` lint changelog: Add suggestion for [`iter_skip_next`](https://rust-lang.github.io/rust-clippy/master/index.html#iter_skip_next) lint

view details

push time in 5 days

issue commentrust-lang/rust-clippy

.min(x).max(y) with x < y

I would go for changing the order of the functions in that case. That way, we can guarantee to always emit a semantic equivalent suggestion.

JarredAllen

comment created time in 5 days

issue commentrust-lang/rust-clippy

.min(x).max(y) with x < y

Should the suggestion be to swap the min and max functions or to swap their arguments (i.e. -1.0/1.0)? I'm leaning towards the latter.

JarredAllen

comment created time in 6 days

issue commentrust-lang/rust-clippy

Lint doc comments on private items

See also #5736

llogiq

comment created time in 6 days

issue closedrust-lang/rust-clippy

needless_range_loop suggests using iter on a value that do not have iter method

In this example:

use std::ops::Index;

struct S(Vec<u32>);

impl Index<usize> for S {
    type Output = u32;

    fn index(&self, index: usize) -> &u32 {
        &self.0[index]
    }
}

fn main() {
    let s = S(vec![1, 2, 3]);

    for i in 0..3 {
        println!("{:?}", s[i]);
    }
}

Clippy says "Consider using for item in s.iter().take(3), but s does not have iter method.

closed time in 6 days

malbarbo

issue commentrust-lang/rust-clippy

False positive with temporary_cstring_as_ptr

See also this comment: https://github.com/rust-lang/rust-clippy/issues/4375#issuecomment-534262514

The CString is dropped after the function call. This can be seen, when looking at the MIR of the above example (bb8+bb9, _8 is the CString)

<details> <summary>MIR output</summary>

// WARNING: This output format is intended for human consumers only
// and is subject to change without notice. Knock yourself out.
fn uaf(_1: &str) -> () {
    debug server_name => _1;             // in scope 0 at src/lib.rs:5:12: 5:23
    let mut _0: ();                      // return place in scope 0 at src/lib.rs:5:31: 5:31
    let _3: ();                          // in scope 0 at src/lib.rs:10:9: 10:60
    let mut _4: *const i8;               // in scope 0 at src/lib.rs:10:16: 10:59
    let mut _5: &std::ffi::CStr;         // in scope 0 at src/lib.rs:10:16: 10:50
    let _6: &std::ffi::CStr;             // in scope 0 at src/lib.rs:10:16: 10:50
    let mut _7: &std::ffi::CString;      // in scope 0 at src/lib.rs:10:16: 10:50
    let _8: std::ffi::CString;           // in scope 0 at src/lib.rs:10:16: 10:50
    let mut _9: std::result::Result<std::ffi::CString, std::ffi::NulError>; // in scope 0 at src/lib.rs:10:16: 10:41
    let mut _10: &str;                   // in scope 0 at src/lib.rs:10:29: 10:40
    scope 1 {
        let _2: std::string::String;     // in scope 1 at src/lib.rs:9:13: 9:14
        scope 2 {
            debug x => _2;               // in scope 2 at src/lib.rs:9:13: 9:14
            let _11: std::string::String; // in scope 2 at src/lib.rs:12:13: 12:14
            scope 3 {
                debug y => _11;          // in scope 3 at src/lib.rs:12:13: 12:14
            }
        }
    }

    bb0: {
        StorageLive(_2);                 // scope 1 at src/lib.rs:9:13: 9:14
        _2 = const <std::string::String as std::convert::From<&str>>::from(const "abc") -> bb2; // scope 1 at src/lib.rs:9:17: 9:36
                                         // ty::Const
                                         // + ty: fn(&str) -> std::string::String {<std::string::String as std::convert::From<&str>>::from}
                                         // + val: Value(Scalar(<ZST>))
                                         // mir::Constant
                                         // + span: src/lib.rs:9:17: 9:29
                                         // + user_ty: UserType(0)
                                         // + literal: Const { ty: fn(&str) -> std::string::String {<std::string::String as std::convert::From<&str>>::from}, val: Value(Scalar(<ZST>)) }
                                         // ty::Const
                                         // + ty: &str
                                         // + val: Value(Slice { data: Allocation { bytes: [97, 98, 99], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [7], len: Size { raw: 3 } }, size: Size { raw: 3 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 3 })
                                         // mir::Constant
                                         // + span: src/lib.rs:9:30: 9:35
                                         // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [97, 98, 99], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [7], len: Size { raw: 3 } }, size: Size { raw: 3 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 3 }) }
    }

    bb1 (cleanup): {
        resume;                          // scope 0 at src/lib.rs:5:1: 15:2
    }

    bb2: {
        StorageLive(_3);                 // scope 2 at src/lib.rs:10:9: 10:60
        StorageLive(_4);                 // scope 2 at src/lib.rs:10:16: 10:59
        StorageLive(_5);                 // scope 2 at src/lib.rs:10:16: 10:50
        StorageLive(_6);                 // scope 2 at src/lib.rs:10:16: 10:50
        StorageLive(_7);                 // scope 2 at src/lib.rs:10:16: 10:50
        StorageLive(_8);                 // scope 2 at src/lib.rs:10:16: 10:50
        StorageLive(_9);                 // scope 2 at src/lib.rs:10:16: 10:41
        StorageLive(_10);                // scope 2 at src/lib.rs:10:29: 10:40
        _10 = _1;                        // scope 2 at src/lib.rs:10:29: 10:40
        _9 = const std::ffi::CString::new::<&str>(move _10) -> [return: bb3, unwind: bb4]; // scope 2 at src/lib.rs:10:16: 10:41
                                         // ty::Const
                                         // + ty: fn(&str) -> std::result::Result<std::ffi::CString, std::ffi::NulError> {std::ffi::CString::new::<&str>}
                                         // + val: Value(Scalar(<ZST>))
                                         // mir::Constant
                                         // + span: src/lib.rs:10:16: 10:28
                                         // + user_ty: UserType(1)
                                         // + literal: Const { ty: fn(&str) -> std::result::Result<std::ffi::CString, std::ffi::NulError> {std::ffi::CString::new::<&str>}, val: Value(Scalar(<ZST>)) }
    }

    bb3: {
        StorageDead(_10);                // scope 2 at src/lib.rs:10:40: 10:41
        _8 = const std::result::Result::<std::ffi::CString, std::ffi::NulError>::unwrap(move _9) -> [return: bb5, unwind: bb4]; // scope 2 at src/lib.rs:10:16: 10:50
                                         // ty::Const
                                         // + ty: fn(std::result::Result<std::ffi::CString, std::ffi::NulError>) -> std::ffi::CString {std::result::Result::<std::ffi::CString, std::ffi::NulError>::unwrap}
                                         // + val: Value(Scalar(<ZST>))
                                         // mir::Constant
                                         // + span: src/lib.rs:10:42: 10:48
                                         // + literal: Const { ty: fn(std::result::Result<std::ffi::CString, std::ffi::NulError>) -> std::ffi::CString {std::result::Result::<std::ffi::CString, std::ffi::NulError>::unwrap}, val: Value(Scalar(<ZST>)) }
    }

    bb4 (cleanup): {
        drop(_2) -> bb1;                 // scope 1 at src/lib.rs:14:5: 14:6
    }

    bb5: {
        _7 = &_8;                        // scope 2 at src/lib.rs:10:16: 10:50
        _6 = const <std::ffi::CString as std::ops::Deref>::deref(move _7) -> [return: bb6, unwind: bb7]; // scope 2 at src/lib.rs:10:16: 10:50
                                         // ty::Const
                                         // + ty: for<'r> fn(&'r std::ffi::CString) -> &'r <std::ffi::CString as std::ops::Deref>::Target {<std::ffi::CString as std::ops::Deref>::deref}
                                         // + val: Value(Scalar(<ZST>))
                                         // mir::Constant
                                         // + span: src/lib.rs:10:16: 10:50
                                         // + literal: Const { ty: for<'r> fn(&'r std::ffi::CString) -> &'r <std::ffi::CString as std::ops::Deref>::Target {<std::ffi::CString as std::ops::Deref>::deref}, val: Value(Scalar(<ZST>)) }
    }

    bb6: {
        _5 = _6;                         // scope 2 at src/lib.rs:10:16: 10:50
        StorageDead(_9);                 // scope 2 at src/lib.rs:10:49: 10:50
        StorageDead(_7);                 // scope 2 at src/lib.rs:10:49: 10:50
        _4 = const std::ffi::CStr::as_ptr(move _5) -> [return: bb8, unwind: bb7]; // scope 2 at src/lib.rs:10:16: 10:59
                                         // ty::Const
                                         // + ty: for<'r> fn(&'r std::ffi::CStr) -> *const i8 {std::ffi::CStr::as_ptr}
                                         // + val: Value(Scalar(<ZST>))
                                         // mir::Constant
                                         // + span: src/lib.rs:10:51: 10:57
                                         // + literal: Const { ty: for<'r> fn(&'r std::ffi::CStr) -> *const i8 {std::ffi::CStr::as_ptr}, val: Value(Scalar(<ZST>)) }
    }

    bb7 (cleanup): {
        drop(_8) -> bb4;                 // scope 2 at src/lib.rs:10:60: 10:61
    }

    bb8: {
        StorageDead(_5);                 // scope 2 at src/lib.rs:10:58: 10:59
        _3 = const strcpy(move _4) -> [return: bb9, unwind: bb7]; // scope 2 at src/lib.rs:10:9: 10:60
                                         // ty::Const
                                         // + ty: unsafe extern "C" fn(*const i8) {strcpy}
                                         // + val: Value(Scalar(<ZST>))
                                         // mir::Constant
                                         // + span: src/lib.rs:10:9: 10:15
                                         // + literal: Const { ty: unsafe extern "C" fn(*const i8) {strcpy}, val: Value(Scalar(<ZST>)) }
    }

    bb9: {
        StorageDead(_4);                 // scope 2 at src/lib.rs:10:59: 10:60
        drop(_8) -> [return: bb10, unwind: bb4]; // scope 2 at src/lib.rs:10:60: 10:61
    }

    bb10: {
        StorageDead(_8);                 // scope 2 at src/lib.rs:10:60: 10:61
        StorageDead(_6);                 // scope 2 at src/lib.rs:10:60: 10:61
        StorageDead(_3);                 // scope 2 at src/lib.rs:10:60: 10:61
        StorageLive(_11);                // scope 2 at src/lib.rs:12:13: 12:14
        _11 = const <std::string::String as std::convert::From<&str>>::from(const "def") -> [return: bb11, unwind: bb4]; // scope 2 at src/lib.rs:12:17: 12:36
                                         // ty::Const
                                         // + ty: fn(&str) -> std::string::String {<std::string::String as std::convert::From<&str>>::from}
                                         // + val: Value(Scalar(<ZST>))
                                         // mir::Constant
                                         // + span: src/lib.rs:12:17: 12:29
                                         // + user_ty: UserType(2)
                                         // + literal: Const { ty: fn(&str) -> std::string::String {<std::string::String as std::convert::From<&str>>::from}, val: Value(Scalar(<ZST>)) }
                                         // ty::Const
                                         // + ty: &str
                                         // + val: Value(Slice { data: Allocation { bytes: [100, 101, 102], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [7], len: Size { raw: 3 } }, size: Size { raw: 3 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 3 })
                                         // mir::Constant
                                         // + span: src/lib.rs:12:30: 12:35
                                         // + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [100, 101, 102], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [7], len: Size { raw: 3 } }, size: Size { raw: 3 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 3 }) }
    }

    bb11: {
        _0 = const ();                   // scope 1 at src/lib.rs:8:5: 14:6
                                         // ty::Const
                                         // + ty: ()
                                         // + val: Value(Scalar(<ZST>))
                                         // mir::Constant
                                         // + span: src/lib.rs:8:5: 14:6
                                         // + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
        drop(_11) -> [return: bb12, unwind: bb4]; // scope 2 at src/lib.rs:14:5: 14:6
    }

    bb12: {
        StorageDead(_11);                // scope 2 at src/lib.rs:14:5: 14:6
        drop(_2) -> bb13;                // scope 1 at src/lib.rs:14:5: 14:6
    }

    bb13: {
        StorageDead(_2);                 // scope 1 at src/lib.rs:14:5: 14:6
        return;                          // scope 0 at src/lib.rs:15:2: 15:2
    }
}

</details>

kangalioo

comment created time in 6 days

issue closedrust-lang/rust-clippy

Notice unused code in a workspace

What it does

A lot of projects have a workspace with multiple crates. This means that they will define most of their types as pub instead of pub(crate). However this means that all crates are libraries and thus cargo won't warn you for unused code within the crate.

So it would be useful if we'd have a way to find unused code within a workspace instead of just within a crate.

Categories (optional)

  • Kind: clippy::nursery

Drawbacks

Could point out unused code in some crates that are intended for usage outside the workspace.

closed time in 6 days

stevenroose

issue commentrust-lang/rust-clippy

Notice unused code in a workspace

This is impossible to do for Clippy, since it would require a global analysis.

In addition to that, Clippy (also cargo and rustc) can't know, if a pub function is unused, since there could be some other crate out there, not in the workspace, that uses this pub function.

stevenroose

comment created time in 6 days

Pull request review commentrust-lang/rust-clippy

Handle mapping to Option in `map_flatten` lint

 #![allow(clippy::map_identity)]  fn main() {+    let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| x.checked_add(1)).flatten().collect();

Please also add a test for a closure like

/*...*/.map(option_id).flatten()

fn option_id(x: i8) -> Option<i8> { Some(x) }
dima74

comment created time in 6 days

Pull request review commentrust-lang/rust-clippy

Handle mapping to Option in `map_flatten` lint

 #![allow(clippy::map_identity)]  fn main() {+    let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| x.checked_add(1)).flatten().collect();     let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| 0..x).flatten().collect();     let _: Option<_> = (Some(Some(1))).map(|x| x).flatten();

Oh nvm. I misunderstood the issue

dima74

comment created time in 6 days

Pull request review commentrust-lang/rust-clippy

Handle mapping to Option in `map_flatten` lint

 #![allow(clippy::map_identity)]  fn main() {+    let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| x.checked_add(1)).flatten().collect();     let _: Vec<_> = vec![5_i8; 6].into_iter().map(|x| 0..x).flatten().collect();     let _: Option<_> = (Some(Some(1))).map(|x| x).flatten();

Also add a test for Result please.

dima74

comment created time in 7 days

Pull request review commentrust-lang/rust-clippy

Handle mapping to Option in `map_flatten` lint

 fn lint_ok_expect(cx: &LateContext<'_>, expr: &hir::Expr<'_>, ok_args: &[hir::Ex fn lint_map_flatten<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>, map_args: &'tcx [hir::Expr<'_>]) {     // lint if caller of `.map().flatten()` is an Iterator     if match_trait_method(cx, expr, &paths::ITERATOR) {-        let msg = "called `map(..).flatten()` on an `Iterator`. \-                    This is more succinctly expressed by calling `.flat_map(..)`";+        let map_closure_ty = cx.typeck_results().expr_ty(&map_args[1]);+        let is_map_to_option = if let ty::Closure(_def_id, substs) = map_closure_ty.kind {

Mapping to an option is only possible, if the original type was an option. So you want to check the type of map_args[0] to find out, if it is an Option. Same goes for Result.

dima74

comment created time in 7 days

Pull request review commentrust-lang/rust-clippy

Handle mapping to Option in `map_flatten` lint

 fn lint_ok_expect(cx: &LateContext<'_>, expr: &hir::Expr<'_>, ok_args: &[hir::Ex fn lint_map_flatten<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>, map_args: &'tcx [hir::Expr<'_>]) {     // lint if caller of `.map().flatten()` is an Iterator     if match_trait_method(cx, expr, &paths::ITERATOR) {-        let msg = "called `map(..).flatten()` on an `Iterator`. \-                    This is more succinctly expressed by calling `.flat_map(..)`";+        let map_closure_ty = cx.typeck_results().expr_ty(&map_args[1]);+        let is_map_to_option = if let ty::Closure(_def_id, substs) = map_closure_ty.kind {+            let map_closure_return_ty = cx.tcx.erase_late_bound_regions(&substs.as_closure().sig().output());+            is_type_diagnostic_item(cx, map_closure_return_ty, sym!(option_type))+        } else {+            false+        };++        let method_to_use = if is_map_to_option {+            // `(...).map(...)` has type `impl Iterator<Item=Option<...>>+            "filter_map"+        } else {+            // `(...).map(...)` has type `impl Iterator<Item=impl Iterator<...>>+            "flat_map"+        };+        let msg = &format!(+            "called `map(..).flatten()` on an `Iterator`. \+                   This is more succinctly expressed by calling `.{}(..)`",+            method_to_use+        );

I think you can drop the second part of this message, since this is also in the suggestion message.

        let msg = "called `map(..).flatten()` on an `Iterator`";

Also you can change Iterator to Option or Result, if the mapped type is one of those.

dima74

comment created time in 7 days

pull request commentrust-lang/rust-clippy

Rustup

@bors r+ p=1

flip1995

comment created time in 7 days

push eventflip1995/rust-clippy

rail

commit sha ad9ad6f402e3e15706519e59ef111a941d28d5af

Don't negate resulted offsets when `offset` is subtraction by 0

view details

rail

commit sha 37261a904ce2fbd4137180500c57f75f29945828

Print 0 when `end` and `offset` is 0, and also simplify the suggestion

view details

rail

commit sha 75ad839cd26c1da17fe6ba3aae1153ee96de26c8

Do not trigger `manual_memcpy` for `RangeTo`

view details

rail

commit sha c94f0f49f8e025aae11534f9f2b4c59c34b1edb8

Remove all `ref` keyword

view details

rail

commit sha 7dd0f3459f558c1b557223a042f549b378cacae9

Refactor `if` to use `else` and iterator combinators

view details

rail

commit sha 3f1e51b3f4a7bfb42c442caf2cb836ba62e2ba53

Rename `negate` to `sign` and make it strong types then make `art1` &str

view details

rail

commit sha ecb472c052c746d87ce26f6b184f2c5f11537e0c

Use `fn` instead of closures where unnecessary

view details

rail

commit sha aab80eedf3e271ada92a6509727461cc3aa6bb12

Extract `get_fixed_offset_var`` from `fetch_cloned_fixed_offset_var`

view details

rail

commit sha 3d121d53af9a73ba11226715cd8132f6981ffee9

Extract roles getting indexes from `get_indexed_assignments`

view details

rail

commit sha 4f2617c059f693ec72e5d31ad31fd85eba019ab1

Separate getting offsets and getting index expressions

view details

rail

commit sha 9fc6f37778789de94caa280f41afdf651bf5ae10

Delay getting the snippet from slices

view details

rail

commit sha 582614fbbe76fed1b06feb640229b71a1886ffd7

Extract building the suggestion of `manual_memcpy`

view details

rail

commit sha be9f7c2b6d99dfb259eec8e9e2f7d9b9685de226

Merge branch 'master' into fix_manual_memcpy

view details

rail

commit sha 51585a129892f42eb23b0b37fea0e729f6678994

Removed unused lifetimes and a needless bool

view details

Stanislav Tkach

commit sha 1afb6e6e3b23bd5555f34cc4dcd20349dfd789de

Extend example for the `unneeded_field_pattern` lint Current example is incorrect (or pseudo-code) because a struct name is omitted. I have used the code from the tests instead. Perhaps this example can be made less verbose, but I think it is more convenient to see a "real" code as an example.

view details

rail

commit sha 461f4a34660691675434a318ac4fd61a83444428

Add missing tests

view details

Eduardo Broto

commit sha f072ded3bf6286668ff8eade5b58e471dbe66f2a

Implement the manual_non_exhaustive lint

view details

Eduardo Broto

commit sha 42b0b4754c881101cefb0307c489d6159c19b2f3

Apply suggestions from PR review

view details

flip1995

commit sha 10e3f9bdb854e3cabbc4fda69ed713388344d524

Move match_on_vec_items to pedantic

view details

ebroto

commit sha 350c17de24c0bc7ee1b17981fe02f88ca6ec50a4

Use the only variant left instead of a wildcard Co-authored-by: Philipp Krones <hello@philkrones.com>

view details

push time in 7 days

PR opened rust-lang/rust-clippy

Rustup

r? @ghost

changelog: none

+22 -29

0 comment

5 changed files

pr created time in 7 days

create barnchflip1995/rust-clippy

branch : rustup

created branch time in 7 days

push eventflip1995/rust

flip1995

commit sha f7acea2683c6124854bfe20e7127e4dfba344d3e

Register redundant_field_names and non_expressive_names as early passes

view details

flip1995

commit sha 485229c4a3d6a2fbe40f5a6976a33144a27497c6

Fix fallout in redundant_field_names

view details

flip1995

commit sha efd3dcff97f67f376e354c047133ce9044c52991

Fix fallout in similar_names

view details

Eduardo Broto

commit sha bb37a0f948b02e6434dbe3ea615960052d37f784

Avoid triggering similar names on code from expansion

view details

Trevor Spiteri

commit sha 6dfe144bdd4413ac55cbb2ad2edfb1daa0c4bf15

stabilize const_nonzero_int_methods

view details

Trevor Spiteri

commit sha 9739b512a892628534e730ffcd9756b3218c8de8

stabilize some const_checked_int_methods

view details

Trevor Spiteri

commit sha c1c674c2dbfe3f6dc47d11368c1b5ee4ab008799

stabilize const_saturating_int_methods

view details

Trevor Spiteri

commit sha 056d925167318636fcf975c8ffb81efebdc9bca3

stabilize const_int_sign

view details

Trevor Spiteri

commit sha 2a84e313df095fd0e81b9348b68bd9b1d1caa551

stabilize const_ascii_ctype_on_intrinsics

view details

Adam Perry

commit sha d275739c09f266479d6db388cbf55ba6ca791b9d

Derive common traits for panic::Location. Add documentation about the host/target behavior of Location::file.

view details

Brian Warner

commit sha 201999ccfd18a9debe1f186f30f40659ebc6b933

improve advice in iter_nth_zero The "use .next()" replacement advice is on the last line of the code snippet, where it is vulnerable to truncation. Display that advice at the beginning instead. closes #5783

view details

Michael Wright

commit sha d067d0352bfc5a6979f477bc96c969b040437618

Add test for `needless_range_loop` issue Closes #2277 This was fixed when we fixed #2542.

view details

flip1995

commit sha 6f25adbd5a1600653e8edf8de7135c397d73c07a

Merge commit '2ca58e7dda4a9eb142599638c59dc04d15961175' into clippyup

view details

Matthias Krüger

commit sha 126790999a128a880ca276c49afd2927a66ffbbe

new lint: Returning unit from closures expecting Ord This lint catches cases where the last statement of a closure expecting an instance of Ord has a trailing semi-colon. It compiles since the closure ends up return () which also implements Ord but causes unexpected results in cases such as sort_by_key. Fixes #5080 reprise: rebase, update and address all concerns

view details

Brian Warner

commit sha e83b3eb9930ab527451edaaa6f524acd26c1bf1c

formatting nits

view details

bors

commit sha 97d7a8b319ea266da57a7964719a006582871be4

Auto merge of #5737 - Uriopass:unit-for-ord, r=flip1995 Reprise: new lint: Unintentional return of unit from closures expecting Ord This lint catches cases where the last statement of a closure expecting an instance of Ord has a trailing semi-colon. It compiles since the closure ends up return () which also implements Ord but causes unexpected results in cases such as sort_by_key. Fixes #5080 Reprise of #5348 where I addressed all the comments there changelog: add lint [`unit_return_expecting_ord`]

view details

bors

commit sha 128c5dec9294743f1ee99e3184d281f28fd05fb5

Auto merge of #5793 - warner:5783-nth-zero-next, r=flip1995 improve advice in iter_nth_zero fixes #5783 *Please keep the line below* changelog: For iter_nth_zero, the "use .next()" replacement advice is on the last line of the code snippet, where it is vulnerable to truncation. Display that advice at the beginning instead.

view details

bors

commit sha 84cdce01cbd40bb41b8bcc7eb1cc0778acef6dce

Auto merge of #5798 - mikerite:fix-2277-2, r=yaahc Add test for `needless_range_loop` issue Closes #2277 This was fixed when we fixed #2542. changelog: none

view details

Nicholas Nethercote

commit sha f2f99be2ff619aeb67259b73b51992d026fc11fe

Remove lots of `Symbol::as_str()` calls. In various ways, such as changing functions to take a `Symbol` instead of a `&str`.

view details

Bastian Kauschke

commit sha 29de25b8a26aae3d37d935c437f5afb69f7ccbb2

const_eval_resolve

view details

push time in 7 days

push eventflip1995/rust-clippy

ThibsG

commit sha 442c8ae23b90874485468b3becfc011f8c9d40bb

Fix FP for `suspicious_arithmetic_impl` from `suspicious_trait_impl` lint

view details

bors

commit sha f5d429cd762423901f946abd800dc2cd91366ccf

Auto merge of #5820 - ThibsG:FixSuspiciousArithmeticImpl, r=flip1995 Fix FP for `suspicious_arithmetic_impl` from `suspicious_trait_impl` … As discussed in #3215, the `suspicious_trait_impl` lint causes too many false positives, as it is complex to find out if binary operations are suspicious or not. This PR restricts the number of binary operations to at most one, otherwise we don't lint. This can be seen as very conservative, but at least FP can be reduced to bare minimum. Fixes: #3215 changelog: limit the `suspicious_arithmetic_impl` lint to one binop, to avoid many FPs

view details

Takayuki Nakata

commit sha 3a9ccffed8c5329e3fda67c2e310086ba261e15f

`chmod` 644 `clippy_lints/src/utils/ast_utils.rs`

view details

bors

commit sha d3e9db71c940e6a4575555a2b600ccb8a540facb

Auto merge of #5850 - giraffate:chmod_utils_ats_utils, r=flip1995 Small fix: `chmod` 644 `clippy_lints/src/utils/ast_utils.rs` changelog: none It looks like `clippy_lints/src/utils/ast_utils.rs` doesn't have to be an executable file.

view details

push time in 7 days

issue commentrust-lang/rust-clippy

Split `missing_docs_in_private_items` into various lints

Maybe even better: Don't split it, but make it configurable, so that you can configure it to only warn on functions for example.

jhpratt

comment created time in 7 days

issue commentrust-lang/rust-clippy

Lint doc comments on private items

@shepmaster this lint already exists: missing_docs_in_private_items, but has to be enabled explicitely. (Also it will lint on all private items, not only functions.

llogiq

comment created time in 7 days

issue closedrust-lang/rust-clippy

False positive with match_same_arms

<!-- Hi there! Whether you've come to make a suggestion for a new lint, an improvement to an existing lint or to report a bug or a false positive in Clippy, you've come to the right place.

If you want to report that Clippy does not compile, please be sure to be using the latest version of Rust nightly! Compiler plugins are highly unstable and will only work with a nightly Rust for now. If you are but still have a problem, please let us now!

Thank you for using Clippy!

Write your comment below this line: -->

If two arms have same values after inlining constants, clippy will report a lint on those arms. Is this a good idea? In my code I had two constants that were semantically different but happened to have the same value, and the suggested replacement did not really make sense.

Here's an example that triggers the lint:

const FOO: u32 = 4;
const BAR: u32 = 4;

fn main() {
    match 1 {
        1 => FOO,
        2 => BAR,
        _ => 0,
    };
}

closed time in 7 days

jDomantas

issue commentrust-lang/rust-clippy

Lints `(a - b) < f32::EPSILON` in favor of `(a - b).abs() < f32::EPSILON`

This is a good idea, IMO. I also don't see a reason why someone shouldn't add .abs() here. I don't think it has any performance implications either. If the abs call was left out for performance reasons, it is probably better to state this explicitly in the code, which then can be done with an allow.

So I'd say go ahead and implement this. There's a WIP document for Clippy-hacking-basics and a document for how to write a new lint. If you have any questions, feel free to ask here, in discord or open a WIP PR.

kangalioo

comment created time in 7 days

issue commentrust-lang/rust-clippy

unit_arg suggestions don't make sense when run against Option::map_or(unit_expr, ...)

The suggestion suggests to move the g() call in front of the map_or call and replacing it with (). This suggestion could still be improved, since this doesn't seem to be clear.

Anyway, the or_fun_call lint should definitely trigger here.

Arnavion

comment created time in 7 days

issue commentrust-lang/rust-clippy

unnecessary parentheses warning triggers for necessary parentheses around `yield` expression

The unused_parens lint is a rustc lint, not a Clippy lint. This issue should probably be moved to the rust-lang/rust repo. @Manishearth can you move this issue, please?

Nemo157

comment created time in 7 days

pull request commentrust-lang/rust-clippy

Small fix: `chmod` 644 `clippy_lints/src/utils/ast_utils.rs`

@bors r+

giraffate

comment created time in 8 days

issue commentrust-lang/rust-clippy

Run clippy panic

I think this is the offending code:

https://github.com/rust-lang/rust-clippy/blob/f5d429cd762423901f946abd800dc2cd91366ccf/clippy_lints/src/tabs_in_doc_comments.rs#L67-L71

emacsist

comment created time in 8 days

delete branch flip1995/rust

delete branch : clippyup

delete time in 9 days

pull request commentrust-lang/rust-clippy

Fix FP for `suspicious_arithmetic_impl` from `suspicious_trait_impl` …

Nvm, I don't think that this would give much benefit.

@bors r+

ThibsG

comment created time in 9 days

PR opened rust-lang/rust

Update Clippy

Biweekly Clippy Sync

r? @Manishearth

+840 -259

0 comment

54 changed files

pr created time in 9 days

more