From f393100b7ce86e0c1201f003c2d69fb9ea742db1 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Sun, 2 Sep 2012 18:13:48 -0700 Subject: [PATCH] Camel case core::ops --- src/libcore/at_vec.rs | 2 +- src/libcore/core.rs | 18 +++++----- src/libcore/dvec.rs | 2 +- src/libcore/ops.rs | 34 +++++++++---------- src/libcore/str.rs | 2 +- src/libcore/vec.rs | 4 +-- src/libstd/bitv.rs | 2 +- src/libstd/ebml.rs | 2 +- src/libstd/map.rs | 2 +- src/libstd/smallintmap.rs | 2 +- src/rustc/middle/ty.rs | 6 ++-- src/test/bench/shootout-mandelbrot.rs | 4 +-- .../borrowck-loan-rcvr-overloaded-op.rs | 2 +- src/test/run-pass/operator-overloading.rs | 8 ++--- 14 files changed, 44 insertions(+), 46 deletions(-) diff --git a/src/libcore/at_vec.rs b/src/libcore/at_vec.rs index 54f3ff0fc82..aa937328486 100644 --- a/src/libcore/at_vec.rs +++ b/src/libcore/at_vec.rs @@ -133,7 +133,7 @@ pure fn from_elem(n_elts: uint, t: T) -> @[T] { } #[cfg(notest)] -impl @[T]: add<&[const T],@[T]> { +impl @[T]: Add<&[const T],@[T]> { #[inline(always)] pure fn add(rhs: &[const T]) -> @[T] { append(self, rhs) diff --git a/src/libcore/core.rs b/src/libcore/core.rs index 4d875e45796..a6ac68c1882 100644 --- a/src/libcore/core.rs +++ b/src/libcore/core.rs @@ -44,28 +44,28 @@ export ToStr; // The compiler has special knowlege of these so we must not duplicate them // when compiling for testing #[cfg(notest)] -import ops::{const, copy, send, owned}; +import ops::{Const, Copy, Send, Owned}; #[cfg(notest)] -import ops::{add, sub, mul, div, modulo, neg, bitand, bitor, bitxor}; +import ops::{Add, Sub, Mul, Div, Modulo, Neg, BitAnd, BitOr, BitXor}; #[cfg(notest)] -import ops::{shl, shr, index}; +import ops::{Shl, Shr, Index}; #[cfg(notest)] -export const, copy, send, owned; +export Const, Copy, Send, Owned; #[cfg(notest)] -export add, sub, mul, div, modulo, neg, bitand, bitor, bitxor; +export Add, Sub, Mul, Div, Modulo, Neg, BitAnd, BitOr, BitXor; #[cfg(notest)] -export shl, shr, index; +export Shl, Shr, Index; #[cfg(test)] use coreops(name = "core", vers = "0.4"); #[cfg(test)] -import coreops::ops::{const, copy, send, owned}; +import coreops::ops::{Const, Copy, Send, Owned}; #[cfg(test)] -import coreops::ops::{add, sub, mul, div, modulo, neg, bitand, bitor, bitxor}; +import coreops::ops::{Add, Sub, Mul, Div, Modulo, Neg, BitAnd, BitOr, BitXor}; #[cfg(test)] -import coreops::ops::{shl, shr, index}; +import coreops::ops::{Shl, Shr, Index}; // Export the log levels as global constants. Higher levels mean diff --git a/src/libcore/dvec.rs b/src/libcore/dvec.rs index 0fffec961df..af2a45d4267 100644 --- a/src/libcore/dvec.rs +++ b/src/libcore/dvec.rs @@ -327,7 +327,7 @@ impl DVec { } } -impl DVec: index { +impl DVec: Index { pure fn index(&&idx: uint) -> A { self.get_elt(idx) } diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs index 07096968f4c..4e8b36a43fb 100644 --- a/src/libcore/ops.rs +++ b/src/libcore/ops.rs @@ -1,100 +1,98 @@ // Core operators and kinds. -#[allow(non_camel_case_types)]; - #[cfg(notest)] #[lang="const"] -trait const { +trait Const { // Empty. } #[cfg(notest)] #[lang="copy"] -trait copy { +trait Copy { // Empty. } #[cfg(notest)] #[lang="send"] -trait send { +trait Send { // Empty. } #[cfg(notest)] #[lang="owned"] -trait owned { +trait Owned { // Empty. } #[cfg(notest)] #[lang="add"] -trait add { +trait Add { pure fn add(rhs: RHS) -> Result; } #[cfg(notest)] #[lang="sub"] -trait sub { +trait Sub { pure fn sub(rhs: RHS) -> Result; } #[cfg(notest)] #[lang="mul"] -trait mul { +trait Mul { pure fn mul(rhs: RHS) -> Result; } #[cfg(notest)] #[lang="div"] -trait div { +trait Div { pure fn div(rhs: RHS) -> Result; } #[cfg(notest)] #[lang="modulo"] -trait modulo { +trait Modulo { pure fn modulo(rhs: RHS) -> Result; } #[cfg(notest)] #[lang="neg"] -trait neg { +trait Neg { pure fn neg() -> Result; } #[cfg(notest)] #[lang="bitand"] -trait bitand { +trait BitAnd { pure fn bitand(rhs: RHS) -> Result; } #[cfg(notest)] #[lang="bitor"] -trait bitor { +trait BitOr { pure fn bitor(rhs: RHS) -> Result; } #[cfg(notest)] #[lang="bitxor"] -trait bitxor { +trait BitXor { pure fn bitxor(rhs: RHS) -> Result; } #[cfg(notest)] #[lang="shl"] -trait shl { +trait Shl { pure fn shl(rhs: RHS) -> Result; } #[cfg(notest)] #[lang="shr"] -trait shr { +trait Shr { pure fn shr(rhs: RHS) -> Result; } #[cfg(notest)] #[lang="index"] -trait index { +trait Index { pure fn index(index: Index) -> Result; } diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 800b4a130e6..b3f58ce2558 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -2065,7 +2065,7 @@ impl ~str: UniqueStr { } #[cfg(notest)] -impl ~str: add<&str,~str> { +impl ~str: Add<&str,~str> { #[inline(always)] pure fn add(rhs: &str) -> ~str { append(copy self, rhs) diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index 680eb1e2dcb..5242505565a 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -1480,14 +1480,14 @@ impl @[T]: Ord { } #[cfg(notest)] -impl ~[T]: add<&[const T],~[T]> { +impl ~[T]: Add<&[const T],~[T]> { #[inline(always)] pure fn add(rhs: &[const T]) -> ~[T] { append(copy self, rhs) } } -impl ~[mut T]: add<&[const T],~[mut T]> { +impl ~[mut T]: Add<&[const T],~[mut T]> { #[inline(always)] pure fn add(rhs: &[const T]) -> ~[mut T] { append_mut(self, rhs) diff --git a/src/libstd/bitv.rs b/src/libstd/bitv.rs index 5d21461eb49..da622625959 100644 --- a/src/libstd/bitv.rs +++ b/src/libstd/bitv.rs @@ -469,7 +469,7 @@ pure fn land(w0: uint, w1: uint) -> uint { return w0 & w1; } pure fn right(_w0: uint, w1: uint) -> uint { return w1; } -impl Bitv: ops::index { +impl Bitv: ops::Index { pure fn index(&&i: uint) -> bool { self.get(i) } diff --git a/src/libstd/ebml.rs b/src/libstd/ebml.rs index 8f9987be348..71de166795f 100644 --- a/src/libstd/ebml.rs +++ b/src/libstd/ebml.rs @@ -41,7 +41,7 @@ type Doc = {data: @~[u8], start: uint, end: uint}; type TaggedDoc = {tag: uint, doc: Doc}; -impl Doc: ops::index { +impl Doc: ops::Index { pure fn index(&&tag: uint) -> Doc { unchecked { get_doc(self, tag) diff --git a/src/libstd/map.rs b/src/libstd/map.rs index 9e2770a1f02..20c48d6dda7 100644 --- a/src/libstd/map.rs +++ b/src/libstd/map.rs @@ -367,7 +367,7 @@ mod chained { } } - impl t: ops::index { + impl t: ops::Index { pure fn index(&&k: K) -> V { unchecked { self.get(k) diff --git a/src/libstd/smallintmap.rs b/src/libstd/smallintmap.rs index bc830b4fd9c..4535344b968 100644 --- a/src/libstd/smallintmap.rs +++ b/src/libstd/smallintmap.rs @@ -134,7 +134,7 @@ impl smallintmap: map::map { } } -impl smallintmap: ops::index { +impl smallintmap: ops::Index { pure fn index(&&key: uint) -> V { unchecked { get(self, key) diff --git a/src/rustc/middle/ty.rs b/src/rustc/middle/ty.rs index 1d28e035141..d467f3b5be5 100644 --- a/src/rustc/middle/ty.rs +++ b/src/rustc/middle/ty.rs @@ -1605,7 +1605,7 @@ fn remove_copyable(k: kind) -> kind { k - kind_(KIND_MASK_COPY | KIND_MASK_DEFAULT_MODE) } -impl kind: ops::bitand { +impl kind: ops::BitAnd { pure fn bitand(other: kind) -> kind { unchecked { lower_kind(self, other) @@ -1613,7 +1613,7 @@ impl kind: ops::bitand { } } -impl kind: ops::bitor { +impl kind: ops::BitOr { pure fn bitor(other: kind) -> kind { unchecked { raise_kind(self, other) @@ -1621,7 +1621,7 @@ impl kind: ops::bitor { } } -impl kind: ops::sub { +impl kind: ops::Sub { pure fn sub(other: kind) -> kind { unchecked { kind_(*self & !*other) diff --git a/src/test/bench/shootout-mandelbrot.rs b/src/test/bench/shootout-mandelbrot.rs index fc011952be3..d203e7578b8 100644 --- a/src/test/bench/shootout-mandelbrot.rs +++ b/src/test/bench/shootout-mandelbrot.rs @@ -21,7 +21,7 @@ struct cmplx { im: f64; } -impl cmplx : ops::mul { +impl cmplx : ops::Mul { pure fn mul(x: cmplx) -> cmplx { cmplx { re: self.re*x.re - self.im*x.im, @@ -30,7 +30,7 @@ impl cmplx : ops::mul { } } -impl cmplx : ops::add { +impl cmplx : ops::Add { pure fn add(x: cmplx) -> cmplx { cmplx { re: self.re + x.re, diff --git a/src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs b/src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs index ecaad792fb9..dcaa53d37fc 100644 --- a/src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs +++ b/src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs @@ -3,7 +3,7 @@ struct Point { y: int; } -impl Point : ops::add { +impl Point : ops::Add { pure fn add(&&z: int) -> int { self.x + self.y + z } diff --git a/src/test/run-pass/operator-overloading.rs b/src/test/run-pass/operator-overloading.rs index 9ba91ee67d3..92bde631fcf 100644 --- a/src/test/run-pass/operator-overloading.rs +++ b/src/test/run-pass/operator-overloading.rs @@ -3,25 +3,25 @@ struct Point { y: int; } -impl Point : ops::add { +impl Point : ops::Add { pure fn add(other: Point) -> Point { Point {x: self.x + other.x, y: self.y + other.y} } } -impl Point : ops::sub { +impl Point : ops::Sub { pure fn sub(other: Point) -> Point { Point {x: self.x - other.x, y: self.y - other.y} } } -impl Point : ops::neg { +impl Point : ops::Neg { pure fn neg() -> Point { Point {x: -self.x, y: -self.y} } } -impl Point : ops::index { +impl Point : ops::Index { pure fn index(&&x: bool) -> int { if x { self.x } else { self.y } }