2014-02-15 15:15:19 -06: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 05:39:03 -05:00
|
|
|
// ignore-tidy-linelength
|
|
|
|
|
2014-06-06 08:51:42 -05:00
|
|
|
#![allow(dead_code)]
|
2014-07-18 07:45:17 -05:00
|
|
|
#![deny(non_snake_case)]
|
2014-02-15 15:15:19 -06:00
|
|
|
|
|
|
|
use std::io::File;
|
|
|
|
use std::io::IoError;
|
|
|
|
|
2014-02-16 00:03:07 -06:00
|
|
|
struct Something {
|
2014-07-18 07:45:17 -05:00
|
|
|
X: uint //~ ERROR structure field `X` should have a snake case name such as `x`
|
2014-02-16 00:03:07 -06:00
|
|
|
}
|
|
|
|
|
2014-07-18 07:45:17 -05:00
|
|
|
fn test(Xx: uint) { //~ ERROR variable `Xx` should have a snake case name such as `xx`
|
2014-02-15 15:15:19 -06:00
|
|
|
println!("{}", Xx);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2014-07-18 07:45:17 -05:00
|
|
|
let Test: uint = 0; //~ ERROR variable `Test` should have a snake case name such as `test`
|
2014-02-15 15:15:19 -06:00
|
|
|
println!("{}", Test);
|
|
|
|
|
|
|
|
let mut f = File::open(&Path::new("something.txt"));
|
|
|
|
let mut buff = [0u8, ..16];
|
|
|
|
match f.read(buff) {
|
|
|
|
Ok(cnt) => println!("read this many bytes: {}", cnt),
|
2014-06-21 05:39:03 -05:00
|
|
|
Err(IoError{ kind: EndOfFile, .. }) => println!("Got end of file: {}", EndOfFile.to_string()),
|
2014-07-18 07:45:17 -05:00
|
|
|
//~^ ERROR variable `EndOfFile` should have a snake case name such as `end_of_file`
|
2014-02-15 15:15:19 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
test(1);
|
2014-02-16 00:03:07 -06:00
|
|
|
|
|
|
|
let _ = Something { X: 0 };
|
2014-02-15 15:15:19 -06:00
|
|
|
}
|
|
|
|
|