name = "clippy"
crate_type = ["dylib"]
+
+
+[dev-dependencies.compiletest]
+git = "https://github.com/laumann/compiletest-rs.git"
+++ /dev/null
-#![feature(plugin)]
-
-#![plugin(clippy)]
-
-pub fn test(foo: Box<Vec<bool>>) {
- println!("{:?}", foo.get(0))
-}
-
-fn main(){
- test(Box::new(Vec::new()));
-}
\ No newline at end of file
+++ /dev/null
-#![feature(plugin)]
-
-#![plugin(clippy)]
-
-extern crate collections;
-use collections::linked_list::LinkedList;
-
-pub fn test(foo: LinkedList<uint>) {
- println!("{:?}", foo)
-}
-
-fn main(){
- test(LinkedList::new());
-}
\ No newline at end of file
+++ /dev/null
-#![feature(plugin)]
-
-#![plugin(clippy)]
-
-fn main(){
- let x = Some(1u);
- match x {
- Some(y) => println!("{:?}", y),
- _ => ()
- }
- // Not linted
- match x {
- Some(y) => println!("{:?}", y),
- None => ()
- }
- let z = (1u,1u);
- match z {
- (2...3, 7...9) => println!("{:?}", z),
- _ => {}
- }
-}
+++ /dev/null
-#![feature(plugin)]
-
-#![plugin(clippy)]
-
-fn the_answer(ref mut x: u8) {
- *x = 42;
-}
-
-fn main() {
- let mut x = 0;
- the_answer(x);
- println!("The answer is {}.", x);
-}
--- /dev/null
+#![feature(plugin)]
+
+#![plugin(clippy)]
+#![deny(clippy)]
+
+pub fn test(foo: Box<Vec<bool>>) { //~ ERROR You seem to be trying to use Box<Vec<T>>
+ println!("{:?}", foo.get(0))
+}
+
+fn main(){
+ test(Box::new(Vec::new()));
+}
\ No newline at end of file
--- /dev/null
+#![feature(plugin, collections)]
+
+#![plugin(clippy)]
+#![deny(clippy)]
+
+extern crate collections;
+use collections::linked_list::LinkedList;
+
+pub fn test(foo: LinkedList<u8>) { //~ ERROR I see you're using a LinkedList!
+ println!("{:?}", foo)
+}
+
+fn main(){
+ test(LinkedList::new());
+}
\ No newline at end of file
--- /dev/null
+#![feature(plugin)]
+
+#![plugin(clippy)]
+#![deny(clippy)]
+
+fn main(){
+ let x = Some(1u8);
+ match x { //~ ERROR You seem to be trying to use match
+ //~^ NOTE Try if let Some(y) = x { ... }
+ Some(y) => println!("{:?}", y),
+ _ => ()
+ }
+ // Not linted
+ match x {
+ Some(y) => println!("{:?}", y),
+ None => ()
+ }
+ let z = (1u8,1u8);
+ match z { //~ ERROR You seem to be trying to use match
+ //~^ NOTE Try if let (2...3, 7...9) = z { ... }
+ (2...3, 7...9) => println!("{:?}", z),
+ _ => {}
+ }
+}
--- /dev/null
+#![feature(plugin)]
+
+#![plugin(clippy)]
+#![deny(clippy)]
+#![allow(unused)]
+
+fn the_answer(ref mut x: u8) { //~ ERROR `ref` directly on a function argument is ignored
+ *x = 42;
+}
+
+fn main() {
+ let mut x = 0;
+ the_answer(x);
+ println!("The answer is {}.", x);
+}
--- /dev/null
+extern crate compiletest;
+
+use std::env;
+use std::process::Command;
+use std::path::PathBuf;
+
+fn run_mode(mode: &'static str) {
+
+ let mut config = compiletest::default_config();
+ let cfg_mode = mode.parse().ok().expect("Invalid mode");
+ config.target_rustcflags = Some("-L target/debug/".to_string());
+
+ config.mode = cfg_mode;
+ config.src_base = PathBuf::from(format!("tests/{}", mode));
+
+ compiletest::run_tests(&config);
+}
+
+#[test]
+fn compile_test() {
+ run_mode("compile-fail");
+ // run_mode("run-pass");
+}