diff options
| author | bors <bors@rust-lang.org> | 2014-01-10 18:21:21 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-01-10 18:21:21 -0800 |
| commit | a34727f27657cbed71fb2326dc6f1766fee95a4c (patch) | |
| tree | f6f124acf2ae8f6ab5808ce3ddb7c99a6cd35285 /src/librustpkg | |
| parent | 5a6ca45c8ad26f1ace1c46e6452155d511d065d8 (diff) | |
| parent | 4fc0452acef1355ba566a30c5bd04ccd3b9acef2 (diff) | |
auto merge of #11416 : bjz/rust/remove-print-fns, r=alexcrichton
The `print!` and `println!` macros are now the preferred method of printing, and so there is no reason to export the `stdio` functions in the prelude. The functions have also been replaced by their macro counterparts in the tutorial and other documentation so that newcomers don't get confused about what they should be using.
Diffstat (limited to 'src/librustpkg')
| -rw-r--r-- | src/librustpkg/context.rs | 16 | ||||
| -rw-r--r-- | src/librustpkg/lib.rs | 6 | ||||
| -rw-r--r-- | src/librustpkg/source_control.rs | 8 | ||||
| -rw-r--r-- | src/librustpkg/testsuite/fail/src/no-inferred-crates/src/zzyzx.rs | 2 | ||||
| -rw-r--r-- | src/librustpkg/testsuite/pass/src/c-dependencies/pkg.rs | 2 | ||||
| -rw-r--r-- | src/librustpkg/testsuite/pass/src/hello-world/main.rs | 2 | ||||
| -rw-r--r-- | src/librustpkg/usage.rs | 28 |
7 files changed, 32 insertions, 32 deletions
diff --git a/src/librustpkg/context.rs b/src/librustpkg/context.rs index 681ae1dc807..51b42869c75 100644 --- a/src/librustpkg/context.rs +++ b/src/librustpkg/context.rs @@ -269,43 +269,43 @@ pub fn flags_forbidden_for_cmd(flags: &RustcFlags, }; if flags.linker.is_some() && cmd != BuildCmd && cmd != InstallCmd { - println("The --linker option can only be used with the build or install commands."); + println!("The --linker option can only be used with the build or install commands."); return true; } if flags.link_args.is_some() && cmd != BuildCmd && cmd != InstallCmd { - println("The --link-args option can only be used with the build or install commands."); + println!("The --link-args option can only be used with the build or install commands."); return true; } if !cfgs.is_empty() && cmd != BuildCmd && cmd != InstallCmd && cmd != TestCmd { - println("The --cfg option can only be used with the build, test, or install commands."); + println!("The --cfg option can only be used with the build, test, or install commands."); return true; } if user_supplied_opt_level && cmd != BuildCmd && cmd != InstallCmd { - println("The -O and --opt-level options can only be used with the build \ + println!("The -O and --opt-level options can only be used with the build \ or install commands."); return true; } if flags.save_temps && cmd != BuildCmd && cmd != InstallCmd { - println("The --save-temps option can only be used with the build \ + println!("The --save-temps option can only be used with the build \ or install commands."); return true; } if flags.target.is_some() && cmd != BuildCmd && cmd != InstallCmd { - println("The --target option can only be used with the build \ + println!("The --target option can only be used with the build \ or install commands."); return true; } if flags.target_cpu.is_some() && cmd != BuildCmd && cmd != InstallCmd { - println("The --target-cpu option can only be used with the build \ + println!("The --target-cpu option can only be used with the build \ or install commands."); return true; } if flags.experimental_features.is_some() && cmd != BuildCmd && cmd != InstallCmd { - println("The -Z option can only be used with the build or install commands."); + println!("The -Z option can only be used with the build or install commands."); return true; } diff --git a/src/librustpkg/lib.rs b/src/librustpkg/lib.rs index 135b659871d..3d2ef2ebaba 100644 --- a/src/librustpkg/lib.rs +++ b/src/librustpkg/lib.rs @@ -364,9 +364,9 @@ impl CtxMethods for BuildContext { } } ListCmd => { - println("Installed packages:"); + println!("Installed packages:"); installed_packages::list_installed_packages(|pkg_id| { - pkg_id.path.display().with_str(|s| println(s)); + pkg_id.path.display().with_str(|s| println!("{}", s)); true }); } @@ -747,7 +747,7 @@ impl CtxMethods for BuildContext { } pub fn main() { - println("WARNING: The Rust package manager is experimental and may be unstable"); + println!("WARNING: The Rust package manager is experimental and may be unstable"); os::set_exit_status(main_args(os::args())); } diff --git a/src/librustpkg/source_control.rs b/src/librustpkg/source_control.rs index cbb55030231..7da99c5d562 100644 --- a/src/librustpkg/source_control.rs +++ b/src/librustpkg/source_control.rs @@ -38,8 +38,8 @@ pub fn safe_git_clone(source: &Path, v: &Version, target: &Path) -> CloneResult target.as_str().unwrap().to_owned()]); let outp = opt_outp.expect("Failed to exec `git`"); if !outp.status.success() { - println(str::from_utf8_owned(outp.output.clone())); - println(str::from_utf8_owned(outp.error)); + println!("{}", str::from_utf8_owned(outp.output.clone())); + println!("{}", str::from_utf8_owned(outp.error)); return DirToUse(target.clone()); } else { @@ -54,8 +54,8 @@ pub fn safe_git_clone(source: &Path, v: &Version, target: &Path) -> CloneResult format!("--git-dir={}", git_dir.as_str().unwrap().to_owned()), ~"checkout", format!("{}", *s)]).expect("Failed to exec `git`"); if !outp.status.success() { - println(str::from_utf8_owned(outp.output.clone())); - println(str::from_utf8_owned(outp.error)); + println!("{}", str::from_utf8_owned(outp.output.clone())); + println!("{}", str::from_utf8_owned(outp.error)); return DirToUse(target.clone()); } } diff --git a/src/librustpkg/testsuite/fail/src/no-inferred-crates/src/zzyzx.rs b/src/librustpkg/testsuite/fail/src/no-inferred-crates/src/zzyzx.rs index 6c9a63fe7bd..a4c2c1baabe 100644 --- a/src/librustpkg/testsuite/fail/src/no-inferred-crates/src/zzyzx.rs +++ b/src/librustpkg/testsuite/fail/src/no-inferred-crates/src/zzyzx.rs @@ -16,5 +16,5 @@ The test runner should check that, after `rustpkg build hello-world`: */ fn main() { - println(~"Hello world!"); + println!("Hello world!"); } diff --git a/src/librustpkg/testsuite/pass/src/c-dependencies/pkg.rs b/src/librustpkg/testsuite/pass/src/c-dependencies/pkg.rs index 85ddd3e58d4..b6c5e15c09a 100644 --- a/src/librustpkg/testsuite/pass/src/c-dependencies/pkg.rs +++ b/src/librustpkg/testsuite/pass/src/c-dependencies/pkg.rs @@ -36,7 +36,7 @@ pub fn main() { } if args[2] != ~"install" { - println(format!("Warning: I don't know how to {}", args[2])); + println!("Warning: I don't know how to {}", args[2]); return; } diff --git a/src/librustpkg/testsuite/pass/src/hello-world/main.rs b/src/librustpkg/testsuite/pass/src/hello-world/main.rs index 1d18a3aaa43..54b536664a3 100644 --- a/src/librustpkg/testsuite/pass/src/hello-world/main.rs +++ b/src/librustpkg/testsuite/pass/src/hello-world/main.rs @@ -19,5 +19,5 @@ The test runner should check that, after `rustpkg build hello-world`: */ fn main() { - println("Hello world!"); + println!("Hello world!"); } diff --git a/src/librustpkg/usage.rs b/src/librustpkg/usage.rs index a41e99f6d66..6fcafac4e5b 100644 --- a/src/librustpkg/usage.rs +++ b/src/librustpkg/usage.rs @@ -11,7 +11,7 @@ use context::Command; pub fn general() { - println("Usage: rustpkg [options] <cmd> [args..] + println!("Usage: rustpkg [options] <cmd> [args..] Where <cmd> is one of: build, clean, do, info, install, list, prefer, test, uninstall, unprefer @@ -24,7 +24,7 @@ Options: } pub fn build() { - println("rustpkg build [options..] [package-ID] + println!("rustpkg build [options..] [package-ID] Build the given package ID if specified. With no package ID argument, build the package in the current directory. In that case, the current @@ -50,21 +50,21 @@ Options: } pub fn clean() { - println("rustpkg clean + println!("rustpkg clean Remove all build files in the work cache for the package in the current directory."); } pub fn do_cmd() { - println("rustpkg do <cmd> + println!(r"rustpkg do <cmd> Runs a command in the package script. You can listen to a command -by tagging a function with the attribute `#[pkg_do(cmd)]`."); +by tagging a function with the attribute `\#[pkg_do(cmd)]`."); } pub fn info() { - println("rustpkg [options..] info + println!("rustpkg [options..] info Probe the package script in the current directory for information. @@ -73,13 +73,13 @@ Options: } pub fn list() { - println("rustpkg list + println!("rustpkg list List all installed packages."); } pub fn install() { - println("rustpkg install [options..] [package-ID] + println!(r"rustpkg install [options..] [package-ID] Install the given package ID if specified. With no package ID argument, install the package in the current directory. @@ -89,7 +89,7 @@ In that case, the current directory must be a direct child of a Examples: rustpkg install rustpkg install github.com/mozilla/servo - rustpkg install github.com/mozilla/servo#0.1.2 + rustpkg install github.com/mozilla/servo\#0.1.2 Options: -c, --cfg Pass a cfg flag to the package script @@ -105,14 +105,14 @@ Options: } pub fn uninstall() { - println("rustpkg uninstall <id|name>[@version] + println!("rustpkg uninstall <id|name>[@version] Remove a package by id or name and optionally version. If the package(s) is/are depended on by another package then they cannot be removed."); } pub fn prefer() { - println("rustpkg [options..] prefer <id|name>[@version] + println!("rustpkg [options..] prefer <id|name>[@version] By default all binaries are given a unique name so that multiple versions can coexist. The prefer command will symlink the uniquely named binary to @@ -130,7 +130,7 @@ Example: } pub fn unprefer() { - println("rustpkg [options..] unprefer <id|name>[@version] + println!("rustpkg [options..] unprefer <id|name>[@version] Remove all symlinks from the store to the binary directory for a package name and optionally version. If version is not supplied, the latest version @@ -139,7 +139,7 @@ information."); } pub fn test() { - println("rustpkg [options..] test + println!("rustpkg [options..] test Build all test crates in the current directory with the test flag. Then, run all the resulting test executables, redirecting the output @@ -150,7 +150,7 @@ Options: } pub fn init() { - println("rustpkg init + println!("rustpkg init This will turn the current working directory into a workspace. The first command you run when starting off a new project. |
