Commit Graph

83 Commits

Author SHA1 Message Date
Yuki Okushi
9086b17e14 Rustup to rust-lang/rust#67707 2019-12-31 09:17:56 +09:00
Yuki Okushi
b68e65b4da Do not drop suffixes on decimal_literal_representation 2019-12-26 01:22:36 +09:00
Lzu Tao
f5b896451a do minor cleanups
* ToString and AsRef are in prelude, no need to import them
2019-12-24 03:06:52 +07:00
Matthias Krüger
98e433d70d
Rustup to rust-lang/rust#66878 2019-12-04 01:34:01 +01:00
Michael Wright
ceb0b2d41a literal repr: ignore more warnings in macros 2019-11-14 08:19:02 +02:00
Michael Wright
75e2dcf56b literal representation: simplification
Simplify calculation in grouping. Add test case to ensure `count()`
can't be zero in that branch.
2019-11-14 07:42:04 +02:00
Michael Wright
2e9d173be1 literal representation restructure 12
Export function for formatting literals and remove crate visibility from
other items.
2019-11-13 08:28:50 +02:00
Michael Wright
eb9caf3050 literal representation restructure 11
Rename `grouping_hint` to `format` and use the term consistently.
2019-11-13 08:28:06 +02:00
Michael Wright
a8ca8a21c1 literal representation restructure 10
Rename DigitInfo to NumericLiteral
2019-11-13 08:28:01 +02:00
Michael Wright
a9c5a599e3 literal representation restructure 9
Only store valid suffixes (and not mistyped suffixes) in DigitInfo.
Check for mistyped suffixes later and not when DigitInfo is created.
This opens the door to more sophisticated mistyped suffix checks later.
2019-11-13 08:27:54 +02:00
Michael Wright
a58b980bd8 literal representation restructure 8
Store the digit parts directly in DigitInfo since we need them anyway.
2019-11-13 08:27:49 +02:00
Michael Wright
b62543f756 literal representation restructure 7
Replace `do_lint` with `get_group_size`. Return `None` if there are no
groups.
2019-11-13 08:27:42 +02:00
Michael Wright
abf62d8011 literal representation restructure 6
Add `group_digits` helper function.
2019-11-13 08:27:37 +02:00
Michael Wright
ec664e84bf literal representation restructure 5
Use `split_digit_parts` in `check_lit`.
2019-11-13 08:27:27 +02:00
Michael Wright
2d244d3358 literal representation restructure 4
Simplify `grouping_hint` by splitting digits into parts and handling
one at a time.

Fixes #4762
2019-11-13 08:27:19 +02:00
Michael Wright
2e8946a6de literal representation restructure 3
Move suffix check into `check_lit` so that it isn't done repeatedly.
2019-11-13 08:27:14 +02:00
Michael Wright
2dbd34ffe8 literal representation restructure 2
Consolidate warning handling using "poor man's try".
2019-11-13 08:27:05 +02:00
Michael Wright
8f5b4f3f5c literal representation restructure 1
Combine macro expansion checks. Indentation is a little strange to
avoid rustfmt issue.
2019-11-13 08:26:52 +02:00
Michael Wright
a9b5b36769 Fix to_digit_is_some dogfood errors 2019-11-10 15:53:08 +02:00
bors
426c05ae33 Auto merge of #4758 - mikerite:dec_lit_20191031, r=flip1995
`DecimalLiteralRepresentation` simplification

Remove recalculation of literal value.

changelog: none
2019-11-07 21:06:18 +00:00
flip1995
e917b01286
Rustup to rust-lang/rust#65884 2019-11-07 13:27:00 +01:00
Michael Wright
4e78547e6f DecimalLiteralRepresentation simplification
Remove recalculation of literal value.
2019-10-31 09:13:08 +02:00
James Wang
664522badd
Add a new lint for unused self 2019-10-15 09:58:11 +02:00
Andre Bogus
cc622608db new lints around #[must_use] fns
`must_use_unit` lints unit-returning functions with a `#[must_use]`
attribute, suggesting to remove it.

`double_must_use` lints functions with a plain `#[must_use]`
attribute, but which return a type which is already `#[must_use]`,
so the attribute has no benefit.

