Skip to content

Commit 2c78169

Browse files
committed
Merge pull request #4644 from martica/camel-case-option
Update more uses of Option, Some and None to camel case
2 parents 41adf9d + c89afc3 commit 2c78169

19 files changed

+50
-50
lines changed

src/libcore/option.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ pub pure fn chain_ref<T, U>(opt: &Option<T>,
149149
#[inline(always)]
150150
pub pure fn or<T>(opta: Option<T>, optb: Option<T>) -> Option<T> {
151151
/*!
152-
* Returns the leftmost some() value, or none if both are none.
152+
* Returns the leftmost Some() value, or None if both are None.
153153
*/
154154
match move opta {
155155
Some(move opta) => Some(move opta),

src/librustc/middle/borrowck/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ variables from reassigned if there may be pointers to their interior)
114114
Finally, in some cases, both dangers can arise. For example, something
115115
like the following:
116116
117-
let mut x = ~some(5);
117+
let mut x = ~Some(5);
118118
match x {
119-
~some(ref y) => { ... }
120-
~none => { ... }
119+
~Some(ref y) => { ... }
120+
~None => { ... }
121121
}
122122
123123
In this case, if `x` to be reassigned or `*x` were to be mutated, then

src/librustc/middle/borrowck/preserve.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ priv impl &preserve_ctxt {
226226
//
227227
// As an example, consider this scenario:
228228
//
229-
// let mut x = @some(3);
230-
// match *x { Some(y) {...} none {...} }
229+
// let mut x = @Some(3);
230+
// match *x { Some(y) {...} None {...} }
231231
//
232232
// Technically, the value `x` need only be rooted
233233
// in the `some` arm. However, we evaluate `x` in trans
@@ -236,8 +236,8 @@ priv impl &preserve_ctxt {
236236
//
237237
// As a second example, consider *this* scenario:
238238
//
239-
// let x = @mut @some(3);
240-
// match x { @@some(y) {...} @@none {...} }
239+
// let x = @mut @Some(3);
240+
// match x { @@Some(y) {...} @@None {...} }
241241
//
242242
// Here again, `x` need only be rooted in the `some` arm.
243243
// In this case, the value which needs to be rooted is

src/librustc/middle/trans/type_of.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ fn type_of(cx: @crate_ctxt, t: ty::t) -> TypeRef {
100100
// Replace any typedef'd types with their equivalent non-typedef
101101
// type. This ensures that all LLVM nominal types that contain
102102
// Rust types are defined as the same LLVM types. If we don't do
103-
// this then, e.g. `option<{myfield: bool}>` would be a different
104-
// type than `option<myrec>`.
103+
// this then, e.g. `Option<{myfield: bool}>` would be a different
104+
// type than `Option<myrec>`.
105105
let t_norm = ty::normalize_ty(cx.tcx, t);
106106

107107
if t != t_norm {

src/librustc/middle/typeck/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2696,7 +2696,7 @@ fn check_instantiable(tcx: ty::ctxt,
26962696
if !ty::is_instantiable(tcx, item_ty) {
26972697
tcx.sess.span_err(sp, fmt!("this type cannot be instantiated \
26982698
without an instance of itself; \
2699-
consider using `option<%s>`",
2699+
consider using `Option<%s>`",
27002700
ppaux::ty_to_str(tcx, item_ty)));
27012701
}
27022702
}

src/librustc/middle/typeck/infer/lattice.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,13 +492,13 @@ fn lattice_var_and_t<L:LatticeDir Combine,
492492
match self.bnd(a_bounds) {
493493
Some(ref a_bnd) => {
494494
// If a has an upper bound, return the LUB(a.ub, b)
495-
debug!("bnd=some(%s)", a_bnd.inf_str(self.infcx()));
495+
debug!("bnd=Some(%s)", a_bnd.inf_str(self.infcx()));
496496
lattice_dir_op(a_bnd, b)
497497
}
498498
None => {
499499
// If a does not have an upper bound, make b the upper bound of a
500500
// and then return b.
501-
debug!("bnd=none");
501+
debug!("bnd=None");
502502
let a_bounds = self.with_bnd(a_bounds, *b);
503503
do self.combine_fields().bnds(&a_bounds.lb, &a_bounds.ub).then {
504504
self.infcx().set(vb, a_id, Root(a_bounds, nde_a.rank));

src/libstd/net_tcp.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ fn read_future(sock: &TcpSocket, timeout_msecs: uint)
468468
* }
469469
* // this callback is ran when a new connection arrives
470470
* {|new_conn, kill_ch|
471-
* let cont_po = core::comm::port::<option<tcp_err_data>>();
471+
* let cont_po = core::comm::port::<Option<tcp_err_data>>();
472472
* let cont_ch = core::comm::chan(cont_po);
473473
* task::spawn {||
474474
* let accept_result = net::tcp::accept(new_conn);
@@ -484,9 +484,9 @@ fn read_future(sock: &TcpSocket, timeout_msecs: uint)
484484
* };
485485
* match core::comm::recv(cont_po) {
486486
* // shut down listen()
487-
* some(err_data) { core::comm::send(kill_chan, some(err_data)) }
487+
* Some(err_data) { core::comm::send(kill_chan, Some(err_data)) }
488488
* // wait for next connection
489-
* none {}
489+
* None {}
490490
* }
491491
* };
492492
* ~~~~~~~~~~~
@@ -593,7 +593,7 @@ pub fn accept(new_conn: TcpNewConnection)
593593
* callback's arguments are:
594594
* * `new_conn` - an opaque type that can be passed to
595595
* `net::tcp::accept` in order to be converted to a `tcp_socket`.
596-
* * `kill_ch` - channel of type `core::comm::chan<option<tcp_err_data>>`.
596+
* * `kill_ch` - channel of type `core::comm::chan<Option<tcp_err_data>>`.
597597
* this channel can be used to send a message to cause `listen` to begin
598598
* closing the underlying libuv data structures.
599599
*

src/libstd/rope.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ pub mod node {
893893
* # Return value
894894
*
895895
* * `option::None` if no transformation happened
896-
* * `option::some(x)` otherwise, in which case `x` has the same contents
896+
* * `option::Some(x)` otherwise, in which case `x` has the same contents
897897
* as `node` bot lower height and/or fragmentation.
898898
*/
899899
pub fn bal(node: @Node) -> Option<@Node> {

src/libstd/timer.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ pub fn sleep(iotask: IoTask, msecs: uint) {
100100
}
101101
102102
/**
103-
* Receive on a port for (up to) a specified time, then return an `option<T>`
103+
* Receive on a port for (up to) a specified time, then return an `Option<T>`
104104
*
105105
* This call will block to receive on the provided port for up to the
106106
* specified timeout. Depending on whether the provided port receives in that
107-
* time period, `recv_timeout` will return an `option<T>` representing the
107+
* time period, `recv_timeout` will return an `Option<T>` representing the
108108
* result.
109109
*
110110
* # Arguments
@@ -115,9 +115,9 @@ pub fn sleep(iotask: IoTask, msecs: uint) {
115115
*
116116
* # Returns
117117
*
118-
* An `option<T>` representing the outcome of the call. If the call `recv`'d
118+
* An `Option<T>` representing the outcome of the call. If the call `recv`'d
119119
* on the provided port in the allotted timeout period, then the result will
120-
* be a `some(T)`. If not, then `none` will be returned.
120+
* be a `Some(T)`. If not, then `None` will be returned.
121121
*/
122122
pub fn recv_timeout<T: Copy Owned>(iotask: IoTask,
123123
msecs: uint,
@@ -255,7 +255,7 @@ mod test {
255255
};
256256

257257
match recv_timeout(hl_loop, 10u, test_po) {
258-
some(val) => {
258+
Some(val) => {
259259
assert val == expected;
260260
successes += 1;
261261
}

src/test/compile-fail/issue-2354.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
xfailed for now (see Issue #2354)
1616
*/
1717
fn foo() { //~ ERROR this open brace is not closed
18-
match some(x) {
19-
some(y) { fail; }
20-
none { fail; }
18+
match Some(x) {
19+
Some(y) { fail; }
20+
None { fail; }
2121
}
2222

2323
fn bar() {

src/test/compile-fail/pat-ref-enum.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
fn matcher(x: option<int>) {
11+
fn matcher(x: Option<int>) {
1212
match x {
13-
ref some(i) => {} //~ ERROR expected identifier, found enum pattern
14-
none => {}
13+
ref Some(i) => {} //~ ERROR expected identifier, found enum pattern
14+
None => {}
1515
}
1616
}
1717

src/test/run-pass-fulldeps/qquote.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ fn main() {
6969
let stmt = quote_stmt!(let x = 20;);
7070
check_pp(ext_cx, *stmt, pprust::print_stmt, ~"let x = 20;");
7171
72-
let pat = quote_pat!(some(_));
73-
check_pp(ext_cx, pat, pprust::print_refutable_pat, ~"some(_)");
72+
let pat = quote_pat!(Some(_));
73+
check_pp(ext_cx, pat, pprust::print_refutable_pat, ~"Some(_)");
7474

7575
}
7676

src/test/run-pass/bind-by-move.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ fn dispose(+_x: arc::ARC<bool>) unsafe { }
1616

1717
fn main() {
1818
let p = arc::arc(true);
19-
let x = some(p);
19+
let x = Some(p);
2020
match move x {
21-
some(move z) => { dispose(z); },
22-
none => fail
21+
Some(move z) => { dispose(z); },
22+
None => fail
2323
}
2424
}

src/test/run-pass/class-impl-parameterized-trait.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ class cat : map<int, bool> {
5555
fn contains_key(&&k: int) -> bool { k <= self.meows }
5656
fn get(&&k:int) -> bool { k <= self.meows }
5757
fn [](&&k:int) -> bool { k <= self.meows }
58-
fn find(&&k:int) -> option<bool> { some(self.get(k)) }
59-
fn remove(&&k:int) -> option<bool> { self.meows -= k; some(true) }
58+
fn find(&&k:int) -> Option<bool> { Some(self.get(k)) }
59+
fn remove(&&k:int) -> Option<bool> { self.meows -= k; Some(true) }
6060
fn each(f: fn(&&int, &&bool) -> bool) {
6161
let mut n = int::abs(self.meows);
6262
while n > 0 {

src/test/run-pass/class-implements-multiple-traits.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ trait noisy {
2323
}
2424

2525
trait scratchy {
26-
fn scratch() -> option<furniture>;
26+
fn scratch() -> Option<furniture>;
2727
}
2828

2929
trait bitey {
@@ -72,13 +72,13 @@ class cat : noisy, scratchy, bitey {
7272

7373
fn speak() -> int { self.meow() as int }
7474
fn meow_count() -> uint { *self.meows }
75-
fn scratch() -> option<furniture> {
75+
fn scratch() -> Option<furniture> {
7676
let all = ~[chair, couch, bed];
7777
log(error, self.scratched);
78-
let mut rslt = none;
78+
let mut rslt = None;
7979
for each(all) |thing| { if !self.scratched.contains(thing) {
8080
self.scratched.push(thing);
81-
return some(thing); }}
81+
return Some(thing); }}
8282
rslt
8383
}
8484
fn bite() -> body_part {

src/test/run-pass/class-trait-bounded-param.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class keys<K: Copy, V: Copy, M: Copy map<K,V>>
2323
}
2424

2525
fn each(blk: fn(K) -> bool) { self.map.each(|k, _v| blk(k) ) }
26-
fn size_hint() -> option<uint> { some(self.map.size()) }
26+
fn size_hint() -> Option<uint> { Some(self.map.size()) }
2727
fn eachi(blk: fn(uint, K) -> bool) { iter::eachi(self, blk) }
2828
}
2929

src/test/run-pass/issue-2718.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,8 @@ fn main() {
310310
// Commented out because of option::get error
311311
312312
let (client_, server_) = pingpong::init();
313-
let client_ = ~mut some(client_);
314-
let server_ = ~mut some(server_);
313+
let client_ = ~mut Some(client_);
314+
let server_ = ~mut Some(server_);
315315
316316
task::spawn {|move client_|
317317
let mut client__ = none;

src/test/run-pass/issue-2869.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
// except according to those terms.
1010

1111
// xfail-test
12-
enum pat { pat_ident(option<uint>) }
12+
enum pat { pat_ident(Option<uint>) }
1313

1414
fn f(pat: pat) -> bool { true }
1515

1616
fn num_bindings(pat: pat) -> uint {
1717
match pat {
1818
pat_ident(_) if f(pat) { 0 }
19-
pat_ident(none) { 1 }
20-
pat_ident(some(sub)) { sub }
19+
pat_ident(None) { 1 }
20+
pat_ident(Some(sub)) { sub }
2121
}
2222
}
2323

24-
fn main() {}
24+
fn main() {}

src/test/run-pass/region-return-interior-of-option-in-self.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ struct cell<T> {
1515
}
1616

1717
struct cells<T> {
18-
vals: ~[option<cell<T>>];
18+
vals: ~[Option<cell<T>>];
1919
}
2020

2121
impl<T> &cells<T> {
2222
fn get(idx: uint) -> &self/T {
2323
match self.vals[idx] {
24-
some(ref v) => &v.value,
25-
none => fail
24+
Some(ref v) => &v.value,
25+
None => fail
2626
}
2727
}
2828
}

0 commit comments

Comments
 (0)