Commit Graph

1786 Commits

Author SHA1 Message Date
flip1995
f3bb161f0e Adapt codebase to the tool_lints 2018-08-29 11:08:29 -07:00
flip1995
8c07772dbb Switch to declare_tool_lint macro 2018-08-29 11:08:29 -07:00
flip1995
392235d6e1 Switch to tool_lints 2018-08-29 11:08:29 -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
d5534ca9db bring back sugg::range 2018-08-29 07:46:03 -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
Corey Farwell
05f637cf88 Make clippy_lints::{utils,consts} modules private, remove unused items. 2018-08-28 21:32:20 -05:00
Oliver Schneider
d99cea0f16 Update imports and rustup 2018-08-28 13:13:42 +02:00
Daniel Wagner-Hall
350036a0c7 default_trait_access skips <F as Default>::default()
This includes the type name, so is clear, and may be necessary.

There doesn't seem to be an obviously cleaner way to pull out the
literal text of the named type here.

Fixes #2879
2018-08-27 23:22:07 +01:00
Matthias Krüger
fc31dc01de docs: make example in new_without_default lint syntax highlighted 2018-08-27 17:35:30 +02:00
Philipp Krones
9ce826ade1
Merge pull request #3082 from mikerite/move-range-lints
Move some range lints to complexity
2018-08-26 15:08:21 +02:00
Michael Wright
95fedd2273 Revert "Fix E0502 warnings"
This reverts commit 98dbce4fe4.