`must_use_candidate` is a pedantic lint that lints functions and
methods that return some non-unit type that is not already
`#[must_use]` and suggests to add the annotation.
2019-10-14 12:09:04 +02:00
Matthias Seiffert
e333ed0d53 Correctly align doc of mistyped literal suffixes 2019-10-03 22:14:32 +02:00
flip1995
4bbd10a585
Rustup to rust-lang/rust#64813 2019-09-27 17:21:20 +02:00
Jakub Wieczorek
2a13e83f2b Update all the code to pass the updated use_self lint.
One struct required a temporary `#[allow(dead_code)]` annotation due to
a bug in the Rust compiler: https://github.com/rust-lang/rust/issues/63151.
2019-07-31 08:50:43 +00:00
flip1995
3543f58c84
Add macro check for unreadable_literal lint
Closes #4094
2019-05-15 14:57:56 +02:00
Matthew Kraai
753c39672e Use lint pass macros
Fixes #3917.
2019-04-17 09:35:22 -07:00
Philipp Hansch
ab6b949224
Refactor check_lit method 2019-04-10 21:05:56 +02:00
Philipp Hansch
1fd2451b90
Code formatting/cleanup 2019-04-10 07:50:34 +02:00
Philipp Hansch
0307ff020c
Fix ICE in decimal_literal_representation lint
Handling the integer parsing properly instead of just unwrapping.

Note that the test is not catching the ICE because plain UI tests
[currently hide ICEs][compiletest_issue]. Once that issue is fixed, this
test would fail properly again.

[compiletest_issue]: https://github.com/laumann/compiletest-rs/issues/169
2019-04-08 22:16:34 +02:00
Alexander Regueiro
d43966a176 Various cosmetic improvements. 2019-03-10 18:06:28 +00:00
Andy Russell
a9de64a151
fix or ignore failing doc tests 2019-03-05 18:45:08 -05:00
Andy Russell
fe96ffeac9
move lint documentation into macro invocations 2019-03-05 18:45:08 -05:00
Matthias Krüger
e9e0a7e3bd rustup https://github.com/rust-lang/rust/pull/57726 2019-01-27 01:42:34 +01:00
Philipp Hansch
38d4ac7cea
Remove all copyright license headers
Discussion previously happened in https://github.com/rust-lang/rust/pull/43498
2019-01-08 21:46:39 +01:00
Konrad Borowski
3f62fc3a7e Remove crate:: prefixes from crate paths
This is somewhat misleading, as those are actually external crates,
and don't need a crate:: prefix.
2018-12-29 16:05:49 +01:00
David Tolnay
c00dcd03d7
Downgrade large_digit_groups to pedantic
I believe if the user already decided to put underscores in their
literal, Clippy should be willing to believe that they put a number of
underscores that they felt was readable.
2018-12-01 17:08:42 -08:00
flip1995
1751d2496d
Run rustfmt on clippy_lints 2018-11-27 21:14:15 +01:00
flip1995
adc638ef33
Change Applicability of MISTYPED_LITERAL_SUFFIX 2018-11-27 16:59:39 +01:00
flip1995
4e74eef6e9
Add applicability level to (nearly) every span_lint_and_sugg function 2018-11-27 15:29:23 +01:00
flip1995
9096269610
Add Applicability::Unspecified to span_lint_and_sugg functions 2018-11-27 15:29:23 +01:00
bors[bot]
7e417d4cbd Merge #3353
3353: float support added for mistyped_literal_suffixes lint r=mikerite a=Maxgy

I implemented the mistyped_literal_suffixes lint for float literals.

```
#![allow(unused_variables)]

fn main() {
    let x = 1E2_32;
    let x = 75.22_64;
}
```
Given the above, the additional check suggests the variables to be written as `let x = 1E2_f32` and `let x = 75.22_f64`.

Fixes #3167 

Co-authored-by: Maxwell Anderson <maxwell.brayden.anderson@gmail.com>
2018-11-05 03:58:15 +00:00
Maxwell Anderson
3e0de1745d changed into_iter to iter and fixed a lint check 2018-11-04 10:39:54 -07:00
kennytm
2b2acf1002
Fix dogfood error. 2018-11-02 22:53:57 +08:00
Maxwell Anderson
b6b97e5c1f format code 2018-11-01 15:43:40 -06:00
Maxwell Anderson
02340cc891
fix comment spacing 2018-11-01 12:35:01 -06:00
Maxwell Anderson
98ce3348d9 change single char str to char 2018-10-31 18:09:56 -06:00
Maxwell Anderson
f4b919cad7 add lint to lintarray macro 2018-10-31 16:48:24 -06:00