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]
This commit is contained in:
parent
190d8bdbc6
commit
3faa6762c1
@ -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);
|
||||
|
@ -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.
|
||||
//
|
||||
@ -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};
|
||||
|
@ -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 {
|
||||
|
@ -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.
|
||||
//
|
||||
@ -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)
|
||||
|
@ -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.
|
||||
//
|
||||
@ -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) {
|
||||
@ -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 {
|
||||
@ -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 {
|
||||
@ -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),
|
||||
|
@ -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.
|
||||
//
|
||||
@ -758,6 +758,7 @@ fn free_handle(_handle: *()) {
|
||||
|
||||
#[cfg(unix)]
|
||||
fn translate_status(status: c_int) -> p::ProcessExit {
|
||||
#![allow(non_snake_case_functions)]
|
||||
#[cfg(target_os = "linux")]
|
||||
#[cfg(target_os = "android")]
|
||||
mod imp {
|
||||
|
@ -7,6 +7,7 @@
|
||||
// <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.
|
||||
#![allow(non_snake_case_functions)]
|
||||
|
||||
use std::rand::{Rng, task_rng};
|
||||
use std::str;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
@ -88,7 +88,7 @@ pub trait HomingIO {
|
||||
/// This function will move tasks to run on their home I/O scheduler. Note
|
||||
/// that this function does *not* pin the task to the I/O scheduler, but
|
||||
/// rather it simply moves it to running on the I/O scheduler.
|
||||
fn go_to_IO_home(&mut self) -> uint {
|
||||
fn go_to_io_home(&mut self) -> uint {
|
||||
let _f = ForbidUnwind::new("going home");
|
||||
|
||||
let cur_loop_id = local_id();
|
||||
@ -118,7 +118,7 @@ pub trait HomingIO {
|
||||
/// move the local task to its I/O scheduler and then return an RAII wrapper
|
||||
/// which will return the task home.
|
||||
fn fire_homing_missile(&mut self) -> HomingMissile {
|
||||
HomingMissile { io_home: self.go_to_IO_home() }
|
||||
HomingMissile { io_home: self.go_to_io_home() }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
//
|
||||
@ -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)
|
||||
|
@ -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.
|
||||
//
|
||||
@ -110,17 +110,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) {
|
||||
@ -136,6 +125,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 {
|
||||
@ -152,16 +150,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 {
|
||||
@ -592,8 +582,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),
|
||||
|
Loading…
x
Reference in New Issue
Block a user