2014-02-15 16:15:19 -05:00
|
|
|
// Copyright 2012-2014 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.
|
|
|
|
|
2014-06-21 03:39:03 -07:00
|
|
|
// ignore-tidy-linelength
|
|
|
|
|
2014-06-06 15:51:42 +02:00
|
|
|
#![allow(dead_code)]
|
2014-07-19 00:45:17 +12:00
|
|
|
#![deny(non_snake_case)]
|
2015-01-22 18:22:03 -08:00
|
|
|
#![feature(path)]
|
|
|
|
#![feature(io)]
|
2014-02-15 16:15:19 -05:00
|
|
|
|
2015-01-22 16:31:00 -08:00
|
|
|
use std::old_io::File;
|
|
|
|
use std::old_io::IoError;
|
2014-02-15 16:15:19 -05:00
|
|
|
|
2014-02-16 01:03:07 -05:00
|
|
|
struct Something {
|
2015-01-08 22:02:42 +11:00
|
|
|
X: usize //~ ERROR structure field `X` should have a snake case name such as `x`
|
2014-02-16 01:03:07 -05:00
|
|
|
}
|
|
|
|
|
2015-01-08 22:02:42 +11:00
|
|
|
fn test(Xx: usize) { //~ ERROR variable `Xx` should have a snake case name such as `xx`
|
2014-02-15 16:15:19 -05:00
|
|
|
println!("{}", Xx);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2015-01-08 22:02:42 +11:00
|
|
|
let Test: usize = 0; //~ ERROR variable `Test` should have a snake case name such as `test`
|
2014-02-15 16:15:19 -05:00
|
|
|
println!("{}", Test);
|
|
|
|
|
|
|
|
let mut f = File::open(&Path::new("something.txt"));
|
2014-12-20 15:20:51 +13:00
|
|
|
let mut buff = [0u8; 16];
|
2014-11-17 21:39:01 +13:00
|
|
|
match f.read(&mut buff) {
|
2014-02-15 16:15:19 -05:00
|
|
|
Ok(cnt) => println!("read this many bytes: {}", cnt),
|
2014-12-20 00:09:35 -08:00
|
|
|
Err(IoError{ kind: EndOfFile, .. }) => println!("Got end of file: {:?}", EndOfFile),
|
2014-11-20 16:57:36 +01:00
|
|
|
//~^ ERROR variable `EndOfFile` should have a snake case name such as `end_of_file`
|
2015-01-22 16:31:00 -08:00
|
|
|
//~^^ WARN `EndOfFile` is named the same as one of the variants of the type `std::old_io::IoErrorKind`
|
2014-02-15 16:15:19 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
test(1);
|
2014-02-16 01:03:07 -05:00
|
|
|
|
|
|
|
let _ = Something { X: 0 };
|
2014-02-15 16:15:19 -05:00
|
|
|
}
|
|
|
|
|