Skip to content

SnakeCaseLint #14520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 30, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions src/compiletest/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ fn run_cfail_test(config: &Config, props: &TestProps, testfile: &Path) {
let proc_res = compile_test(config, props, testfile);

if proc_res.status.success() {
fatal_ProcRes("compile-fail test compiled successfully!".to_string(),
fatal_proc_rec("compile-fail test compiled successfully!".to_string(),
&proc_res);
}

Expand All @@ -97,7 +97,7 @@ fn run_rfail_test(config: &Config, props: &TestProps, testfile: &Path) {
let proc_res = compile_test(config, props, testfile);

if !proc_res.status.success() {
fatal_ProcRes("compilation failed!".to_string(), &proc_res);
fatal_proc_rec("compilation failed!".to_string(), &proc_res);
}

exec_compiled_test(config, props, testfile)
Expand All @@ -108,7 +108,7 @@ fn run_rfail_test(config: &Config, props: &TestProps, testfile: &Path) {
// The value our Makefile configures valgrind to return on failure
static VALGRIND_ERR: int = 100;
if proc_res.status.matches_exit_status(VALGRIND_ERR) {
fatal_ProcRes("run-fail test isn't valgrind-clean!".to_string(),
fatal_proc_rec("run-fail test isn't valgrind-clean!".to_string(),
&proc_res);
}

Expand All @@ -120,7 +120,7 @@ fn check_correct_failure_status(proc_res: &ProcRes) {
// The value the rust runtime returns on failure
static RUST_ERR: int = 101;
if !proc_res.status.matches_exit_status(RUST_ERR) {
fatal_ProcRes(
fatal_proc_rec(
format!("failure produced the wrong error: {}", proc_res.status),
proc_res);
}
Expand All @@ -131,19 +131,19 @@ fn run_rpass_test(config: &Config, props: &TestProps, testfile: &Path) {
let mut proc_res = compile_test(config, props, testfile);

if !proc_res.status.success() {
fatal_ProcRes("compilation failed!".to_string(), &proc_res);
fatal_proc_rec("compilation failed!".to_string(), &proc_res);
}

proc_res = exec_compiled_test(config, props, testfile);

if !proc_res.status.success() {
fatal_ProcRes("test run failed!".to_string(), &proc_res);
fatal_proc_rec("test run failed!".to_string(), &proc_res);
}
} else {
let proc_res = jit_test(config, props, testfile);

if !proc_res.status.success() {
fatal_ProcRes("jit failed!".to_string(), &proc_res);
fatal_proc_rec("jit failed!".to_string(), &proc_res);
}
}
}
Expand Down Expand Up @@ -172,7 +172,7 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) {
"normal");

if !proc_res.status.success() {
fatal_ProcRes(format!("pretty-printing failed in round {}", round),
fatal_proc_rec(format!("pretty-printing failed in round {}", round),
&proc_res);
}

Expand Down Expand Up @@ -204,21 +204,21 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) {
let proc_res = typecheck_source(config, props, testfile, actual);

if !proc_res.status.success() {
fatal_ProcRes("pretty-printed source does not typecheck".to_string(),
fatal_proc_rec("pretty-printed source does not typecheck".to_string(),
&proc_res);
}
if props.no_pretty_expanded { return }

// additionally, run `--pretty expanded` and try to build it.
let proc_res = print_source(config, props, testfile, (*srcs.get(round)).clone(), "expanded");
if !proc_res.status.success() {
fatal_ProcRes(format!("pretty-printing (expanded) failed"), &proc_res);
fatal_proc_rec(format!("pretty-printing (expanded) failed"), &proc_res);
}

let ProcRes{ stdout: expanded_src, .. } = proc_res;
let proc_res = typecheck_source(config, props, testfile, expanded_src);
if !proc_res.status.success() {
fatal_ProcRes(format!("pretty-printed source (expanded) does \
fatal_proc_rec(format!("pretty-printed source (expanded) does \
not typecheck"),
&proc_res);
}
Expand Down Expand Up @@ -326,7 +326,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
// compile test file (it shoud have 'compile-flags:-g' in the header)
let compiler_run_result = compile_test(config, props, testfile);
if !compiler_run_result.status.success() {
fatal_ProcRes("compilation failed!".to_string(), &compiler_run_result);
fatal_proc_rec("compilation failed!".to_string(), &compiler_run_result);
}

let exe_file = make_exe_name(config, testfile);
Expand Down Expand Up @@ -517,7 +517,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
// compile test file (it shoud have 'compile-flags:-g' in the header)
let compile_result = compile_test(config, props, testfile);
if !compile_result.status.success() {
fatal_ProcRes("compilation failed!".to_string(), &compile_result);
fatal_proc_rec("compilation failed!".to_string(), &compile_result);
}

let exe_file = make_exe_name(config, testfile);
Expand Down Expand Up @@ -560,7 +560,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
let debugger_run_result = run_lldb(config, &exe_file, &debugger_script);

if !debugger_run_result.status.success() {
fatal_ProcRes("Error while running LLDB".to_string(),
fatal_proc_rec("Error while running LLDB".to_string(),
&debugger_run_result);
}

Expand Down Expand Up @@ -720,7 +720,7 @@ fn check_debugger_output(debugger_run_result: &ProcRes, check_lines: &[String])
}
}
if i != num_check_lines {
fatal_ProcRes(format!("line not found in debugger output: {}",
fatal_proc_rec(format!("line not found in debugger output: {}",
check_lines.get(i).unwrap()),
debugger_run_result);
}
Expand Down Expand Up @@ -764,22 +764,22 @@ fn check_error_patterns(props: &TestProps,
let missing_patterns =
props.error_patterns.slice(next_err_idx, props.error_patterns.len());
if missing_patterns.len() == 1u {
fatal_ProcRes(format!("error pattern '{}' not found!",
fatal_proc_rec(format!("error pattern '{}' not found!",
missing_patterns[0]),
proc_res);
} else {
for pattern in missing_patterns.iter() {
error(format!("error pattern '{}' not found!", *pattern));
}
fatal_ProcRes("multiple error patterns not found".to_string(),
fatal_proc_rec("multiple error patterns not found".to_string(),
proc_res);
}
}

fn check_no_compiler_crash(proc_res: &ProcRes) {
for line in proc_res.stderr.as_slice().lines() {
if line.starts_with("error: internal compiler error:") {
fatal_ProcRes("compiler encountered internal error".to_string(),
fatal_proc_rec("compiler encountered internal error".to_string(),
proc_res);
}
}
Expand Down Expand Up @@ -857,7 +857,7 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
}

if !was_expected && is_compiler_error_or_warning(line) {
fatal_ProcRes(format!("unexpected compiler error or warning: '{}'",
fatal_proc_rec(format!("unexpected compiler error or warning: '{}'",
line),
proc_res);
}
Expand All @@ -866,7 +866,7 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
for (i, &flag) in found_flags.iter().enumerate() {
if !flag {
let ee = expected_errors.get(i);
fatal_ProcRes(format!("expected {} on line {} not found: {}",
fatal_proc_rec(format!("expected {} on line {} not found: {}",
ee.kind, ee.line, ee.msg),
proc_res);
}
Expand Down Expand Up @@ -1047,7 +1047,7 @@ fn compose_and_run_compiler(
config.compile_lib_path.as_slice(),
None);
if !auxres.status.success() {
fatal_ProcRes(
fatal_proc_rec(
format!("auxiliary build of {} failed to compile: ",
abs_ab.display()),
&auxres);
Expand Down Expand Up @@ -1286,7 +1286,7 @@ fn error(err: String) { println!("\nerror: {}", err); }

fn fatal(err: String) -> ! { error(err); fail!(); }

fn fatal_ProcRes(err: String, proc_res: &ProcRes) -> ! {
fn fatal_proc_rec(err: String, proc_res: &ProcRes) -> ! {
print!("\n\
error: {}\n\
status: {}\n\
Expand Down Expand Up @@ -1562,35 +1562,35 @@ fn run_codegen_test(config: &Config, props: &TestProps,

let mut proc_res = compile_test_and_save_bitcode(config, props, testfile);
if !proc_res.status.success() {
fatal_ProcRes("compilation failed!".to_string(), &proc_res);
fatal_proc_rec("compilation failed!".to_string(), &proc_res);
}

proc_res = extract_function_from_bitcode(config, props, "test", testfile, "");
if !proc_res.status.success() {
fatal_ProcRes("extracting 'test' function failed".to_string(),
fatal_proc_rec("extracting 'test' function failed".to_string(),
&proc_res);
}

proc_res = disassemble_extract(config, props, testfile, "");
if !proc_res.status.success() {
fatal_ProcRes("disassembling extract failed".to_string(), &proc_res);
fatal_proc_rec("disassembling extract failed".to_string(), &proc_res);
}


let mut proc_res = compile_cc_with_clang_and_save_bitcode(config, props, testfile);
if !proc_res.status.success() {
fatal_ProcRes("compilation failed!".to_string(), &proc_res);
fatal_proc_rec("compilation failed!".to_string(), &proc_res);
}

proc_res = extract_function_from_bitcode(config, props, "test", testfile, "clang");
if !proc_res.status.success() {
fatal_ProcRes("extracting 'test' function failed".to_string(),
fatal_proc_rec("extracting 'test' function failed".to_string(),
&proc_res);
}

proc_res = disassemble_extract(config, props, testfile, "clang");
if !proc_res.status.success() {
fatal_ProcRes("disassembling extract failed".to_string(), &proc_res);
fatal_proc_rec("disassembling extract failed".to_string(), &proc_res);
}

let base = output_base_name(config, testfile);
Expand Down
1 change: 1 addition & 0 deletions src/doc/guide-ffi.md
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ extern crate libc;

#[cfg(target_os = "win32", target_arch = "x86")]
#[link(name = "kernel32")]
#[allow(non_snake_case_functions)]
extern "stdcall" {
fn SetEnvironmentVariableA(n: *u8, v: *u8) -> libc::c_int;
}
Expand Down
14 changes: 7 additions & 7 deletions src/libcollections/smallintmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,20 +296,20 @@ mod test_map {

// given a new key, initialize it with this new count,
// given an existing key, add more to its count
fn addMoreToCount(_k: uint, v0: uint, v1: uint) -> uint {
fn add_more_to_count(_k: uint, v0: uint, v1: uint) -> uint {
v0 + v1
}

fn addMoreToCount_simple(v0: uint, v1: uint) -> uint {
fn add_more_to_count_simple(v0: uint, v1: uint) -> uint {
v0 + v1
}

// count integers
map.update(3, 1, addMoreToCount_simple);
map.update_with_key(9, 1, addMoreToCount);
map.update(3, 7, addMoreToCount_simple);
map.update_with_key(5, 3, addMoreToCount);
map.update_with_key(3, 2, addMoreToCount);
map.update(3, 1, add_more_to_count_simple);
map.update_with_key(9, 1, add_more_to_count);
map.update(3, 7, add_more_to_count_simple);
map.update_with_key(5, 3, add_more_to_count);
map.update_with_key(3, 2, add_more_to_count);

// check the total counts
assert_eq!(map.find(&3).unwrap(), &10);
Expand Down
3 changes: 2 additions & 1 deletion src/libcore/char.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// 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.
//
Expand All @@ -23,6 +23,7 @@
//! however the converse is not always true due to the above range limits
//! and, as such, should be performed via the `from_u32` function..

#![allow(non_snake_case_functions)]

use mem::transmute;
use option::{None, Option, Some};
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/unicode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

// NOTE: The following code was generated by "src/etc/unicode.py", do not edit directly

#![allow(missing_doc, non_uppercase_statics)]
#![allow(missing_doc, non_uppercase_statics, non_snake_case_functions)]


fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {
Expand Down
9 changes: 5 additions & 4 deletions src/libdebug/reflect.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// 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.
//
Expand Down Expand Up @@ -42,11 +42,12 @@ pub fn align(size: uint, align: uint) -> uint {
pub struct MovePtrAdaptor<V> {
inner: V
}
pub fn MovePtrAdaptor<V:TyVisitor + MovePtr>(v: V) -> MovePtrAdaptor<V> {
MovePtrAdaptor { inner: v }
}

impl<V:TyVisitor + MovePtr> MovePtrAdaptor<V> {
pub fn new(v: V) -> MovePtrAdaptor<V> {
MovePtrAdaptor { inner: v }
}

#[inline]
pub fn bump(&mut self, sz: uint) {
self.inner.move_ptr(|p| ((p as uint) + sz) as *u8)
Expand Down
38 changes: 14 additions & 24 deletions src/libdebug/repr.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// 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.
//
Expand Down Expand Up @@ -99,17 +99,6 @@ pub struct ReprVisitor<'a> {
last_err: Option<io::IoError>,
}

pub fn ReprVisitor<'a>(ptr: *u8,
writer: &'a mut io::Writer) -> ReprVisitor<'a> {
ReprVisitor {
ptr: ptr,
ptr_stk: vec!(),
var_stk: vec!(),
writer: writer,
last_err: None,
}
}

impl<'a> MovePtr for ReprVisitor<'a> {
#[inline]
fn move_ptr(&mut self, adjustment: |*u8| -> *u8) {
Expand All @@ -125,6 +114,15 @@ impl<'a> MovePtr for ReprVisitor<'a> {

impl<'a> ReprVisitor<'a> {
// Various helpers for the TyVisitor impl
pub fn new(ptr: *u8, writer: &'a mut io::Writer) -> ReprVisitor<'a> {
ReprVisitor {
ptr: ptr,
ptr_stk: vec!(),
var_stk: vec!(),
writer: writer,
last_err: None,
}
}

#[inline]
pub fn get<T>(&mut self, f: |&mut ReprVisitor, &T| -> bool) -> bool {
Expand All @@ -141,16 +139,8 @@ impl<'a> ReprVisitor<'a> {
#[inline]
pub fn visit_ptr_inner(&mut self, ptr: *u8, inner: *TyDesc) -> bool {
unsafe {
// This should call the constructor up above, but due to limiting
// issues we have to recreate it here.
let u = ReprVisitor {
ptr: ptr,
ptr_stk: vec!(),
var_stk: vec!(),
writer: mem::transmute_copy(&self.writer),
last_err: None,
};
let mut v = reflect::MovePtrAdaptor(u);
let u = ReprVisitor::new(ptr, mem::transmute_copy(&self.writer));
let mut v = reflect::MovePtrAdaptor::new(u);
// Obviously this should not be a thing, but blame #8401 for now
visit_tydesc(inner, &mut v as &mut TyVisitor);
match v.unwrap().last_err {
Expand Down Expand Up @@ -584,8 +574,8 @@ pub fn write_repr<T>(writer: &mut io::Writer, object: &T) -> io::IoResult<()> {
unsafe {
let ptr = object as *T as *u8;
let tydesc = get_tydesc::<T>();
let u = ReprVisitor(ptr, writer);
let mut v = reflect::MovePtrAdaptor(u);
let u = ReprVisitor::new(ptr, writer);
let mut v = reflect::MovePtrAdaptor::new(u);
visit_tydesc(tydesc, &mut v as &mut TyVisitor);
match v.unwrap().last_err {
Some(e) => Err(e),
Expand Down
3 changes: 2 additions & 1 deletion src/liblibc/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// 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.
//
Expand Down Expand Up @@ -71,6 +71,7 @@
*/

#![allow(non_camel_case_types)]
#![allow(non_snake_case_functions)]
#![allow(non_uppercase_statics)]
#![allow(missing_doc)]
#![allow(uppercase_variables)]
Expand Down
Loading