9

Fix `enum_variants` FP on prefixes that are not camel-case by dswij · Pull Reque...

 3 years ago
source link: https://github.com/rust-lang/rust-clippy/pull/8127
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Copy link

Contributor

dswij commented on Dec 15, 2021

edited by xFrednet

closes #8090

Fix FP on enum_variants when prefixes are only a substring of a camel-case word. Also adds some util helpers on str_utils to help parsing camel-case strings.

This changes how the lint behaves:

  1. previously if the Prefix is only a length of 1, it's going to get ignored, i.e. these were previously ignored and now is warned
enum Foo {
    cFoo,
    cBar,
    cBaz,
}

enum Something {
    CCall,
    CCreate,
    CCryogenize,
}
  1. non-ascii characters that doesn't have casing will not be split,
enum NonCaps {
    PrefixXXX,
    PrefixTea,
    PrefixCake,
}

will be considered as PrefixXXX, Prefix, Prefix, so this won't lint as opposed to fired previously.

changelog: [enum_variant_names] Fix FP when first prefix are only a substring of a camel-case word.


(Edited by @xFrednet removed some non ascii characters)


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK