Skip to content

Commit b6766a0

Browse files
Add RustcEncodable test
1 parent b190aa7 commit b6766a0

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ compiletest_rs = "0.0.11"
2424
regex = "*"
2525
regex_macros = "*"
2626
lazy_static = "*"
27+
rustc-serialize = "0.3"
2728

2829
[features]
2930

tests/compile-fail/used_underscore_binding.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@ fn in_macro(_foo: u32) {
1212
println!("{}", _foo); //~ ERROR used binding which is prefixed with an underscore
1313
}
1414

15-
// TODO: This doesn't actually correctly test this. Need to find a #[derive(...)] which sets off
16-
// the lint if the `in_attributes_expansion` test isn't there
17-
/// Test that we do not lint for unused underscores in a MacroAttribute expansion
18-
#[derive(Clone)]
19-
struct MacroAttributesTest {
20-
_foo: u32,
21-
}
22-
2315
// Struct for testing use of fields prefixed with an underscore
2416
struct StructFieldTest {
2517
_underscore_field: u32,
@@ -76,7 +68,6 @@ fn non_variables() {
7668

7769
fn main() {
7870
let foo = 0u32;
79-
let _ = MacroAttributesTest{_foo: 0};
8071
// tests of unused_underscore lint
8172
let _ = prefix_underscore(foo);
8273
in_macro(foo);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#![feature(plugin)]
2+
#![plugin(clippy)]
3+
4+
extern crate rustc_serialize;
5+
6+
/// Test that we do not lint for unused underscores in a MacroAttribute expansion
7+
#[deny(used_underscore_binding)]
8+
#[derive(RustcEncodable)]
9+
struct MacroAttributesTest {
10+
_foo: u32,
11+
}
12+
13+
#[test]
14+
fn macro_attributes_test() {
15+
let _ = MacroAttributesTest{_foo: 0};
16+
}

0 commit comments

Comments
 (0)