Skip to content

Commit a605fd0

Browse files
bstriebrson
authored andcommitted
CamelCasify lots of std
1 parent ecb6464 commit a605fd0

30 files changed

+783
-763
lines changed

src/cargo/cargo.rs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ type options = {
7474

7575
enum mode { system_mode, user_mode, local_mode }
7676

77-
fn opts() -> ~[getopts::opt] {
77+
fn opts() -> ~[getopts::Opt] {
7878
~[optflag(~"g"), optflag(~"G"), optflag(~"test"),
7979
optflag(~"h"), optflag(~"help")]
8080
}
@@ -387,27 +387,27 @@ fn valid_pkg_name(s: ~str) -> bool {
387387
s.all(is_valid_digit)
388388
}
389389

390-
fn parse_source(name: ~str, j: json::json) -> source {
390+
fn parse_source(name: ~str, j: json::Json) -> source {
391391
if !valid_pkg_name(name) {
392392
fail fmt!("'%s' is an invalid source name", name);
393393
}
394394

395395
match j {
396-
json::dict(j) => {
396+
json::Dict(j) => {
397397
let mut url = match j.find(~"url") {
398-
Some(json::string(u)) => *u,
398+
Some(json::String(u)) => *u,
399399
_ => fail ~"needed 'url' field in source"
400400
};
401401
let method = match j.find(~"method") {
402-
Some(json::string(u)) => *u,
402+
Some(json::String(u)) => *u,
403403
_ => assume_source_method(url)
404404
};
405405
let key = match j.find(~"key") {
406-
Some(json::string(u)) => Some(*u),
406+
Some(json::String(u)) => Some(*u),
407407
_ => None
408408
};
409409
let keyfp = match j.find(~"keyfp") {
410-
Some(json::string(u)) => Some(*u),
410+
Some(json::String(u)) => Some(*u),
411411
_ => None
412412
};
413413
if method == ~"file" {
@@ -429,7 +429,7 @@ fn try_parse_sources(filename: &Path, sources: map::hashmap<~str, source>) {
429429
if !os::path_exists(filename) { return; }
430430
let c = io::read_whole_file_str(filename);
431431
match json::from_str(result::get(c)) {
432-
Ok(json::dict(j)) => {
432+
Ok(json::Dict(j)) => {
433433
for j.each |k, v| {
434434
sources.insert(k, parse_source(k, v));
435435
debug!("source: %s", k);
@@ -440,9 +440,9 @@ fn try_parse_sources(filename: &Path, sources: map::hashmap<~str, source>) {
440440
}
441441
}
442442

443-
fn load_one_source_package(src: source, p: map::hashmap<~str, json::json>) {
443+
fn load_one_source_package(src: source, p: map::hashmap<~str, json::Json>) {
444444
let name = match p.find(~"name") {
445-
Some(json::string(n)) => {
445+
Some(json::String(n)) => {
446446
if !valid_pkg_name(*n) {
447447
warn(~"malformed source json: "
448448
+ src.name + ~", '" + *n + ~"'"+
@@ -459,7 +459,7 @@ fn load_one_source_package(src: source, p: map::hashmap<~str, json::json>) {
459459
};
460460

461461
let uuid = match p.find(~"uuid") {
462-
Some(json::string(n)) => {
462+
Some(json::String(n)) => {
463463
if !is_uuid(*n) {
464464
warn(~"malformed source json: "
465465
+ src.name + ~", '" + *n + ~"'"+
@@ -475,15 +475,15 @@ fn load_one_source_package(src: source, p: map::hashmap<~str, json::json>) {
475475
};
476476

477477
let url = match p.find(~"url") {
478-
Some(json::string(n)) => *n,
478+
Some(json::String(n)) => *n,
479479
_ => {
480480
warn(~"malformed source json: " + src.name + ~" (missing url)");
481481
return;
482482
}
483483
};
484484

485485
let method = match p.find(~"method") {
486-
Some(json::string(n)) => *n,
486+
Some(json::String(n)) => *n,
487487
_ => {
488488
warn(~"malformed source json: "
489489
+ src.name + ~" (missing method)");
@@ -492,16 +492,16 @@ fn load_one_source_package(src: source, p: map::hashmap<~str, json::json>) {
492492
};
493493

494494
let reference = match p.find(~"ref") {
495-
Some(json::string(n)) => Some(*n),
495+
Some(json::String(n)) => Some(*n),
496496
_ => None
497497
};
498498
499499
let mut tags = ~[];
500500
match p.find(~"tags") {
501-
Some(json::list(js)) => {
501+
Some(json::List(js)) => {
502502
for (*js).each |j| {
503503
match j {
504-
json::string(j) => vec::grow(tags, 1u, *j),
504+
json::String(j) => vec::grow(tags, 1u, *j),
505505
_ => ()
506506
}
507507
}
@@ -510,7 +510,7 @@ fn load_one_source_package(src: source, p: map::hashmap<~str, json::json>) {
510510
}
511511

512512
let description = match p.find(~"description") {
513-
Some(json::string(n)) => *n,
513+
Some(json::String(n)) => *n,
514514
_ => {
515515
warn(~"malformed source json: " + src.name
516516
+ ~" (missing description)");
@@ -548,8 +548,8 @@ fn load_source_info(c: cargo, src: source) {
548548
if !os::path_exists(&srcfile) { return; }
549549
let srcstr = io::read_whole_file_str(&srcfile);
550550
match json::from_str(result::get(srcstr)) {
551-
Ok(json::dict(s)) => {
552-
let o = parse_source(src.name, json::dict(s));
551+
Ok(json::Dict(s)) => {
552+
let o = parse_source(src.name, json::Dict(s));
553553

554554
src.key = o.key;
555555
src.keyfp = o.keyfp;
@@ -570,10 +570,10 @@ fn load_source_packages(c: cargo, src: source) {
570570
if !os::path_exists(&pkgfile) { return; }
571571
let pkgstr = io::read_whole_file_str(&pkgfile);
572572
match json::from_str(result::get(pkgstr)) {
573-
Ok(json::list(js)) => {
573+
Ok(json::List(js)) => {
574574
for (*js).each |j| {
575575
match j {
576-
json::dict(p) => {
576+
json::Dict(p) => {
577577
load_one_source_package(src, p);
578578
}
579579
_ => {
@@ -1551,7 +1551,7 @@ fn dump_cache(c: cargo) {
15511551
need_dir(&c.root);
15521552

15531553
let out = c.root.push("cache.json");
1554-
let _root = json::dict(map::str_hash());
1554+
let _root = json::Dict(map::str_hash());
15551555

15561556
if os::path_exists(&out) {
15571557
copy_warn(&out, &c.root.push("cache.json.old"));
@@ -1573,24 +1573,24 @@ fn dump_sources(c: cargo) {
15731573
match io::buffered_file_writer(&out) {
15741574
result::Ok(writer) => {
15751575
let hash = map::str_hash();
1576-
let root = json::dict(hash);
1576+
let root = json::Dict(hash);
15771577

15781578
for c.sources.each |k, v| {
15791579
let chash = map::str_hash();
1580-
let child = json::dict(chash);
1580+
let child = json::Dict(chash);
15811581

1582-
chash.insert(~"url", json::string(@v.url));
1583-
chash.insert(~"method", json::string(@v.method));
1582+
chash.insert(~"url", json::String(@v.url));
1583+
chash.insert(~"method", json::String(@v.method));
15841584

15851585
match copy v.key {
15861586
Some(key) => {
1587-
chash.insert(~"key", json::string(@key));
1587+
chash.insert(~"key", json::String(@key));
15881588
}
15891589
_ => ()
15901590
}
15911591
match copy v.keyfp {
15921592
Some(keyfp) => {
1593-
chash.insert(~"keyfp", json::string(@keyfp));
1593+
chash.insert(~"keyfp", json::String(@keyfp));
15941594
}
15951595
_ => ()
15961596
}

src/compiletest/compiletest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fn parse_config(args: ~[~str]) -> config {
4242
Err(f) => fail getopts::fail_str(f)
4343
};
4444

45-
fn opt_path(m: getopts::matches, nm: ~str) -> Path {
45+
fn opt_path(m: getopts::Matches, nm: ~str) -> Path {
4646
Path(getopts::opt_str(m, nm))
4747
}
4848

src/libstd/arena.rs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Dynamic arenas.
2+
#[warn(non_camel_case_types)];
23

34
// Arenas are used to quickly allocate objects that share a
45
// lifetime. The arena uses ~[u8] vectors as a backing store to
@@ -22,7 +23,7 @@
2223
// overhead when initializing plain-old-data and means we don't need
2324
// to waste time running the destructors of POD.
2425

25-
export arena, arena_with_size;
26+
export Arena, arena_with_size;
2627

2728
import list;
2829
import list::{list, cons, nil};
@@ -46,15 +47,15 @@ const tydesc_drop_glue_index: size_t = 3 as size_t;
4647
// The way arena uses arrays is really deeply awful. The arrays are
4748
// allocated, and have capacities reserved, but the fill for the array
4849
// will always stay at 0.
49-
type chunk = {data: @[u8], mut fill: uint, is_pod: bool};
50+
type Chunk = {data: @[u8], mut fill: uint, is_pod: bool};
5051

51-
struct arena {
52+
struct Arena {
5253
// The head is seperated out from the list as a unbenchmarked
5354
// microoptimization, to avoid needing to case on the list to
5455
// access the head.
55-
priv mut head: chunk;
56-
priv mut pod_head: chunk;
57-
priv mut chunks: @list<chunk>;
56+
priv mut head: Chunk;
57+
priv mut pod_head: Chunk;
58+
priv mut chunks: @list<Chunk>;
5859
drop {
5960
unsafe {
6061
destroy_chunk(self.head);
@@ -65,19 +66,19 @@ struct arena {
6566
}
6667
}
6768

68-
fn chunk(size: uint, is_pod: bool) -> chunk {
69+
fn chunk(size: uint, is_pod: bool) -> Chunk {
6970
let mut v = @[];
7071
unsafe { at_vec::unsafe::reserve(v, size); }
7172
{ data: v, mut fill: 0u, is_pod: is_pod }
7273
}
7374

74-
fn arena_with_size(initial_size: uint) -> arena {
75-
return arena {mut head: chunk(initial_size, false),
75+
fn arena_with_size(initial_size: uint) -> Arena {
76+
return Arena {mut head: chunk(initial_size, false),
7677
mut pod_head: chunk(initial_size, true),
7778
mut chunks: @nil};
7879
}
7980

80-
fn arena() -> arena {
81+
fn Arena() -> Arena {
8182
arena_with_size(32u)
8283
}
8384

@@ -88,7 +89,7 @@ fn round_up_to(base: uint, align: uint) -> uint {
8889

8990
// Walk down a chunk, running the destructors for any objects stored
9091
// in it.
91-
unsafe fn destroy_chunk(chunk: chunk) {
92+
unsafe fn destroy_chunk(chunk: Chunk) {
9293
let mut idx = 0;
9394
let buf = vec::unsafe::to_ptr_slice(chunk.data);
9495
let fill = chunk.fill;
@@ -129,7 +130,7 @@ unsafe fn un_bitpack_tydesc_ptr(p: uint) -> (*TypeDesc, bool) {
129130
}
130131

131132
// The duplication between the POD and non-POD functions is annoying.
132-
impl &arena {
133+
impl &Arena {
133134
// Functions for the POD part of the arena
134135
fn alloc_pod_grow(n_bytes: uint, align: uint) -> *u8 {
135136
// Allocate a new chunk.
@@ -238,7 +239,7 @@ impl &arena {
238239

239240
#[test]
240241
fn test_arena_destructors() {
241-
let arena = arena::arena();
242+
let arena = arena::Arena();
242243
for uint::range(0, 10) |i| {
243244
// Arena allocate something with drop glue to make sure it
244245
// doesn't leak.
@@ -251,7 +252,7 @@ fn test_arena_destructors() {
251252

252253
#[test] #[should_fail] #[ignore(cfg(windows))]
253254
fn test_arena_destructors_fail() {
254-
let arena = arena::arena();
255+
let arena = arena::Arena();
255256
// Put some stuff in the arena.
256257
for uint::range(0, 10) |i| {
257258
// Arena allocate something with drop glue to make sure it

src/libstd/base64.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
#[deny(non_camel_case_types)];
12
import io::Reader;
23

3-
trait to_base64 {
4+
trait ToBase64 {
45
fn to_base64() -> ~str;
56
}
67

7-
impl ~[u8]: to_base64 {
8+
impl ~[u8]: ToBase64 {
89
fn to_base64() -> ~str {
910
let chars = str::chars(
1011
~"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
@@ -55,17 +56,17 @@ impl ~[u8]: to_base64 {
5556
}
5657
}
5758

58-
impl ~str: to_base64 {
59+
impl ~str: ToBase64 {
5960
fn to_base64() -> ~str {
6061
str::to_bytes(self).to_base64()
6162
}
6263
}
6364

64-
trait from_base64 {
65+
trait FromBase64 {
6566
fn from_base64() -> ~[u8];
6667
}
6768

68-
impl ~[u8]: from_base64 {
69+
impl ~[u8]: FromBase64 {
6970
fn from_base64() -> ~[u8] {
7071
if self.len() % 4u != 0u { fail ~"invalid base64 length"; }
7172

@@ -127,7 +128,7 @@ impl ~[u8]: from_base64 {
127128
}
128129
}
129130

130-
impl ~str: from_base64 {
131+
impl ~str: FromBase64 {
131132
fn from_base64() -> ~[u8] {
132133
str::to_bytes(self).from_base64()
133134
}

0 commit comments

Comments
 (0)