Commit graph

46 commits

Author SHA1 Message Date
xFrednet
d647696c1f
Added clippy::version attribute to all normal lints
So, some context for this, well, more a story. I'm not used to scripting, I've never really scripted anything, even if it's a valuable skill. I just never really needed it. Now, `@flip1995` correctly suggested using a script for this in `rust-clippy#7813`...

And I decided to write a script using nushell because why not? This was a mistake... I spend way more time on this than I would like to admit. It has definitely been more than 4 hours. It shouldn't take that long, but me being new to scripting and nushell just wasn't a good mixture... Anyway, here is the script that creates another script which adds the versions. Fun...

Just execute this on the `gh-pages` branch and the resulting `replacer.sh` in `clippy_lints` and it should all work.

```nu
mv v0.0.212 rust-1.00.0;
mv beta rust-1.57.0;
mv master rust-1.58.0;

let paths = (open ./rust-1.58.0/lints.json | select id id_span | flatten | select id path);
let versions = (
    ls | where name =~ "rust-" | select name | format {name}/lints.json |
    each { open $it | select id | insert version $it | str substring "5,11" version} |
    group-by id | rotate counter-clockwise id version |
    update version {get version | first 1} | flatten | select id version);
$paths | each { |row|
    let version = ($versions | where id == ($row.id) | format {version})
    let idu = ($row.id | str upcase)
    $"sed -i '0,/($idu),/{s/pub ($idu),/#[clippy::version = "($version)"]\n    pub ($idu),/}' ($row.path)"
} | str collect ";" | str find-replace --all '1.00.0' 'pre 1.29.0' | save "replacer.sh";
```

And this still has some problems, but at this point I just want to be done -.-
2021-11-10 19:48:31 +01:00
xFrednet
62b46125cb Avoid slice indexing in Clippy (down with the ICEs) 2021-09-05 14:50:13 +02:00
xFrednet
12c61612f7
Update lint documentation to use markdown headlines 2021-07-28 14:31:59 +02:00
Jason Newcomb
12fce55766
Fix all occurences of needless_borrow internally 2021-04-06 10:43:47 -04:00
Cameron Steffen
1c3a3e7dc6 Don't re-export clippy_utils::diagnostics::* 2021-03-15 20:06:01 -05:00
Cameron Steffen
6fc52a63d1 Move some utils to clippy_utils::source module 2021-03-15 15:34:15 -05:00
Cameron Steffen
22cc77a232 Use const rustc sym where possible 2020-11-02 11:46:37 -06:00
Valentin Lazureanu
5a20489c5c Rename TypeckTables to TypeckResults. 2020-07-17 08:47:04 +00:00
Eduard-Mihai Burtescu
30c046ede4 Use 'tcx for references to AccessLevels wherever possible. 2020-07-03 00:04:48 +03:00
Eduard-Mihai Burtescu
f5ce0e5fe9 rustc_lint: only query typeck_tables_of when a lint needs it. 2020-06-26 02:56:23 +03:00
Aaron Hill
6b3ee8f600 Update Clippy for MethodCall changes 2020-06-10 17:30:11 -04:00
Yuki Okushi
06cb96ed72 Clean up imports 2020-02-18 22:37:45 +09:00
Yuki Okushi
ce1c6b285d Rustup to rust-lang/rust#68045 2020-01-13 21:55:57 +09:00
Yuki Okushi
39947992b5 Rustup to rust-lang/rust#67806 2020-01-11 21:50:00 +09:00
Yuki Okushi
2f2eaf8b7e Rustup to rust-lang/rust#67886 2020-01-07 01:46:33 +09:00
Yuki Okushi
e2636729ec Rustup to rust-lang/rust#66936 2019-12-27 16:13:53 +09:00
Matthias Krüger
98e433d70d
Rustup to rust-lang/rust#66878 2019-12-04 01:34:01 +01: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
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
Oliver Scherer
f7f85a0dca Prevent symbocalypse 2019-05-17 23:53:54 +02:00
Oliver Scherer
b2dbda4d48 Use symbols instead of strings 2019-05-14 10:33:42 +02:00
Matthew Kraai
753c39672e Use lint pass macros
Fixes #3917.
2019-04-17 09:35:22 -07: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
flip1995
1751d2496d
Run rustfmt on clippy_lints 2018-11-27 21:14:15 +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
Matthias Krüger
fd2f6dd382 new_ret_no_self: add sample from #3313 to Known Problems section.
fix trivial typo on the way
2018-10-18 23:37:43 +02:00
Manish Goregaokar
e9c025ea70 Add license header to Rust files 2018-10-06 09:43:08 -07:00
Eduard-Mihai Burtescu
9219fc6c5c Reintroduce extern crate for non-Cargo dependencies. 2018-09-15 11:10:51 +03:00
Manish Goregaokar
20dfaf7842 declare_lint -> declare_tool_lint 2018-08-31 00:34:48 -07:00
Corey Farwell
f42442b6e0 dont deref 2018-08-29 09:07:09 -05:00
Corey Farwell
53928d5367 clippy suggestion 2018-08-29 08:27:32 -05:00
Corey Farwell
6445a5d79d derive copy/clone 2018-08-29 08:01:05 -05:00
Corey Farwell
9a8f206662 eof newline 2018-08-29 07:43:40 -05:00
Corey Farwell
2a486528ee utilize carrier 2018-08-29 07:42:43 -05:00
Corey Farwell
2fa7351c1e suggest wrapping_offset as well 2018-08-29 07:40:00 -05:00
Corey Farwell
61c20c148e if no suggestion, dont add suggestion 2018-08-29 07:12:22 -05:00
Corey Farwell
f7d1ef90a0 utilize .is_unsafe_ptr 2018-08-29 07:08:59 -05:00
Corey Farwell
a48a6ef10f utilize cx.tcx.types.usize 2018-08-29 07:07:23 -05:00
Corey Farwell
a7c1ea96c4 tweak comment 2018-08-29 07:03:50 -05:00
Corey Farwell
feb3e9fd5f switch lint from 'style' to 'complexity' 2018-08-29 07:02:26 -05:00
Corey Farwell
5ebae01c1e New lint: Suggest ptr.add([usize]) over ptr.offset([usize] as isize).
First part of #3047.
2018-08-28 23:21:29 -05:00