-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include space in suggestion mut
in bindings
#47465
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,101 +1,113 @@ | ||
warning: unnecessary parentheses around assigned value | ||
--> $DIR/suggestions.rs:46:21 | ||
--> $DIR/suggestions.rs:48:21 | ||
| | ||
46 | let mut a = (1); // should suggest no `mut`, no parens | ||
48 | let mut a = (1); // should suggest no `mut`, no parens | ||
| ^^^ help: remove these parentheses | ||
| | ||
note: lint level defined here | ||
--> $DIR/suggestions.rs:11:21 | ||
--> $DIR/suggestions.rs:13:21 | ||
| | ||
11 | #![warn(unused_mut, unused_parens)] // UI tests pass `-A unused`—see Issue #43896 | ||
13 | #![warn(unused_mut, unused_parens)] // UI tests pass `-A unused`—see Issue #43896 | ||
| ^^^^^^^^^^^^^ | ||
|
||
warning: use of deprecated attribute `no_debug`: the `#[no_debug]` attribute was an experimental feature that has been deprecated due to lack of demand. See https://github.com/rust-lang/rust/issues/29721 | ||
--> $DIR/suggestions.rs:41:1 | ||
--> $DIR/suggestions.rs:43:1 | ||
| | ||
41 | #[no_debug] // should suggest removal of deprecated attribute | ||
43 | #[no_debug] // should suggest removal of deprecated attribute | ||
| ^^^^^^^^^^^ help: remove this attribute | ||
| | ||
= note: #[warn(deprecated)] on by default | ||
|
||
warning: variable does not need to be mutable | ||
--> $DIR/suggestions.rs:46:13 | ||
--> $DIR/suggestions.rs:48:13 | ||
| | ||
46 | let mut a = (1); // should suggest no `mut`, no parens | ||
| ---^^ | ||
48 | let mut a = (1); // should suggest no `mut`, no parens | ||
| ----^ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. doesn't it seem like this is underlining one character more than is needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, hmm, I guess the point is that you would have to delete this character? Still, I feel like when we display it here we ought to strip trailing whitespace from the underlined stuff =) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm pushing that to a follow up PR. When the span is a single line, it'd make sense to do so, but on a multiline span it'd be better to just show the suggestion on its own, as proposed in the comment above. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok. |
||
| | | ||
| help: remove this `mut` | ||
| | ||
note: lint level defined here | ||
--> $DIR/suggestions.rs:11:9 | ||
--> $DIR/suggestions.rs:13:9 | ||
| | ||
11 | #![warn(unused_mut, unused_parens)] // UI tests pass `-A unused`—see Issue #43896 | ||
13 | #![warn(unused_mut, unused_parens)] // UI tests pass `-A unused`—see Issue #43896 | ||
| ^^^^^^^^^^ | ||
|
||
warning: variable does not need to be mutable | ||
--> $DIR/suggestions.rs:52:13 | ||
| | ||
52 | let mut | ||
| _____________^ | ||
| |_____________| | ||
| || | ||
53 | || b = 1; | ||
| ||____________-^ | ||
| |____________| | ||
| help: remove this `mut` | ||
|
||
warning: static is marked #[no_mangle], but not exported | ||
--> $DIR/suggestions.rs:14:14 | ||
--> $DIR/suggestions.rs:16:14 | ||
| | ||
14 | #[no_mangle] static SHENZHOU: usize = 1; // should suggest `pub` | ||
16 | #[no_mangle] static SHENZHOU: usize = 1; // should suggest `pub` | ||
| -^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | | ||
| help: try making it public: `pub` | ||
| | ||
= note: #[warn(private_no_mangle_statics)] on by default | ||
|
||
error: const items should never be #[no_mangle] | ||
--> $DIR/suggestions.rs:16:14 | ||
--> $DIR/suggestions.rs:18:14 | ||
| | ||
16 | #[no_mangle] const DISCOVERY: usize = 1; // should suggest `pub static` rather than `const` | ||
18 | #[no_mangle] const DISCOVERY: usize = 1; // should suggest `pub static` rather than `const` | ||
| -----^^^^^^^^^^^^^^^^^^^^^^ | ||
| | | ||
| help: try a static value: `pub static` | ||
| | ||
= note: #[deny(no_mangle_const_items)] on by default | ||
|
||
warning: functions generic over types must be mangled | ||
--> $DIR/suggestions.rs:20:1 | ||
--> $DIR/suggestions.rs:22:1 | ||
| | ||
19 | #[no_mangle] // should suggest removal (generics can't be no-mangle) | ||
21 | #[no_mangle] // should suggest removal (generics can't be no-mangle) | ||
| ------------ help: remove this attribute | ||
20 | pub fn defiant<T>(_t: T) {} | ||
22 | pub fn defiant<T>(_t: T) {} | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: #[warn(no_mangle_generic_items)] on by default | ||
|
||
warning: function is marked #[no_mangle], but not exported | ||
--> $DIR/suggestions.rs:24:1 | ||
--> $DIR/suggestions.rs:26:1 | ||
| | ||
24 | fn rio_grande() {} // should suggest `pub` | ||
26 | fn rio_grande() {} // should suggest `pub` | ||
| -^^^^^^^^^^^^^^^^^ | ||
| | | ||
| help: try making it public: `pub` | ||
| | ||
= note: #[warn(private_no_mangle_fns)] on by default | ||
|
||
warning: static is marked #[no_mangle], but not exported | ||
--> $DIR/suggestions.rs:31:18 | ||
--> $DIR/suggestions.rs:33:18 | ||
| | ||
31 | #[no_mangle] pub static DAUNTLESS: bool = true; | ||
33 | #[no_mangle] pub static DAUNTLESS: bool = true; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
warning: function is marked #[no_mangle], but not exported | ||
--> $DIR/suggestions.rs:33:18 | ||
--> $DIR/suggestions.rs:35:18 | ||
| | ||
33 | #[no_mangle] pub fn val_jean() {} | ||
35 | #[no_mangle] pub fn val_jean() {} | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
warning: denote infinite loops with `loop { ... }` | ||
--> $DIR/suggestions.rs:44:5 | ||
--> $DIR/suggestions.rs:46:5 | ||
| | ||
44 | while true { // should suggest `loop` | ||
46 | while true { // should suggest `loop` | ||
| ^^^^^^^^^^ help: use `loop` | ||
| | ||
= note: #[warn(while_true)] on by default | ||
|
||
warning: the `warp_factor:` in this pattern is redundant | ||
--> $DIR/suggestions.rs:51:23 | ||
--> $DIR/suggestions.rs:57:23 | ||
| | ||
51 | Equinox { warp_factor: warp_factor } => {} // should suggest shorthand | ||
57 | Equinox { warp_factor: warp_factor } => {} // should suggest shorthand | ||
| ------------^^^^^^^^^^^^ | ||
| | | ||
| help: remove this | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: maybe we can implement this and
span_through_char
in terms of some common?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see that the code is quite different. Never mind, not needed (yet).