Skip to content

Commit 3faa676

Browse files
committed
lib{std,core,debug,rustuv,collections,native,regex}: Fix snake_case errors.
A number of functions/methods have been moved or renamed to align better with rust standard conventions. std::reflect::MovePtrAdaptor => MovePtrAdaptor::new debug::reflect::MovePtrAdaptor => MovePtrAdaptor::new std::repr::ReprVisitor => ReprVisitor::new debug::repr::ReprVisitor => ReprVisitor::new rustuv::homing::HomingIO.go_to_IO_home => go_to_io_home [breaking-change]
1 parent 190d8bd commit 3faa676

File tree

10 files changed

+54
-69
lines changed

10 files changed

+54
-69
lines changed

src/libcollections/smallintmap.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -296,20 +296,20 @@ mod test_map {
296296

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

303-
fn addMoreToCount_simple(v0: uint, v1: uint) -> uint {
303+
fn add_more_to_count_simple(v0: uint, v1: uint) -> uint {
304304
v0 + v1
305305
}
306306

307307
// count integers
308-
map.update(3, 1, addMoreToCount_simple);
309-
map.update_with_key(9, 1, addMoreToCount);
310-
map.update(3, 7, addMoreToCount_simple);
311-
map.update_with_key(5, 3, addMoreToCount);
312-
map.update_with_key(3, 2, addMoreToCount);
308+
map.update(3, 1, add_more_to_count_simple);
309+
map.update_with_key(9, 1, add_more_to_count);
310+
map.update(3, 7, add_more_to_count_simple);
311+
map.update_with_key(5, 3, add_more_to_count);
312+
map.update_with_key(3, 2, add_more_to_count);
313313

314314
// check the total counts
315315
assert_eq!(map.find(&3).unwrap(), &10);

src/libcore/char.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -23,6 +23,7 @@
2323
//! however the converse is not always true due to the above range limits
2424
//! and, as such, should be performed via the `from_u32` function..
2525
26+
#![allow(non_snake_case_functions)]
2627

2728
use mem::transmute;
2829
use option::{None, Option, Some};

src/libcore/unicode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

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

13-
#![allow(missing_doc, non_uppercase_statics)]
13+
#![allow(missing_doc, non_uppercase_statics, non_snake_case_functions)]
1414

1515

1616
fn bsearch_range_table(c: char, r: &'static [(char,char)]) -> bool {

src/libdebug/reflect.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -42,11 +42,12 @@ pub fn align(size: uint, align: uint) -> uint {
4242
pub struct MovePtrAdaptor<V> {
4343
inner: V
4444
}
45-
pub fn MovePtrAdaptor<V:TyVisitor + MovePtr>(v: V) -> MovePtrAdaptor<V> {
46-
MovePtrAdaptor { inner: v }
47-
}
4845

4946
impl<V:TyVisitor + MovePtr> MovePtrAdaptor<V> {
47+
pub fn new(v: V) -> MovePtrAdaptor<V> {
48+
MovePtrAdaptor { inner: v }
49+
}
50+
5051
#[inline]
5152
pub fn bump(&mut self, sz: uint) {
5253
self.inner.move_ptr(|p| ((p as uint) + sz) as *u8)

src/libdebug/repr.rs

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -99,17 +99,6 @@ pub struct ReprVisitor<'a> {
9999
last_err: Option<io::IoError>,
100100
}
101101

102-
pub fn ReprVisitor<'a>(ptr: *u8,
103-
writer: &'a mut io::Writer) -> ReprVisitor<'a> {
104-
ReprVisitor {
105-
ptr: ptr,
106-
ptr_stk: vec!(),
107-
var_stk: vec!(),
108-
writer: writer,
109-
last_err: None,
110-
}
111-
}
112-
113102
impl<'a> MovePtr for ReprVisitor<'a> {
114103
#[inline]
115104
fn move_ptr(&mut self, adjustment: |*u8| -> *u8) {
@@ -125,6 +114,15 @@ impl<'a> MovePtr for ReprVisitor<'a> {
125114

126115
impl<'a> ReprVisitor<'a> {
127116
// Various helpers for the TyVisitor impl
117+
pub fn new(ptr: *u8, writer: &'a mut io::Writer) -> ReprVisitor<'a> {
118+
ReprVisitor {
119+
ptr: ptr,
120+
ptr_stk: vec!(),
121+
var_stk: vec!(),
122+
writer: writer,
123+
last_err: None,
124+
}
125+
}
128126

129127
#[inline]
130128
pub fn get<T>(&mut self, f: |&mut ReprVisitor, &T| -> bool) -> bool {
@@ -141,16 +139,8 @@ impl<'a> ReprVisitor<'a> {
141139
#[inline]
142140
pub fn visit_ptr_inner(&mut self, ptr: *u8, inner: *TyDesc) -> bool {
143141
unsafe {
144-
// This should call the constructor up above, but due to limiting
145-
// issues we have to recreate it here.
146-
let u = ReprVisitor {
147-
ptr: ptr,
148-
ptr_stk: vec!(),
149-
var_stk: vec!(),
150-
writer: mem::transmute_copy(&self.writer),
151-
last_err: None,
152-
};
153-
let mut v = reflect::MovePtrAdaptor(u);
142+
let u = ReprVisitor::new(ptr, mem::transmute_copy(&self.writer));
143+
let mut v = reflect::MovePtrAdaptor::new(u);
154144
// Obviously this should not be a thing, but blame #8401 for now
155145
visit_tydesc(inner, &mut v as &mut TyVisitor);
156146
match v.unwrap().last_err {
@@ -584,8 +574,8 @@ pub fn write_repr<T>(writer: &mut io::Writer, object: &T) -> io::IoResult<()> {
584574
unsafe {
585575
let ptr = object as *T as *u8;
586576
let tydesc = get_tydesc::<T>();
587-
let u = ReprVisitor(ptr, writer);
588-
let mut v = reflect::MovePtrAdaptor(u);
577+
let u = ReprVisitor::new(ptr, writer);
578+
let mut v = reflect::MovePtrAdaptor::new(u);
589579
visit_tydesc(tydesc, &mut v as &mut TyVisitor);
590580
match v.unwrap().last_err {
591581
Some(e) => Err(e),

src/libnative/io/process.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -758,6 +758,7 @@ fn free_handle(_handle: *()) {
758758

759759
#[cfg(unix)]
760760
fn translate_status(status: c_int) -> p::ProcessExit {
761+
#![allow(non_snake_case_functions)]
761762
#[cfg(target_os = "linux")]
762763
#[cfg(target_os = "android")]
763764
mod imp {

src/libregex/test/bench.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
10+
#![allow(non_snake_case_functions)]
1011

1112
use std::rand::{Rng, task_rng};
1213
use std::str;

src/librustuv/homing.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -88,7 +88,7 @@ pub trait HomingIO {
8888
/// This function will move tasks to run on their home I/O scheduler. Note
8989
/// that this function does *not* pin the task to the I/O scheduler, but
9090
/// rather it simply moves it to running on the I/O scheduler.
91-
fn go_to_IO_home(&mut self) -> uint {
91+
fn go_to_io_home(&mut self) -> uint {
9292
let _f = ForbidUnwind::new("going home");
9393

9494
let cur_loop_id = local_id();
@@ -118,7 +118,7 @@ pub trait HomingIO {
118118
/// move the local task to its I/O scheduler and then return an RAII wrapper
119119
/// which will return the task home.
120120
fn fire_homing_missile(&mut self) -> HomingMissile {
121-
HomingMissile { io_home: self.go_to_IO_home() }
121+
HomingMissile { io_home: self.go_to_io_home() }
122122
}
123123
}
124124

src/libstd/reflect.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -42,11 +42,12 @@ pub fn align(size: uint, align: uint) -> uint {
4242
pub struct MovePtrAdaptor<V> {
4343
inner: V
4444
}
45-
pub fn MovePtrAdaptor<V:TyVisitor + MovePtr>(v: V) -> MovePtrAdaptor<V> {
46-
MovePtrAdaptor { inner: v }
47-
}
4845

4946
impl<V:TyVisitor + MovePtr> MovePtrAdaptor<V> {
47+
pub fn new(v: V) -> MovePtrAdaptor<V> {
48+
MovePtrAdaptor { inner: v }
49+
}
50+
5051
#[inline]
5152
pub fn bump(&mut self, sz: uint) {
5253
self.inner.move_ptr(|p| ((p as uint) + sz) as *u8)

src/libstd/repr.rs

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -110,17 +110,6 @@ pub struct ReprVisitor<'a> {
110110
last_err: Option<io::IoError>,
111111
}
112112

113-
pub fn ReprVisitor<'a>(ptr: *u8,
114-
writer: &'a mut io::Writer) -> ReprVisitor<'a> {
115-
ReprVisitor {
116-
ptr: ptr,
117-
ptr_stk: vec!(),
118-
var_stk: vec!(),
119-
writer: writer,
120-
last_err: None,
121-
}
122-
}
123-
124113
impl<'a> MovePtr for ReprVisitor<'a> {
125114
#[inline]
126115
fn move_ptr(&mut self, adjustment: |*u8| -> *u8) {
@@ -136,6 +125,15 @@ impl<'a> MovePtr for ReprVisitor<'a> {
136125

137126
impl<'a> ReprVisitor<'a> {
138127
// Various helpers for the TyVisitor impl
128+
pub fn new(ptr: *u8, writer: &'a mut io::Writer) -> ReprVisitor<'a> {
129+
ReprVisitor {
130+
ptr: ptr,
131+
ptr_stk: vec!(),
132+
var_stk: vec!(),
133+
writer: writer,
134+
last_err: None,
135+
}
136+
}
139137

140138
#[inline]
141139
pub fn get<T>(&mut self, f: |&mut ReprVisitor, &T| -> bool) -> bool {
@@ -152,16 +150,8 @@ impl<'a> ReprVisitor<'a> {
152150
#[inline]
153151
pub fn visit_ptr_inner(&mut self, ptr: *u8, inner: *TyDesc) -> bool {
154152
unsafe {
155-
// This should call the constructor up above, but due to limiting
156-
// issues we have to recreate it here.
157-
let u = ReprVisitor {
158-
ptr: ptr,
159-
ptr_stk: vec!(),
160-
var_stk: vec!(),
161-
writer: ::mem::transmute_copy(&self.writer),
162-
last_err: None,
163-
};
164-
let mut v = reflect::MovePtrAdaptor(u);
153+
let u = ReprVisitor::new(ptr, ::mem::transmute_copy(&self.writer));
154+
let mut v = reflect::MovePtrAdaptor::new(u);
165155
// Obviously this should not be a thing, but blame #8401 for now
166156
visit_tydesc(inner, &mut v as &mut TyVisitor);
167157
match v.unwrap().last_err {
@@ -592,8 +582,8 @@ pub fn write_repr<T>(writer: &mut io::Writer, object: &T) -> io::IoResult<()> {
592582
unsafe {
593583
let ptr = object as *T as *u8;
594584
let tydesc = get_tydesc::<T>();
595-
let u = ReprVisitor(ptr, writer);
596-
let mut v = reflect::MovePtrAdaptor(u);
585+
let u = ReprVisitor::new(ptr, writer);
586+
let mut v = reflect::MovePtrAdaptor::new(u);
597587
visit_tydesc(tydesc, &mut v as &mut TyVisitor);
598588
match v.unwrap().last_err {
599589
Some(e) => Err(e),

0 commit comments

Comments
 (0)