Add RustcEncodable test

This commit is contained in:
Devon Hollowood 2015-12-21 01:40:19 -08:00
parent b190aa7deb
commit b6766a0dcf
3 changed files with 17 additions and 9 deletions

View File

@ -24,6 +24,7 @@ compiletest_rs = "0.0.11"
regex = "*"
regex_macros = "*"
lazy_static = "*"
rustc-serialize = "0.3"
[features]

View File

@ -12,14 +12,6 @@ fn in_macro(_foo: u32) {
println!("{}", _foo); //~ ERROR used binding which is prefixed with an underscore
}
// TODO: This doesn't actually correctly test this. Need to find a #[derive(...)] which sets off
// the lint if the `in_attributes_expansion` test isn't there
/// Test that we do not lint for unused underscores in a MacroAttribute expansion
#[derive(Clone)]
struct MacroAttributesTest {
_foo: u32,
}
// Struct for testing use of fields prefixed with an underscore
struct StructFieldTest {
_underscore_field: u32,
@ -76,7 +68,6 @@ fn non_variables() {
fn main() {
let foo = 0u32;
let _ = MacroAttributesTest{_foo: 0};
// tests of unused_underscore lint
let _ = prefix_underscore(foo);
in_macro(foo);

View File

@ -0,0 +1,16 @@
#![feature(plugin)]
#![plugin(clippy)]
extern crate rustc_serialize;
/// Test that we do not lint for unused underscores in a MacroAttribute expansion
#[deny(used_underscore_binding)]
#[derive(RustcEncodable)]
struct MacroAttributesTest {
_foo: u32,
}
#[test]
fn macro_attributes_test() {
let _ = MacroAttributesTest{_foo: 0};
}