Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions src/cargo/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,8 @@ fn load_source_info(c: cargo, src: source) {
if !os::path_exists(srcfile) { ret; }
let srcstr = io::read_whole_file_str(srcfile);
alt json::from_str(result::get(srcstr)) {
ok(json::dict(_s)) {
let o = parse_source(src.name, json::dict(_s));
ok(json::dict(s)) {
let o = parse_source(src.name, json::dict(s));

src.key = o.key;
src.keyfp = o.keyfp;
Expand Down Expand Up @@ -635,7 +635,7 @@ fn build_cargo_options(argv: [str]) -> options {

fn configure(opts: options) -> cargo {
let home = alt get_cargo_root() {
ok(_home) { _home }
ok(home) { home }
err(_err) { result::get(get_cargo_sysroot()) }
};

Expand All @@ -647,11 +647,11 @@ fn configure(opts: options) -> cargo {

let p = result::get(get_cargo_dir());

let sources = map::str_hash::<source>();
let sources = map::str_hash();
try_parse_sources(path::connect(home, "sources.json"), sources);
try_parse_sources(path::connect(home, "local-sources.json"), sources);

let dep_cache = map::str_hash::<bool>();
let dep_cache = map::str_hash();

let mut c = {
pgp: pgp::supported(),
Expand All @@ -668,9 +668,9 @@ fn configure(opts: options) -> cargo {
};

need_dir(c.root);
need_dir(c.installdir);
need_dir(c.sourcedir);
need_dir(c.workdir);
need_dir(c.installdir);
need_dir(c.libdir);
need_dir(c.bindir);

Expand Down Expand Up @@ -799,7 +799,7 @@ fn install_source(c: cargo, path: str) {

let wd_base = c.workdir + path::path_sep();
let wd = alt tempfile::mkdtemp(wd_base, "") {
some(_wd) { _wd }
some(wd) { wd }
none { fail #fmt("needed temp dir: %s", wd_base); }
};

Expand All @@ -819,8 +819,8 @@ fn install_source(c: cargo, path: str) {

fn install_git(c: cargo, wd: str, url: str, ref: option<str>) {
run::program_output("git", ["clone", url, wd]);
if option::is_some::<str>(ref) {
let r = option::get::<str>(ref);
if option::is_some(ref) {
let r = option::get(ref);
os::change_dir(wd);
run::run_program("git", ["checkout", r]);
}
Expand Down Expand Up @@ -1021,8 +1021,8 @@ fn cmd_uninstall(c: cargo) {

fn install_query(c: cargo, wd: str, target: str) {
alt c.dep_cache.find(target) {
some(_inst) {
if _inst {
some(inst) {
if inst {
ret;
}
}
Expand Down Expand Up @@ -1082,7 +1082,7 @@ fn install_query(c: cargo, wd: str, target: str) {
fn cmd_install(c: cargo) unsafe {
let wd_base = c.workdir + path::path_sep();
let wd = alt tempfile::mkdtemp(wd_base, "") {
some(_wd) { _wd }
some(wd) { wd }
none { fail #fmt("needed temp dir: %s", wd_base); }
};

Expand Down Expand Up @@ -1536,7 +1536,7 @@ fn cmd_search(c: cargo) {
fn install_to_dir(srcfile: str, destdir: str) {
let newfile = path::connect(destdir, path::basename(srcfile));

let status = run::run_program("cp", [srcfile, newfile]);
let status = run::run_program("cp", ["-r", srcfile, newfile]);
if status == 0 {
info(#fmt["installed: '%s'", newfile]);
} else {
Expand Down
12 changes: 12 additions & 0 deletions src/libstd/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,14 @@ impl of to_json for json {
fn to_json() -> json { self }
}

impl of to_json for @json {
fn to_json() -> json { *self }
}

impl of to_json for int {
fn to_json() -> json { num(self as float) }
}

impl of to_json for i8 {
fn to_json() -> json { num(self as float) }
}
Expand All @@ -526,6 +534,10 @@ impl of to_json for i64 {
fn to_json() -> json { num(self as float) }
}

impl of to_json for uint {
fn to_json() -> json { num(self as float) }
}

impl of to_json for u8 {
fn to_json() -> json { num(self as float) }
}
Expand Down