The compiler no longer emits the warnings in #2982 with the original
code.
2018-08-26 11:21:22 +02:00
Michael Wright
eef3ffab35 Remove iterator_find_map feature attribute
Closes #3083
2018-08-26 11:11:47 +02:00
Michael Wright
cc87dc7539 Move some range lints to complexity
Recategorize `range_plus_one` and `range_minus_one` to `complexity`.
This moves `range_plus_one` out of the nursery as the inclusive range
syntax is now stable. Both are moved to `complexity` as it is more
consistent with other lints such as `int_plus_one`.
2018-08-26 10:57:04 +02:00
Michael Wright
6256ad05ba fix-3078: verify test case
Check the crash test case by commenting out the fix
2018-08-25 22:35:06 +02:00
Michael Wright
45ceecc79c Fix #3078 2018-08-25 14:49:56 +02:00
Philipp Hansch
296b79bdb8
Merge pull request #3079 from matthiaskrgr/update_cargo_metadata
deps: update cargo_metadata from 0.5 to 0.6.
2018-08-24 20:09:50 +02:00
Philipp Krones
b1620f5d3a
Merge pull request #3080 from matthiaskrgr/manual_swap_example
add how-to example for std::mem::transmute() usage instead of manual swap
2018-08-24 19:47:17 +02:00
Matthias Krüger
f7be2a0416 add how-to example for std::mem::transmute() usage instead of manual swap 2018-08-24 18:41:49 +02:00
Philipp Krones
e91147832c
Merge pull request #3048 from goodmanjonathan/assign_op
deprecate assign_ops lint
2018-08-24 18:29:31 +02:00
Philipp Krones
562c576ed3
Merge pull request #3059 from elpiel/writeln_empty_string_harcoded-suggestion
#3016 writeln_empty_string Hardcoded suggestion
2018-08-24 18:28:50 +02:00
Matthias Krüger
2224fbb5f7 deps: update cargo_metadata from 0.5 to 0.6. 2018-08-24 18:14:49 +02:00
Niklas Fiekas
afdf350060 Add copy_iterator lint (#1534) 2018-08-24 11:57:48 +02:00
Matthias Krüger
c98987f390 fix clippy breakage due to https://github.com/rust-lang/rust/pull/52602 2018-08-23 21:41:30 +02:00
Matt Brubeck
6a0703664b
Remove incorrect note from string_add_assign docs
The docs claim that `String::push_str` is better than `String::add` because `String::add` allocates a new string and drops the old one, but this is not true.  In fact, `add` reuses the existing string and grows it only if its capacity is exceeded, exactly like `push_str`.  Their performance is identical since `add` is just a wrapper for `push_str`:

```
    fn add(mut self, other: &str) -> String {
        self.push_str(other);
        self
    }
```

35bf1ae257/src/liballoc/string.rs (L1922-L1925)
2018-08-23 08:38:41 -07:00
Matthias Krüger
8ab16b678c
remove macro_vis_matcher feature gate since it is stable now.
Warning was:
warning: the feature `macro_vis_matcher` has been stable since 1.29.0 and no longer requires an attribute to enable
 --> src/lib.rs:4:12
  |
4 | #![feature(macro_vis_matcher)]
  |            ^^^^^^^^^^^^^^^^^
  |
  = note: #[warn(stable_features)] on by default
2018-08-23 15:40:51 +02:00
flip1995
37099ae034
Remove now stable tool_attributes feature 2018-08-23 15:36:07 +02:00
Matthias Krüger
712d2d4fa1 rustup, fix breakage introduced by https://github.com/rust-lang/rust/pull/53581 2018-08-22 23:34:52 +02:00
Lachezar Lechev
76f7bfcefd #3016 Add backticks for the msg 2018-08-20 15:50:15 +02:00
Lachezar Lechev
c292b80783 #3016 Add feedback and implement test for fixed hardcoded suggestion 2018-08-20 15:33:43 +02:00
Lachezar Lechev
3015987f27 #3016 [WIP] Implement feedback and suggestions 2018-08-20 14:03:13 +02:00
Manish Goregaokar
a7bea134d3 Remove implied rust_2018 feature
We are already on the edition and this feature is implied.
2018-08-19 19:14:47 -07:00
Manish Goregaokar
76321d3300 codemap -> source_map
https://github.com/rust-lang/rust/pull/52953
2018-08-19 19:06:54 -07:00
Lachezar Lechev
6cb94630fb WIP of #3016 for hardocded suggestion for writeln on empty string 2018-08-16 18:20:06 +02:00
Michael Wright
1c681b6ab6 fix-2927: Update formatting 2018-08-16 07:13:52 +02:00
Michael Wright
bbd67c9b78 Fix #2927 2018-08-15 08:11:07 +02:00
Manish Goregaokar
bac76afb5a Rustup to rustc 1.30.0-nightly (23f09bbed 2018-08-14) 2018-08-14 11:26:28 -07:00
Philipp Krones
84aa49935d
Merge pull request #3026 from dwijnand/fxhash
Add an internal lint for FxHashMap/FxHashSet
2018-08-14 13:04:48 +02:00
Philipp Krones
b2a4013c14
Merge pull request #3014 from estk/allow-write-multi-newline
Allow print/write with multiple newlines
2018-08-14 12:54:05 +02:00
Philipp Krones
826d998cd2
Merge pull request #3036 from matthiaskrgr/clippy_self
fix 2 clippy warnings
2018-08-14 12:53:01 +02:00
Dale Wijnand
7933d445d1
Move shadow_unrelated to pedantic 2018-08-14 09:52:27 +01:00
Dale Wijnand
22ff5a3ef1
Avoid new_without_default_derive in DefaultHashTypes 2018-08-14 09:25:09 +01:00
Jonathan Goodman
160b41dae3 deprecate assign_ops lint 2018-08-13 16:12:41 -05:00
Dale Wijnand
1812707d39
Use utils::span_lint_and_sugg in default_hash_types 2018-08-13 11:49:57 +01:00
Dale Wijnand
8fc425b676
Add an internal lint for FxHashMap/FxHashSet 2018-08-12 16:15:36 +01:00
Matthias Krüger
88d693918f docs: add more suggestions on how to fix clippy findings to the online lint list. 2018-08-12 11:29:44 +02:00
Matthias Krüger
66ca3954ec fix 2 clippy warnings 2018-08-11 23:16:47 +02:00
Oliver Schneider
99a087bea5 Update to rustc master 2018-08-08 13:19:07 +02:00
Oliver Schneider
d722489e71
Merge pull request #2823 from flip1995/thingies_things
Replace cfg_attr(rustfmt... with rustfmt::skip
2018-08-08 13:14:20 +02:00
Nick Cameron
b109e10334 Fix build 2018-08-08 18:01:06 +12:00
Evan Simmons
550ff84ecd Allow print/write with multiple newlines 2018-08-07 12:01:10 -08:00
Oliver Schneider
328fea3e0d Rustup 2018-08-07 16:34:17 +02:00
Oliver Schneider
77025557f9
Merge pull request #3009 from dwijnand/option-map_or
Use Option::map_or
2018-08-07 13:11:30 +02:00
Oliver Schneider
1af90085a1
Merge pull request #3008 from dwijnand/remove-workaround
Remove #[allow(rust_2018_idioms)] workaround
2018-08-07 13:10:54 +02:00
Oliver Schneider
dc5ee5aa19
Merge pull request #3010 from mikerite/issue2971
Fix #2971
2018-08-07 13:10:26 +02:00
Scott McMurray
73e097e9f1 Fix the build after https://github.com/rust-lang/rust/pull/53016
In-band lifetimes are no longer in the edition, so update the one place that was using them.
2018-08-07 00:05:09 -07:00
Michael Wright
a3d7698fd9 Fix #2971 2018-08-07 05:37:11 +02:00
Dale Wijnand
7a5ede677b
Use Option::map_or 2018-08-06 17:52:09 +01:00
Dale Wijnand
1a310bfdf7
Remove #[allow(rust_2018_idioms)] workaround 2018-08-06 17:51:04 +01:00
Oliver Schneider
b18a3c5b60
Merge pull request #3007 from mikerite/issue3000
Fix #3000
2018-08-06 09:16:42 +02:00
Michael Wright
ffce3c77e4 Fix #3000 2018-08-06 08:20:50 +02:00
Philipp Hansch
f6c4e303c9
Merge pull request #2999 from flip1995/single_char_pattern
Fix single_char_pattern lint for escaped chars
2018-08-06 07:05:04 +01:00
Philipp Hansch
32e4897854
Merge pull request #2975 from aaudiber/lint-identity-into-iter
Lint using identity into_iter conversion
2018-08-05 20:38:28 +01:00
Philipp Hansch
a016d4efe0
Merge pull request #2991 from mikerite/issue2979
Fix #2979
2018-08-05 20:35:55 +01:00
Nick Cameron
99dcc70dcd Fix error in CrateType in latest Rust 2018-08-05 09:35:08 +12:00
Manish Goregaokar
0ff762f7cd Rustup to 59fa6bd6c 2018-08-03 10:14:25 -07:00
flip1995
55672e7e49
Fix single_char_pattern lint for escaped chars 2018-08-03 10:19:29 +02:00
Alex Crichton
8ef759e027 Fix fallout from rust-lang/rust#52841 2018-08-02 18:08:22 -07:00
flip1995
12f2d61fa9
Replace cfg_attr(rustfmt... thingies 2018-08-02 23:04:20 +02:00
Philipp Krones
5d9ca00d94
Merge pull request #2992 from etaoins/allow-pass-by-ref-on-adt-return
Allow pass by ref when returning ADT with ref
2018-08-02 22:39:04 +02:00
Alex Crichton
40349b23ea Fix breakage from rust-lang/rust#52949 2018-08-02 13:00:14 -07:00
Manish Goregaokar
f43d0e53b2 Make indexing_slicing a restriction lint (fixes #2933) 2018-08-02 10:06:03 -07:00
reujab
1afb7e895b removed colon 2018-08-02 11:52:46 -04:00
Ryan Cumming
08d6b3d2f6 Allow pass by ref when returning ADT with ref
This is a follow-up to #2951 that extends the logic to allow for
returning references inside structs/enums/unions. This was a simple
oversight in the first version and it's surprisingly easy to handle.
2018-08-02 17:57:49 +10:00
Michael Wright
534d546c81 Fix #2979 2018-08-02 08:56:53 +02:00
Andrew Audibert
3851c0e22b Address build warning 2018-07-31 23:53:45 -07:00
Philipp Hansch
d7ffaab0fb
Merge pull request #2968 from phansch/first_an_ICE_and_then_some_ice_cream
Fix ICE with 'while let Some(..) = x.iter()'
2018-08-01 06:18:34 +01:00
Philipp Hansch
4dbc62baf8
Merge pull request #2983 from mikerite/fix_warnings_20180730
Fix compiler warnings
2018-08-01 06:18:18 +01:00
Michael Wright
98dbce4fe4 Fix E0502 warnings
Fixes #2982
2018-08-01 06:33:08 +02:00
flip1995
74fcf7de4a
single_char_pattern: lint only on the argument span 2018-07-31 12:20:32 +02:00
Michael Wright
9c53b1560c Fix unused_mut warning 2018-07-31 07:45:05 +02:00
Andrew Audibert
0ea1afab3a Lint using identity into_iter conversion 2018-07-29 21:37:31 -07:00
Philipp Krones
4010788b3a
Merge pull request #2917 from mikerite/issue2894
Fix #2894
2018-07-29 23:54:03 +02:00
Philipp Hansch
0aeb82cb67
Merge pull request #2959 from chrisduerr/master
Add known problem to `needless_borrow` lint
2018-07-29 12:15:17 +02:00
Philipp Hansch
946340acfe
Fix ICE with 'while let (..) = x.iter()' 2018-07-29 11:00:26 +02:00
Michael Wright
d7ddb2abba Add use_self comment 2018-07-28 10:42:21 +02:00
Michael Wright
8eeb3feadf Merge branch 'master' into issue2894 2018-07-28 08:41:10 +02:00
Oliver Schneider
b0dabce478
Merge pull request #2963 from commandline/master
Fix regression in print_literal
2018-07-26 10:11:34 +02:00
Thomas Gideon
bf3f976a43 Fix regression in print_literal 2018-07-25 17:31:17 -04:00
Philipp Hansch
e1096391dc
Merge pull request #2960 from matthiaskrgr/typos
fix a bunch of typos found by codespell
2018-07-25 22:57:10 +02:00
Philipp Hansch
3bd062e1d9
Merge pull request #2948 from Nemo157/patch-1
Add known problem for redundant_closure lint
2018-07-25 22:55:36 +02:00
Matthias Krüger
2665f10662 fix a bunch of typos found by codespell 2018-07-25 20:02:52 +02:00
Matthias Krüger
cfc9b33f17 Merge branch 'master' into typos 2018-07-25 19:54:45 +02:00
Christian Duerr
13353111da
Add known problem to needless_borrow lint
The `needless_borrow` lint is temporarily disabled because of some false
positives it causes in combination with the `derive` macro.

However the documentation does not explain these issues, but instead
lists `Known problems: None`. To make it clear why this lint is
currently not enabled, a description of the false positives caused by
this lint has been added to the `Known problems` section.
2018-07-25 14:54:09 +02:00
Michael Wright
137f944315 Fix warnings 2018-07-25 06:34:29 +02:00
Michael Wright
5e23fcec0b Merge branch 'master' into issue2894 2018-07-25 06:27:36 +02:00
Dale Wijnand
a1cce2d06a
Inline utils::in_external_macro 2018-07-24 10:38:58 +01:00
Dale Wijnand
b1fa7b91ba
Delegate utils::in_external_macro to rustc::lint::in_external_macro 2018-07-24 10:34:18 +01:00
Philipp Krones
b02e53de34
Merge pull request #2951 from etaoins/allow-pass-by-ref-on-ref-return
Allow pass by reference if we return a reference
2018-07-24 11:23:01 +02:00
Philipp Krones
3f9b837ec8
Merge pull request #2953 from dwijnand/misrefactored_assign_op-known-problem-doc
Expand on misrefactored_assign_op known problems
2018-07-24 11:19:58 +02:00
Ryan Cumming
0afa5e1e21 Merge branch 'master' into allow-pass-by-ref-on-ref-return 2018-07-24 19:03:43 +10:00
Dale Wijnand
70f5bb1ff6
Tweak
misrefactored_assign_op's known problems wording
2018-07-24 09:26:28 +01:00
Dale Wijnand
6ad7a92ff8
Expand on misrefactored_assign_op known problems 2018-07-24 08:39:18 +01:00
Oliver Schneider
afd91248ed Rustup 2018-07-23 13:01:12 +02:00
Ryan Cumming
7c74c3e508 Wrap comment at 80 columns 2018-07-23 19:37:41 +10:00
Ryan Cumming
89a4558056 Add Known Problem for multiple lifetimes 2018-07-23 19:33:52 +10:00
Ryan Cumming
58459abd0c Allow pass by reference if we return a reference
Currently this code will trigger `trivally_copy_pass_by_ref`:

```
struct OuterStruct {
    field: [u8; 8],
}

fn return_inner(outer: &OuterStruct) -> &[u8] {
    &outer.field
}
```

If we change the `outer` to be pass-by-value it will not live long
enough for us to return the reference. The above example is trivial but
I've hit this in real code that either returns a reference to either the
argument or in to `self`.

This suppresses the `trivally_copy_pass_by_ref` lint if we return a
reference and it has the same lifetime as the argument. This will likely
miss complex cases with multiple lifetimes bounded by each other but it
should cover the majority of cases with little effort.
2018-07-23 18:44:40 +10:00
Oliver Schneider
ff0e5f967f Rewrite the print/write macro checks as a PreExpansionPass 2018-07-23 00:19:07 +02:00
Wim
26eea10ec1
Add known problem for redundant_closure lint
Documenting https://github.com/rust-lang-nursery/rust-clippy/issues/1439 until it gets fixed.
2018-07-21 18:05:02 +02:00
Oliver Schneider
8085ed733f Don't invent new magic keywords 2018-07-21 12:36:01 +02:00
Oliver Schneider
2fa85d86e0 Rustup 2018-07-20 22:50:04 +02:00
Manish Goregaokar
1f65617372 Merge branch 'macro-use' into HEAD 2018-07-20 00:52:01 -07:00
Manish Goregaokar
77b0300a55 Merge branch 'pr-2939' into HEAD 2018-07-20 00:51:57 -07:00
Manish Goregaokar
2a37a62686 Update dependencies 2018-07-20 00:50:02 -07:00
Manish Goregaokar
3c2b54870e Remove warning 2018-07-20 00:50:02 -07:00
Manish Goregaokar
5918a3fc1e Remove import of if_chain 2018-07-20 00:50:02 -07:00
Alexander Regueiro
4d2c838a32 Update to nightly 2018-07-20 03:59:07 +01:00
flip1995
ac77a26b8a
Skip useless_attribute lint on allow(unused_imports) on extern crate items with macro_use 2018-07-19 13:59:25 +02:00
Manish Goregaokar
c7676356b8 Remove import of matches 2018-07-19 01:06:02 -07:00
Manish Goregaokar
5d74e2096b Remove import of rustc 2018-07-19 00:53:23 -07:00
Manish Goregaokar
00ba67a12b Remove import of lazy_static 2018-07-19 00:11:15 -07:00
Manish Goregaokar
c1745cde82 Remove import of serde 2018-07-19 00:02:08 -07:00
Manish Goregaokar
c05adc545c Temporarily allow macro_use_extern_crate 2018-07-18 20:24:37 -07:00
Michael Wright
a05c9b63ce use_self: Simplify spanning 2018-07-18 07:57:50 +02:00
Michael Wright
5bb52c4869 Fix use_self regressions 2018-07-17 08:20:49 +02:00
Michael Wright
847e4dcc0d Merge branch 'master' into issue2894 2018-07-17 06:32:39 +02:00
Oliver Schneider
6992937002 Update for hir renamings in rustc 2018-07-16 15:07:39 +02:00
csmoe
8e929946fd DeclKind 2018-07-16 11:48:33 +02:00
csmoe
8cf463fe93 StmtKind 2018-07-16 11:48:33 +02:00
csmoe
12ded030b6 TyKind 2018-07-16 11:48:33 +02:00
csmoe
5d4102ee78 BinOpKind 2018-07-16 11:46:37 +02:00
csmoe
1bd17e4fa2 ExprKind 2018-07-16 11:46:37 +02:00
Michael Wright
b90fc5edfa Fix #2894 2018-07-15 10:38:40 +02:00
Oliver Schneider
5e085e4310 Remove use of ty_to_def_id 2018-07-15 02:04:23 +02:00
Oliver Schneider
1e9f076254 Ignore spans when comparing expressions 2018-07-15 00:00:27 +02:00
Michael Wright
60af4a8e13 Remove duplication in missing_inline 2018-07-08 08:06:24 +02:00
Manish Goregaokar
d914106d87 Bump to 0.0.212 2018-07-06 23:23:19 -07:00
Manish Goregaokar
184b99de39 Merge branch 'pr-2889' 2018-07-06 23:20:01 -07:00
Oliver Schneider
28daee4c91 Rustup 2018-07-05 13:41:51 +02:00
gnzlbg
3fec3b47b6 refactor function 2018-07-05 01:53:40 +02:00