Commit graph

1208 commits

Author SHA1 Message Date
rchaser53
db6ca9b8d3 fix format does not parse escaped braces error 2019-04-13 01:39:10 +09:00
bors
37f5c1ec73 Auto merge of #3925 - phansch:3741, r=flip1995
Fix ICE in suspicious_else_formatting

Fixes #3741
2019-04-09 07:13:08 +00:00
Philipp Hansch
3ab8038450
Remove force-host and explain no-prefer-dynamic 2019-04-08 21:23:39 +02:00
Klemen Košir
560fd163d6
Escape a single quote in single_char_pattern hint 2019-04-08 21:55:50 +09:00
bors
4fdd113bed Auto merge of #3921 - euclio:single-char-names-multispan, r=flip1995
use a multispan for MANY_SINGLE_CHAR_NAMES
2019-04-08 08:42:13 +00:00
bors
e91ba8af85 Auto merge of #3848 - felix91gr:null_transmute, r=flip1995
Transmuting known null ptr to ref

Working on implementing #628
2019-04-08 07:20:25 +00:00
bors
42e1cf3763 Auto merge of #3901 - rail-rain:issue_1670, r=flip1995
Fix `explicit_counter_loop` suggestion

#1670

This code seems to me to work, but I have two question.
* Because range expression desugared in hir, `Sugg::hir` doesn't add parenthesis to range expression.  Which function is better to check range do you think, `check_for_loop_explicit_counter` or `hir_from_snippet`?
* Do you think we need to distinguish between range expression and struct expression that creates `std::ops::Range*`?
2019-04-08 06:28:15 +00:00
Philipp Hansch
60c1bb0546
Fix ICE in suspicious_else_formatting 2019-04-07 11:11:06 +02:00
Andy Russell
0d50d44ea6
use a multispan for MANY_SINGLE_CHAR_NAMES 2019-04-05 10:07:39 -04:00
Philipp Hansch
b545f1c3bb
Add missing // run-pass annotations to ICE tests
compiletest UI tests do not fail when encountering panics and ICEs
unless the `// run-pass` flag is used.

