Point at signature on unused lint

This commit is contained in:
Esteban Küber 2017-09-25 12:01:55 -07:00
parent 14039a42ac
commit 9c3fa4d3ef
5 changed files with 102 additions and 16 deletions

View file

@ -2,7 +2,7 @@ warning: function is never used: `lintme`
--> $DIR/lint-plugin-cmdline-allow.rs:20:1
|
20 | fn lintme() { }
| ^^^^^^^^^^^^^^^
| ^^^^^^^^^^^
|
note: lint level defined here
--> $DIR/lint-plugin-cmdline-allow.rs:17:9

View file

@ -9,10 +9,8 @@ warning: unnecessary parentheses around `return` value
warning: function is never used: `with_parens`
--> $DIR/path-lookahead.rs:17:1
|
17 | / fn with_parens<T: ToString>(arg: T) -> String { //~WARN function is never used: `with_parens`
18 | | return (<T as ToString>::to_string(&arg)); //~WARN unnecessary parentheses around `return` value
19 | | }
| |_^
17 | fn with_parens<T: ToString>(arg: T) -> String { //~WARN function is never used: `with_parens`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: lint level defined here
--> $DIR/path-lookahead.rs:13:9
@ -24,8 +22,6 @@ note: lint level defined here
warning: function is never used: `no_parens`
--> $DIR/path-lookahead.rs:21:1
|
21 | / fn no_parens<T: ToString>(arg: T) -> String { //~WARN function is never used: `no_parens`
22 | | return <T as ToString>::to_string(&arg);
23 | | }
| |_^
21 | fn no_parens<T: ToString>(arg: T) -> String { //~WARN function is never used: `no_parens`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -0,0 +1,40 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// run-pass
#![warn(unused)]
enum Enum {
A,
B,
C,
D,
}
struct Struct {
a: usize,
b: usize,
c: usize,
d: usize,
}
fn func() -> usize {
3
}
fn
func_complete_span()
-> usize
{
3
}
fn main() {}

View file

@ -0,0 +1,36 @@
warning: enum is never used: `Enum`
--> $DIR/unused-warning-point-at-signature.rs:15:1
|
15 | enum Enum {
| ^^^^^^^^^
|
note: lint level defined here
--> $DIR/unused-warning-point-at-signature.rs:13:9
|
13 | #![warn(unused)]
| ^^^^^^
= note: #[warn(dead_code)] implied by #[warn(unused)]
warning: struct is never used: `Struct`
--> $DIR/unused-warning-point-at-signature.rs:22:1
|
22 | struct Struct {
| ^^^^^^^^^^^^^
warning: function is never used: `func`
--> $DIR/unused-warning-point-at-signature.rs:29:1
|
29 | fn func() -> usize {
| ^^^^^^^^^^^^^^^^^^
warning: function is never used: `func_complete_span`
--> $DIR/unused-warning-point-at-signature.rs:33:1
|
33 | / fn
34 | | func_complete_span()
35 | | -> usize
36 | | {
37 | | 3
38 | | }
| |_^