diff options
| author | Björn Steinbrink <bsteinbr@gmail.com> | 2013-05-06 00:18:51 +0200 |
|---|---|---|
| committer | Björn Steinbrink <bsteinbr@gmail.com> | 2013-05-14 16:36:23 +0200 |
| commit | bdc182cc41c2741edc6fdc4ec09b8522479aab40 (patch) | |
| tree | e4d26bbc1b47702ef46cd01bbaa5b5dad8633416 /src/librustpkg | |
| parent | 84745b483f322671f894b9e8d0a462c46275a9d3 (diff) | |
| download | rust-bdc182cc41c2741edc6fdc4ec09b8522479aab40.tar.gz rust-bdc182cc41c2741edc6fdc4ec09b8522479aab40.zip | |
Use static string with fail!() and remove fail!(fmt!())
fail!() used to require owned strings but can handle static strings now. Also, it can pass its arguments to fmt!() on its own, no need for the caller to call fmt!() itself.
Diffstat (limited to 'src/librustpkg')
| -rw-r--r-- | src/librustpkg/rustpkg.rc | 20 | ||||
| -rw-r--r-- | src/librustpkg/util.rs | 6 | ||||
| -rw-r--r-- | src/librustpkg/workspace.rs | 4 |
3 files changed, 15 insertions, 15 deletions
diff --git a/src/librustpkg/rustpkg.rc b/src/librustpkg/rustpkg.rc index 502f34a4d9e..5c4dbce1b4a 100644 --- a/src/librustpkg/rustpkg.rc +++ b/src/librustpkg/rustpkg.rc @@ -146,8 +146,8 @@ impl PkgScript { } } Err(e) => { - fail!(fmt!("Running package script, couldn't find rustpkg sysroot (%s)", - e)) + fail!("Running package script, couldn't find rustpkg sysroot (%s)", + e) } } } @@ -256,13 +256,13 @@ impl Ctx { self.unprefer(name.get(), vers); } - _ => fail!(~"reached an unhandled command") + _ => fail!("reached an unhandled command") } } fn do_cmd(&self, _cmd: ~str, _pkgname: ~str) { // stub - fail!(~"`do` not yet implemented"); + fail!("`do` not yet implemented"); } fn build(&self, workspace: &Path, pkgid: PkgId) { @@ -289,7 +289,7 @@ impl Ctx { let (cfgs, hook_result) = pscript.run_custom(~"post_build"); debug!("Command return code = %?", hook_result); if hook_result != 0 { - fail!(fmt!("Error running custom build command")) + fail!("Error running custom build command") } custom = true; // otherwise, the package script succeeded @@ -330,7 +330,7 @@ impl Ctx { fn info(&self) { // stub - fail!(~"info not yet implemented"); + fail!("info not yet implemented"); } fn install(&self, workspace: &Path, id: PkgId) { @@ -362,7 +362,7 @@ impl Ctx { fn fetch(&self, _dir: &Path, _url: ~str, _target: Option<~str>) { // stub - fail!(~"fetch not yet implemented"); + fail!("fetch not yet implemented"); } fn fetch_curl(&self, dir: &Path, url: ~str) { @@ -448,15 +448,15 @@ impl Ctx { fn test(&self) { // stub - fail!(~"test not yet implemented"); + fail!("test not yet implemented"); } fn uninstall(&self, _id: ~str, _vers: Option<~str>) { - fail!(~"uninstall not yet implemented"); + fail!("uninstall not yet implemented"); } fn unprefer(&self, _id: ~str, _vers: Option<~str>) { - fail!(~"unprefer not yet implemented"); + fail!("unprefer not yet implemented"); } } diff --git a/src/librustpkg/util.rs b/src/librustpkg/util.rs index 5e43cb43960..14879c147e0 100644 --- a/src/librustpkg/util.rs +++ b/src/librustpkg/util.rs @@ -324,7 +324,7 @@ pub fn parse_vers(vers: ~str) -> result::Result<semver::Version, ~str> { pub fn need_dir(s: &Path) { if !os::path_is_dir(s) && !os::make_dir(s, 493_i32) { - fail!(fmt!("can't create dir: %s", s.to_str())); + fail!("can't create dir: %s", s.to_str()); } } @@ -421,12 +421,12 @@ pub fn wait_for_lock(path: &Path) { } pub fn load_pkgs() -> result::Result<~[json::Json], ~str> { - fail!(~"load_pkg not implemented"); + fail!("load_pkg not implemented"); } pub fn get_pkg(_id: ~str, _vers: Option<~str>) -> result::Result<Pkg, ~str> { - fail!(~"get_pkg not implemented"); + fail!("get_pkg not implemented"); } pub fn add_pkg(pkg: &Pkg) -> bool { diff --git a/src/librustpkg/workspace.rs b/src/librustpkg/workspace.rs index 94b94d373e6..cf6707eed29 100644 --- a/src/librustpkg/workspace.rs +++ b/src/librustpkg/workspace.rs @@ -21,10 +21,10 @@ pub fn pkg_parent_workspaces(pkgid: PkgId, action: &fn(&Path) -> bool) -> bool { workspace_contains_package_id(pkgid, ws)); if workspaces.is_empty() { // tjc: make this a condition - fail!(fmt!("Package %s not found in any of \ + fail!("Package %s not found in any of \ the following workspaces: %s", pkgid.path.to_str(), - rust_path().to_str())); + rust_path().to_str()); } for workspaces.each |ws| { if action(ws) { |