(This was forgotten in https://github.com/rust-lang/rust-clippy/pull/3743)
2019-04-05 07:22:36 +02:00
Félix Fischer
069957a8ad Add TransmutingNull Lint
* Late Lint pass, catches:
  * One liner: 0 -> null -> transmute
  * One liner: std:null() -> transmute
  * Const (which resolves to null) -> transmute
* UI Test case for Lint
* Updated test for issue 3849, because now the lint that code generated is in Clippy.
* Expanded `const.rs` miri-based Constant Folding code, to cover
  raw pointers
2019-04-02 11:39:43 -03:00
flip1995
41927796bf
Run rustfmt 2019-04-01 20:37:05 +02:00
Philipp Hansch
b253c564d5
Rustup to https://github.com/rust-lang/rust/pull/58805 2019-04-01 20:37:05 +02:00
flip1995
6f01ecfefd
Fix question_mark lint+test 2019-04-01 20:37:05 +02:00
rail
2b82c71b55 use span_lint_and_sugg in explicit_counter_loop 2019-03-28 08:51:57 +09:00
Oliver Scherer
d020565ed2 Hacky rustup 2019-03-26 10:55:03 +01:00
rail
9698e41994 Change explicit_counter_loop's message to add parentheses if necessary 2019-03-23 15:36:48 +09:00
rail
bd6c2df066 Change explicit_counter_loop's message to reflect original variable name 2019-03-23 15:30:17 +09:00
Philipp Hansch
0452704978
cargo fmt 2019-03-19 06:57:41 +01:00
Philipp Hansch
f1d0858a8f
Add rustfix tests for mistyped_literal_suffix lint
This moves all `mistyped_literal_suffix` tests to their own file and
enables rustfix tests for them.

cc #3603, #2038

Based on #3887
2019-03-19 06:55:42 +01:00
Philipp Hansch
4e51c980bc
Move some unreadable_literal ui tests to correct file
The moved tests were part of `tests/ui/literals.rs` before. Now they are
placed in `tests/ui/unreadable_literal.rs`, which now also runs
`rustfix` on these 4 extra let statements.
2019-03-19 06:55:42 +01:00
bors
54e20519d2 Auto merge of #3886 - phansch:rustfix_useless_asref, r=flip1995
Enable rustfix for `useless_asref` lint tests

cc #3630
2019-03-15 09:43:29 +00:00
Philipp Hansch
0019ca5e4f
Enable rustfix for useless_asref lint tests 2019-03-15 07:29:12 +01:00
bors
e7806413c6 Auto merge of #3883 - daxpedda:missing_docs_in_private_items, r=phansch
Add `doc(include = ...)` detection to `missing_docs_in_private_items`

The whole `missing documentation in crate` part doesn't have any tests. If I should add test cases tell me.
2019-03-15 06:18:28 +00:00
daxpedda
9061fd3199
Another test for missing crate documentation. 2019-03-14 19:38:41 +01:00
daxpedda
e1096e3310
Add a test for doc(include)
Tiny code improvement.
2019-03-14 19:33:06 +01:00
bors
bb41b16423 Auto merge of #3879 - phansch:rustfix_string_lit_as_bytes, r=flip1995
Run rustfix for string_lit_as_bytes tests

This moves the `string_lit_as_bytes` tests into a new file and enables
rustfix tests for them.

cc #3603, #2038
2019-03-14 17:29:19 +00:00
bors
9df38117d9 Auto merge of #3877 - rink1969:3842, r=flip1995
casting integer literal to float is unnecessary

fix issue https://github.com/rust-lang/rust-clippy/issues/3842
2019-03-14 16:32:15 +00:00
rink1969
d9dd008e44 casting integer literal to float is unnecessary 2019-03-14 15:53:08 +08:00
Philipp Hansch
5e4a7eb1fc
UI test cleanup: Extract manual_memcpy tests 2019-03-14 07:26:47 +01:00
Philipp Hansch
67aad6c180
Run rustfix for string_lit_as_bytes tests
This moves the `string_lit_as_bytes` tests into a new file and enables
rustfix tests for them.
2019-03-14 06:59:30 +01:00
bors
8fc0a738e3 Auto merge of #3869 - taiki-e:use_self, r=flip1995
Fix `use_self` false positive on nested functions

Related to https://github.com/rust-lang/rust-clippy/pull/3640

The current `use_self` warns the following code.

```rust
#![warn(clippy::use_self)]
struct Foo {}
impl Foo {
    fn bar() {
        fn baz() -> Foo { //^ warning: unnecessary structure name repetition
            Foo {} //^ warning: unnecessary structure name repetition
         }
    }
}
```
2019-03-12 12:09:56 +00:00
bors
3d31c2157a Auto merge of #3794 - mikerite:fix-3739, r=phansch
Fix `boxed_local` suggestion

Don't warn about an argument that is moved into a closure.

ExprUseVisitor doesn't walk into nested bodies so use a new
visitor that collects the variables that are moved into closures.

Fixes #3739
2019-03-12 07:43:14 +00:00
bors
75bfa29533 Auto merge of #3871 - taiki-e:needless_continue, r=phansch
Fix `needless_continue` false positive

If the `continue` has a label, check it matches the label of the loop.

Fixes https://github.com/rust-lang/rust-clippy/issues/2329
2019-03-12 07:04:44 +00:00
Michael Wright
6937d5581a Merge branch 'master' into fix-3739 2019-03-12 08:13:44 +02:00
Taiki Endo
1bc7da2fec Fix needless_continue false positive 2019-03-12 03:40:30 +09:00
Taiki Endo
187ce4c5ab Fix use_self false positive on nested functions 2019-03-11 23:24:49 +09:00
Taiki Endo
4896b259eb Filter out proc_macro and proc_macro_attribute 2019-03-11 20:45:57 +09:00
flip1995
44c46d2059
Run rustfmt 2019-03-10 22:12:26 +01:00
flip1995
3282955238
Update tests 2019-03-10 22:07:10 +01:00
Alexander Regueiro
a7c0800938 Reblessed test outputs. 2019-03-10 18:13:15 +00:00
Alexander Regueiro
d2b85323ad Addressed points raised in review. 2019-03-10 18:06:28 +00:00
Alexander Regueiro
d43966a176 Various cosmetic improvements. 2019-03-10 18:06:28 +00:00
Manish Goregaokar
038ec7f5d8 Move get_unwrap to restriction
fixes #3862
2019-03-09 13:48:06 -08:00
rchaser53
ae787d954e fix missing a semicolon 2019-03-07 23:26:47 +09:00
Michael Wright
7b948232ba Enable rustfix on unused_unit tests 2019-03-07 08:26:53 +02:00
Michael Wright
fbcf7eefb9 Add [rustfmt::skip] to unused_unit test 2019-03-07 08:13:59 +02:00
Michael Wright
131c8f6bf2 Add [rustfmt::skip] to doc_markdown tests 2019-03-07 08:03:15 +02:00
Félix Fischer
ddc718087f Renamed: Cyclomatic Complexity -> Cognitive Complexity
* Ran automatic naming update

* Formalized rename of `cyclomatic_complexity` to `cognitive_complexity`
** Added the rename to `lib.rs`
** Added rename test

* Added warning for deprecated key `cyclomatic_complexity_threshold` and tests for it

* Added deprecation status for Clippy's builtin attribute

* Updated tests for new builtin attribute renaming
2019-03-06 10:07:38 -03:00
Michael Wright
464ed58861 Ensure expect_fun_call bad suggestion is fixed
Closes #3839
2019-03-06 07:00:05 +02:00