about summary refs log tree commit diff
path: root/src/test/ui/lint
AgeCommit message (Collapse)AuthorLines
2018-05-21update testsManish Goregaokar-0/+16
2018-05-20avoid reporting twiceF001-11/+0
2018-05-20Fix according to commentsF001-7/+16
2018-05-20re-implementF001-0/+37
2018-05-19Auto merge of #50893 - kennytm:rollup, r=kennytmbors-15/+30
Rollup of 8 pull requests Successful merges: - #50531 (Cleanup uses of TypeIdHasher and replace them with StableHasher) - #50819 (Fix potential divide by zero) - #50827 (Update LLVM to 56c931901cfb85cd6f7ed44c7d7520a8de1edf97) - #50829 (CheckLoopVisitor: also visit break expressions) - #50854 (in which the unused shorthand field pattern debacle/saga continues) - #50858 (Reorder description for snippets in rustdoc documentation) - #50883 (Fix warning when building stage0 libcore) - #50889 (Update clippy) Failed merges:
2018-05-18Default `unused_labels` to allow, move to "unused"Kyle Stachowicz-10/+24
2018-05-18Add tests for new labeled blocks for `unused_labels`Kyle Stachowicz-9/+26
2018-05-18Reimplement unused_labels lint as a compiler builtin in the resolverKyle Stachowicz-0/+128
2018-05-18Revert "Add lint checks for unused loop labels"Kyle Stachowicz-129/+0
This functionality is being reimplemented in the resolver phase This reverts commit 503a69e844970476b27bf1ac7be951bb22194f50.
2018-05-18Add test case for shadowed labels, with the inner broken multiple timesKyle Stachowicz-8/+37
2018-05-18Rename `unused_loop_label` to `unused_label` and fix/clean up lint logicKyle Stachowicz-9/+9
2018-05-18Add additional test case to unused_label lintKyle Stachowicz-22/+35
2018-05-18Rename test to `unused_label` and remove empty `stdout` fileKyle Stachowicz-0/+0
2018-05-18Add lint checks for unused loop labelsKyle Stachowicz-0/+87
2018-05-18in which the unused shorthand field pattern debacle/saga continuesZack M. Davis-15/+30
In e4b1a79 (#47922), we corrected erroneous suggestions for unused shorthand field pattern bindings, suggesting `field: _` where the previous suggestion of `_field` wouldn't even have compiled (#47390). Soon, it was revealed that this was insufficient (#50303), and the fix was extended to references, slices, &c. (#50327) But even this proved inadequate, as the erroneous suggestions were still being issued for patterns in local (`let`) bindings (#50804). Here, we yank the shorthand-detection and variable/node registration code into a new common function that can be called while visiting both match arms and `let` bindings. Resolves #50804.
2018-05-14Auto merge of #50675 - csmoe:var_span, r=oli-obkbors-10/+55
Reduce span highlighted code in unused_variables lint Fixes #50472 - [X] reduce var span - [ ] mark applicable Before: ``` mut unused_mut_var ^^^^^^^^^^^^^^^^^^ ``` After: ``` mut unused_mut_var ^^^^^^^^^^^^^^ ```
2018-05-13Revert "mark applicability"csmoe-1/+0
This reverts commit a8809711285d2375ee98177f9e78090047514fb2.
2018-05-13mark applicabilitycsmoe-0/+1
2018-05-13reduce variable spancsmoe-10/+55
2018-05-10don't make crazy suggestion for unreachable braced pub-useZack M. Davis-24/+42
The Higher Intermediate Representation doesn't have spans for visibility keywords, so we were assuming that the first whitespace-delimited token in the item span was the `pub` to be weakened. This doesn't work for brace-grouped `use`s, which get lowered as if they were several individual `use` statements, but with spans that only cover the braced path-segments. Constructing a correct suggestion here presents some challenges—until someone works those out, we can at least protect the dignity of our compiler marking the suggestion for `use` items as potentially incorrect. This resolves #50455 (but again, it would be desirable in the future to make a correct suggestion instead of copping out like this).
2018-04-30Auto merge of #48925 - zackmdavis:fn_must_stabilize, r=nikomatsakisbors-23/+22
stabilize `#[must_use]` for functions and must-use comparison operators (RFC 1940) r? @nikomatsakis
2018-05-01Rollup merge of #50327 - varkor:match-unused-struct-field, r=estebankkennytm-6/+85
Display correct unused field suggestion for nested struct patterns Extends https://github.com/rust-lang/rust/pull/47922 by checking more sophisticated patterns (e.g. references, slices, etc.). Before: ``` warning: unused variable: `bar` --> src/main.rs:37:21 | 37 | &Foo::Bar { bar } => true, | ^^^ help: consider using `_bar` instead | = note: #[warn(unused_variables)] on by default ``` After: ``` warning: unused variable: `bar` --> src/main.rs:37:21 | 37 | &Foo::Bar { bar } => true, | ^^^ help: try ignoring the field: `bar: _` | = note: #[warn(unused_variables)] on by default ``` Fixes #50303. r? @estebank
2018-04-30Correct unused field warning on struct match container patternsvarkor-6/+55
2018-04-30Correct unused field warning on box struct matchvarkor-9/+21
2018-04-30Correct unused field warning on &struct matchvarkor-4/+22
2018-04-28stabilize `#[must_use]` for functions and must-use operatorsZack M. Davis-23/+22
This is in the matter of RFC 1940 and tracking issue #43302.
2018-04-22Make must_use lint cover all binary/unary operatorsAaron Aaeng-0/+184
2018-04-13Rename must-compile-successfully into compile-passGuillaume Gomez-15/+15
2018-03-26update testMark Mansi-7/+7
2018-03-26Stabilize i128_typeMark Mansi-2/+0
2018-03-14update testsGuillaume Gomez-2/+10
2018-03-02Remove isize testflip1995-11/+1
2018-03-01Adapt stderr of UI test to PR #48449flip1995-8/+8
2018-03-01Rewrite error reporting as requestedflip1995-17/+13
2018-03-01Suggest type for overflowing bin/hex-literalsflip1995-0/+105
2018-02-26Fix rebaseVadim Petrochenkov-10/+10
2018-02-26Update UI testsVadim Petrochenkov-7/+7
2018-02-26Update UI testsVadim Petrochenkov-80/+80
2018-02-25Update ui testsGuillaume Gomez-0/+2
2018-02-20Fix internal references to bad_style in test code.boats-3/+3
2018-02-20Fix filepath in lint test.boats-10/+10
2018-02-20Fix carets.boats-5/+5
2018-02-20Add nonstandard_style alias for bad_style.boats-0/+103
2018-02-07Rollup merge of #47922 - ↵Manish Goregaokar-0/+74
zackmdavis:and_the_case_of_the_unused_field_pattern, r=estebank correct unused field pattern suggestions ![unused_field_pattern_local](https://user-images.githubusercontent.com/1076988/35662336-7a69488a-06cc-11e8-9901-8d22b5cf924f.png) r? @estebank
2018-02-04Rollup merge of #47896 - ↵kennytm-0/+55
zackmdavis:and_the_case_of_the_necessary_unnecessary_parens, r=nikomatsakis decline to lint technically-unnecessary parens in function or method arguments inside of nested macros In #46980 ("in which the unused-parens lint..." (14982db2d6)), the unused-parens lint was made to check function and method arguments, which it previously did not (seemingly due to oversight rather than willful design). However, in #47775 and discussion thereon, user–developers of Geal/nom and graphql-rust/juniper reported that the lint was seemingly erroneously triggering on certain complex macros in those projects. While this doesn't seem like a bug in the lint in the particular strict sense that the expanded code would, in fact, contain unncecessary parentheses, it also doesn't seem like the sort of thing macro authors should have to think about: the spirit of the unused-parens lint is to prevent needless clutter in code, not to give macro authors extra heartache in the handling of token trees. We propose the expediency of declining to lint unused parentheses in function or method args inside of nested expansions: we believe that this should eliminate the petty, troublesome lint warnings reported in the issue, without forgoing the benefits of the lint in simpler macros. It seemed like too much duplicated code for the `Call` and `MethodCall` match arms to duplicate the nested-macro check in addition to each having their own `for` loop, so this occasioned a slight refactor so that the function and method cases could share code—hopefully the overall intent is at least no less clear to the gentle reader. This is concerning #47775.
2018-01-31concerning well-formed suggestions for unused shorthand field patternsZack M. Davis-0/+74
Previously, unused variables would get a note that the warning could be silenced by prefixing the variable with an underscore, but that doesn't work for field shorthand patterns, which the liveness analysis didn't know about. The "to avoid this warning" verbiage seemed unnecessary. Resolves #47390.
2018-01-30wherein the parens lint keeps its own counsel re args in nested macrosZack M. Davis-0/+55
In #46980 ("in which the unused-parens lint..." (14982db2d6)), the unused-parens lint was made to check function and method arguments, which it previously did not (seemingly due to oversight rather than willful design). However, in #47775 and discussion thereon, user–developers of Geal/nom and graphql-rust/juniper reported that the lint was seemingly erroneously triggering on certain complex macros in those projects. While this doesn't seem like a bug in the lint in the particular strict sense that the expanded code would, in fact, contain unncecessary parentheses, it also doesn't seem like the sort of thing macro authors should have to think about: the spirit of the unused-parens lint is to prevent needless clutter in code, not to give macro authors extra heartache in the handling of token trees. We propose the expediency of declining to lint unused parentheses in function or method args inside of nested expansions: we believe that this should eliminate the petty, troublesome lint warnings reported in the issue, without forgoing the benefits of the lint in simpler macros. It seemed like too much duplicated code for the `Call` and `MethodCall` match arms to duplicate the nested-macro check in addition to each having their own `for` loop, so this occasioned a slight refactor so that the function and method cases could share code—hopefully the overall intent is at least no less clear to the gentle reader. This is concerning #47775.
2018-01-26Consider all whitespace when preparing spanEsteban Küber-28/+46
2018-01-26Include space in suggestion `mut` in bindingsEsteban Küber-1/+1
2018-01-16in which the private no-mangle lints receive a valued lesson in humilityZack M. Davis-10/+32
The incompetent fool who added these suggestions in 38e5a964f2 apparently thought it was safe to assume that, because the offending function or static was unreachable, it would therefore have not have any existing visibility modifiers, making it safe for us to unconditionally suggest inserting `pub`. This isn't true. This resolves #47383.