From 1f1b2e42d76ba1cd884adc49922636a6c2ac1b2f Mon Sep 17 00:00:00 2001 From: Richo Healey Date: Sun, 25 May 2014 03:17:19 -0700 Subject: [PATCH] std: Rename strbuf operations to string [breaking-change] --- src/compiletest/compiletest.rs | 42 +- src/compiletest/errors.rs | 4 +- src/compiletest/header.rs | 20 +- src/compiletest/procsrv.rs | 12 +- src/compiletest/runtest.rs | 298 ++++++------- src/compiletest/util.rs | 6 +- src/doc/complement-cheatsheet.md | 8 +- src/doc/guide-tasks.md | 4 +- src/doc/rust.md | 6 +- src/doc/tutorial.md | 4 +- src/libarena/lib.rs | 8 +- src/libcollections/lru_cache.rs | 20 +- src/libcore/option.rs | 8 +- src/libfmt_macros/lib.rs | 2 +- src/libgetopts/lib.rs | 308 ++++++------- src/libglob/lib.rs | 2 +- src/libgraphviz/lib.rs | 6 +- src/libhexfloat/lib.rs | 14 +- src/liblog/directive.rs | 16 +- src/liblog/lib.rs | 22 +- src/libnative/io/addrinfo.rs | 2 +- src/libnum/bigint.rs | 52 +-- src/libnum/complex.rs | 16 +- src/libnum/rational.rs | 50 +-- src/libregex/parse/mod.rs | 8 +- src/libregex/re.rs | 10 +- src/libregex/test/bench.rs | 2 +- src/libregex_macros/lib.rs | 4 +- src/librustc/back/archive.rs | 2 +- src/librustc/back/arm.rs | 18 +- src/librustc/back/link.rs | 16 +- src/librustc/back/mips.rs | 14 +- src/librustc/back/rpath.rs | 54 +-- src/librustc/back/svh.rs | 2 +- src/librustc/back/x86.rs | 16 +- src/librustc/back/x86_64.rs | 16 +- src/librustc/driver/config.rs | 30 +- src/librustc/driver/driver.rs | 40 +- src/librustc/driver/mod.rs | 10 +- src/librustc/front/feature_gate.rs | 2 +- src/librustc/front/test.rs | 2 +- src/librustc/lib.rs | 2 +- src/librustc/lib/llvm.rs | 8 +- src/librustc/metadata/creader.rs | 12 +- src/librustc/metadata/csearch.rs | 4 +- src/librustc/metadata/cstore.rs | 2 +- src/librustc/metadata/decoder.rs | 12 +- src/librustc/metadata/encoder.rs | 4 +- src/librustc/metadata/filesearch.rs | 12 +- src/librustc/metadata/loader.rs | 8 +- src/librustc/middle/borrowck/check_loans.rs | 2 +- src/librustc/middle/borrowck/mod.rs | 12 +- src/librustc/middle/cfg/graphviz.rs | 2 +- src/librustc/middle/check_match.rs | 8 +- src/librustc/middle/check_static.rs | 2 +- src/librustc/middle/const_eval.rs | 36 +- src/librustc/middle/dataflow.rs | 4 +- src/librustc/middle/kind.rs | 4 +- src/librustc/middle/liveness.rs | 8 +- src/librustc/middle/mem_categorization.rs | 28 +- src/librustc/middle/privacy.rs | 4 +- src/librustc/middle/resolve.rs | 20 +- src/librustc/middle/subst.rs | 4 +- src/librustc/middle/trans/asm.rs | 6 +- src/librustc/middle/trans/base.rs | 24 +- src/librustc/middle/trans/callee.rs | 2 +- src/librustc/middle/trans/common.rs | 4 +- src/librustc/middle/trans/debuginfo.rs | 44 +- src/librustc/middle/trans/expr.rs | 2 +- src/librustc/middle/trans/foreign.rs | 4 +- src/librustc/middle/ty.rs | 60 +-- src/librustc/middle/typeck/check/_match.rs | 26 +- src/librustc/middle/typeck/check/mod.rs | 8 +- .../middle/typeck/infer/error_reporting.rs | 14 +- src/librustc/middle/typeck/infer/glb.rs | 2 +- src/librustc/middle/typeck/infer/lub.rs | 2 +- src/librustc/middle/typeck/infer/mod.rs | 10 +- src/librustc/middle/typeck/infer/sub.rs | 2 +- src/librustc/middle/typeck/infer/to_str.rs | 6 +- src/librustc/util/ppaux.rs | 102 ++--- src/librustc/util/sha2.rs | 14 +- src/librustdoc/clean/inline.rs | 4 +- src/librustdoc/clean/mod.rs | 74 ++-- src/librustdoc/html/format.rs | 20 +- src/librustdoc/html/highlight.rs | 6 +- src/librustdoc/html/markdown.rs | 12 +- src/librustdoc/html/render.rs | 38 +- src/librustdoc/html/toc.rs | 10 +- src/librustdoc/lib.rs | 46 +- src/librustdoc/markdown.rs | 12 +- src/librustdoc/passes.rs | 14 +- src/librustdoc/test.rs | 8 +- src/librustuv/lib.rs | 6 +- src/librustuv/net.rs | 4 +- src/librustuv/pipe.rs | 2 +- src/libsemver/lib.rs | 30 +- src/libserialize/base64.rs | 26 +- src/libserialize/ebml.rs | 2 +- src/libserialize/hex.rs | 4 +- src/libserialize/json.rs | 270 +++++------ src/libstd/ascii.rs | 76 ++-- src/libstd/fmt.rs | 4 +- src/libstd/io/buffered.rs | 12 +- src/libstd/io/mem.rs | 4 +- src/libstd/io/mod.rs | 8 +- src/libstd/io/net/ip.rs | 6 +- src/libstd/io/process.rs | 24 +- src/libstd/io/stdio.rs | 2 +- src/libstd/local_data.rs | 24 +- src/libstd/num/int_macros.rs | 26 +- src/libstd/num/uint_macros.rs | 30 +- src/libstd/os.rs | 26 +- src/libstd/path/posix.rs | 4 +- src/libstd/path/windows.rs | 12 +- src/libstd/repr.rs | 2 +- src/libstd/rt/task.rs | 4 +- src/libstd/slice.rs | 16 +- src/libstd/str.rs | 56 +-- src/libstd/string.rs | 4 +- src/libstd/task.rs | 4 +- src/libstd/to_str.rs | 24 +- src/libstd/unstable/dynamic_lib.rs | 2 +- src/libstd/vec.rs | 4 +- src/libsyntax/ast_map.rs | 30 +- src/libsyntax/ast_util.rs | 18 +- src/libsyntax/codemap.rs | 64 +-- src/libsyntax/crateid.rs | 58 +-- src/libsyntax/diagnostic.rs | 4 +- src/libsyntax/ext/base.rs | 2 +- src/libsyntax/ext/deriving/generic/mod.rs | 4 +- src/libsyntax/ext/expand.rs | 34 +- src/libsyntax/ext/format.rs | 10 +- src/libsyntax/ext/quote.rs | 24 +- src/libsyntax/ext/source_util.rs | 6 +- src/libsyntax/ext/tt/macro_parser.rs | 10 +- src/libsyntax/ext/tt/macro_rules.rs | 4 +- src/libsyntax/ext/tt/transcribe.rs | 2 +- src/libsyntax/fold.rs | 8 +- src/libsyntax/parse/comments.rs | 38 +- src/libsyntax/parse/lexer.rs | 34 +- src/libsyntax/parse/mod.rs | 32 +- src/libsyntax/parse/parser.rs | 6 +- src/libsyntax/parse/token.rs | 98 ++-- src/libsyntax/print/pp.rs | 18 +- src/libsyntax/print/pprust.rs | 10 +- src/libsyntax/util/interner.rs | 2 +- src/libsyntax/util/parser_testing.rs | 4 +- src/libterm/terminfo/mod.rs | 2 +- src/libterm/terminfo/parm.rs | 112 ++--- src/libterm/terminfo/parser/compiled.rs | 32 +- src/libterm/terminfo/searcher.rs | 8 +- src/libtest/lib.rs | 118 ++--- src/libtest/stats.rs | 8 +- src/libtime/lib.rs | 418 +++++++++--------- src/liburl/lib.rs | 414 ++++++++--------- src/libuuid/lib.rs | 6 +- src/libworkcache/lib.rs | 26 +- src/test/auxiliary/crateresolve5-1.rs | 2 +- src/test/auxiliary/crateresolve5-2.rs | 2 +- src/test/auxiliary/issue-2631-a.rs | 2 +- .../auxiliary/reexported_static_methods.rs | 2 +- src/test/bench/core-set.rs | 10 +- src/test/bench/core-std.rs | 6 +- src/test/bench/msgsend-pipes-shared.rs | 6 +- src/test/bench/msgsend-pipes.rs | 6 +- src/test/bench/shootout-k-nucleotide-pipes.rs | 12 +- src/test/bench/shootout-pfib.rs | 8 +- src/test/compile-fail/binop-bitxor-str.rs | 2 +- .../borrowck-move-error-with-note.rs | 2 +- .../borrowck-move-out-of-struct-with-dtor.rs | 4 +- ...owck-move-out-of-tuple-struct-with-dtor.rs | 4 +- .../borrowck-move-out-of-vec-tail.rs | 6 +- .../compile-fail/by-move-pattern-binding.rs | 2 +- .../check-static-values-constraints.rs | 2 +- src/test/compile-fail/class-cast-to-trait.rs | 2 +- ...d-deconstructing-destructing-struct-let.rs | 2 +- ...deconstructing-destructing-struct-match.rs | 2 +- src/test/compile-fail/integral-indexing.rs | 2 +- src/test/compile-fail/issue-13428.rs | 2 +- src/test/compile-fail/issue-2063.rs | 2 +- src/test/compile-fail/issue-7573.rs | 4 +- src/test/compile-fail/match-vec-mismatch.rs | 2 +- .../compile-fail/match-vec-unreachable.rs | 6 +- src/test/compile-fail/minus-string.rs | 2 +- .../moves-based-on-type-access-to-field.rs | 4 +- .../compile-fail/moves-based-on-type-exprs.rs | 26 +- src/test/compile-fail/unsendable-class.rs | 2 +- src/test/run-fail/assert-macro-owned.rs | 2 +- src/test/run-fail/binop-fail-2.rs | 2 +- src/test/run-fail/binop-fail.rs | 2 +- src/test/run-fail/fmt-fail.rs | 2 +- src/test/run-fail/if-cond-bot.rs | 2 +- src/test/run-fail/result-get-fail.rs | 2 +- src/test/run-fail/str-overrun.rs | 2 +- src/test/run-fail/unwind-lambda.rs | 4 +- src/test/run-fail/unwind-misc-1.rs | 4 +- src/test/run-pass/autobind.rs | 4 +- .../autoref-intermediate-types-issue-3585.rs | 2 +- src/test/run-pass/backtrace.rs | 4 +- src/test/run-pass/block-explicit-types.rs | 2 +- src/test/run-pass/borrowed-ptr-pattern-2.rs | 4 +- src/test/run-pass/bug-7183-generics.rs | 10 +- src/test/run-pass/c-stack-returning-int64.rs | 6 +- src/test/run-pass/child-outlives-parent.rs | 2 +- src/test/run-pass/class-attributes-1.rs | 2 +- src/test/run-pass/class-attributes-2.rs | 2 +- .../class-cast-to-trait-cross-crate-2.rs | 6 +- .../class-cast-to-trait-multiple-types.rs | 2 +- src/test/run-pass/class-cast-to-trait.rs | 2 +- src/test/run-pass/class-exports.rs | 4 +- .../class-impl-very-parameterized-trait.rs | 4 +- .../class-implement-trait-cross-crate.rs | 2 +- src/test/run-pass/class-implement-traits.rs | 2 +- src/test/run-pass/class-separate-impl.rs | 6 +- src/test/run-pass/class-str-field.rs | 2 +- src/test/run-pass/classes-cross-crate.rs | 2 +- src/test/run-pass/classes.rs | 2 +- src/test/run-pass/closure-reform.rs | 8 +- src/test/run-pass/complex.rs | 4 +- src/test/run-pass/concat.rs | 4 +- .../crate-method-reexport-grrrrrrr.rs | 2 +- src/test/run-pass/deriving-hash.rs | 4 +- src/test/run-pass/deriving-show-2.rs | 22 +- src/test/run-pass/deriving-show.rs | 2 +- .../deriving-via-extension-struct-tuple.rs | 6 +- src/test/run-pass/drop-on-ret.rs | 2 +- src/test/run-pass/enum-discrim-width-stuff.rs | 4 +- src/test/run-pass/enum-disr-val-pretty.rs | 8 +- src/test/run-pass/enum-variants.rs | 6 +- src/test/run-pass/estr-uniq.rs | 6 +- src/test/run-pass/exec-env.rs | 2 +- src/test/run-pass/explicit_self_xcrate_exe.rs | 2 +- src/test/run-pass/exponential-notation.rs | 2 +- src/test/run-pass/fixed_length_vec_glue.rs | 2 +- src/test/run-pass/foreign-fn-linkname.rs | 2 +- src/test/run-pass/format-ref-cell.rs | 2 +- src/test/run-pass/hashmap-memory.rs | 6 +- src/test/run-pass/html-literals.rs | 6 +- src/test/run-pass/ifmt.rs | 6 +- src/test/run-pass/issue-13304.rs | 8 +- src/test/run-pass/issue-1701.rs | 14 +- src/test/run-pass/issue-2631-b.rs | 4 +- src/test/run-pass/issue-2804-2.rs | 2 +- src/test/run-pass/issue-2804.rs | 14 +- src/test/run-pass/issue-3389.rs | 4 +- src/test/run-pass/issue-3424.rs | 2 +- src/test/run-pass/issue-3556.rs | 10 +- src/test/run-pass/issue-3559.rs | 4 +- src/test/run-pass/issue-3563-3.rs | 2 +- src/test/run-pass/issue-3935.rs | 4 +- src/test/run-pass/issue-4541.rs | 4 +- ...e-5008-borrowed-traitobject-method-call.rs | 2 +- src/test/run-pass/issue-5353.rs | 6 +- src/test/run-pass/issue-5550.rs | 2 +- src/test/run-pass/issue-5666.rs | 6 +- src/test/run-pass/issue-8898.rs | 12 +- src/test/run-pass/issue-9047.rs | 2 +- src/test/run-pass/issue-9259.rs | 4 +- .../issue-9394-inherited-trait-calls.rs | 24 +- src/test/run-pass/issue-9446.rs | 4 +- src/test/run-pass/istr.rs | 16 +- .../log-knows-the-names-of-variants-in-std.rs | 4 +- .../log-knows-the-names-of-variants.rs | 6 +- src/test/run-pass/match-borrowed_str.rs | 44 +- src/test/run-pass/match-str.rs | 2 +- src/test/run-pass/monad.rs | 14 +- src/test/run-pass/move-self.rs | 2 +- .../nullable-pointer-iotareduction.rs | 2 +- .../process-spawn-with-unicode-params.rs | 2 +- src/test/run-pass/rec-align-u32.rs | 2 +- src/test/run-pass/rec-align-u64.rs | 2 +- src/test/run-pass/rec-auto.rs | 2 +- .../reexported-static-methods-cross-crate.rs | 2 +- src/test/run-pass/reflect-visit-type.rs | 20 +- src/test/run-pass/ret-bang.rs | 2 +- .../run-pass/shape_intrinsic_tag_then_rec.rs | 2 +- src/test/run-pass/spawn-fn.rs | 6 +- src/test/run-pass/spawn-types.rs | 4 +- src/test/run-pass/static-impl.rs | 6 +- src/test/run-pass/static-method-xcrate.rs | 6 +- src/test/run-pass/str-concat.rs | 4 +- src/test/run-pass/str-multiline.rs | 8 +- src/test/run-pass/string-self-append.rs | 2 +- src/test/run-pass/struct-literal-dtor.rs | 2 +- src/test/run-pass/struct-order-of-eval-1.rs | 4 +- src/test/run-pass/struct-order-of-eval-2.rs | 4 +- src/test/run-pass/swap-overlapping.rs | 2 +- .../run-pass/syntax-extension-source-utils.rs | 10 +- src/test/run-pass/tag-align-shape.rs | 2 +- src/test/run-pass/tag-disr-val-shape.rs | 6 +- src/test/run-pass/tag-variant-disr-val.rs | 50 +-- src/test/run-pass/tail-call-arg-leak.rs | 2 +- src/test/run-pass/task-comm-10.rs | 8 +- src/test/run-pass/task-life-0.rs | 2 +- src/test/run-pass/trait-bounds-in-arc.rs | 8 +- src/test/run-pass/trait-cast.rs | 6 +- src/test/run-pass/trait-generic.rs | 16 +- src/test/run-pass/trait-to-str.rs | 10 +- .../run-pass/traits-default-method-macro.rs | 2 +- src/test/run-pass/utf8.rs | 16 +- src/test/run-pass/utf8_chars.rs | 4 +- src/test/run-pass/variant-attributes.rs | 2 +- src/test/run-pass/vec-tail-matching.rs | 12 +- src/test/run-pass/vec-to_str.rs | 8 +- 304 files changed, 2570 insertions(+), 2570 deletions(-) diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index a82e574556a02..701f8899fa4ef 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -50,7 +50,7 @@ fn start(argc: int, argv: **u8) -> int { pub fn main() { let args = os::args(); let config = parse_config(args.move_iter() - .map(|x| x.to_strbuf()) + .map(|x| x.to_string()) .collect()); log_config(&config); run_tests(&config); @@ -134,15 +134,15 @@ pub fn parse_config(args: Vec ) -> Config { Config { compile_lib_path: matches.opt_str("compile-lib-path") .unwrap() - .to_strbuf(), - run_lib_path: matches.opt_str("run-lib-path").unwrap().to_strbuf(), + .to_string(), + run_lib_path: matches.opt_str("run-lib-path").unwrap().to_string(), rustc_path: opt_path(matches, "rustc-path"), clang_path: matches.opt_str("clang-path").map(|s| Path::new(s)), llvm_bin_path: matches.opt_str("llvm-bin-path").map(|s| Path::new(s)), src_base: opt_path(matches, "src-base"), build_base: opt_path(matches, "build-base"), aux_base: opt_path(matches, "aux-base"), - stage_id: matches.opt_str("stage-id").unwrap().to_strbuf(), + stage_id: matches.opt_str("stage-id").unwrap().to_string(), mode: FromStr::from_str(matches.opt_str("mode") .unwrap() .as_slice()).expect("invalid mode"), @@ -156,32 +156,32 @@ pub fn parse_config(args: Vec ) -> Config { ratchet_noise_percent: matches.opt_str("ratchet-noise-percent") .and_then(|s| from_str::(s.as_slice())), - runtool: matches.opt_str("runtool").map(|x| x.to_strbuf()), + runtool: matches.opt_str("runtool").map(|x| x.to_string()), host_rustcflags: matches.opt_str("host-rustcflags") - .map(|x| x.to_strbuf()), + .map(|x| x.to_string()), target_rustcflags: matches.opt_str("target-rustcflags") - .map(|x| x.to_strbuf()), + .map(|x| x.to_string()), jit: matches.opt_present("jit"), - target: opt_str2(matches.opt_str("target").map(|x| x.to_strbuf())), - host: opt_str2(matches.opt_str("host").map(|x| x.to_strbuf())), + target: opt_str2(matches.opt_str("target").map(|x| x.to_string())), + host: opt_str2(matches.opt_str("host").map(|x| x.to_string())), android_cross_path: opt_path(matches, "android-cross-path"), adb_path: opt_str2(matches.opt_str("adb-path") - .map(|x| x.to_strbuf())), + .map(|x| x.to_string())), adb_test_dir: opt_str2(matches.opt_str("adb-test-dir") - .map(|x| x.to_strbuf())), + .map(|x| x.to_string())), adb_device_status: "arm-linux-androideabi" == opt_str2(matches.opt_str("target") - .map(|x| x.to_strbuf())).as_slice() && + .map(|x| x.to_string())).as_slice() && "(none)" != opt_str2(matches.opt_str("adb-test-dir") - .map(|x| x.to_strbuf())).as_slice() && + .map(|x| x.to_string())).as_slice() && !opt_str2(matches.opt_str("adb-test-dir") - .map(|x| x.to_strbuf())).is_empty(), + .map(|x| x.to_string())).is_empty(), lldb_python_dir: matches.opt_str("lldb-python-dir") - .map(|x| x.to_strbuf()), + .map(|x| x.to_string()), test_shard: test::opt_shard(matches.opt_str("test-shard") - .map(|x| x.to_strbuf())), + .map(|x| x.to_string())), verbose: matches.opt_present("verbose") } } @@ -201,7 +201,7 @@ pub fn log_config(config: &Config) { opt_str(&config.filter .as_ref() .map(|re| { - re.to_str().into_strbuf() + re.to_str().into_string() })))); logv(c, format_strbuf!("runtool: {}", opt_str(&config.runtool))); logv(c, format_strbuf!("host-rustcflags: {}", @@ -218,7 +218,7 @@ pub fn log_config(config: &Config) { logv(c, format_strbuf!("adb_device_status: {}", config.adb_device_status)); match config.test_shard { - None => logv(c, "test_shard: (all)".to_strbuf()), + None => logv(c, "test_shard: (all)".to_string()), Some((a,b)) => logv(c, format_strbuf!("test_shard: {}.{}", a, b)) } logv(c, format_strbuf!("verbose: {}", config.verbose)); @@ -234,7 +234,7 @@ pub fn opt_str<'a>(maybestr: &'a Option) -> &'a str { pub fn opt_str2(maybestr: Option) -> String { match maybestr { - None => "(none)".to_strbuf(), + None => "(none)".to_string(), Some(s) => s, } } @@ -367,7 +367,7 @@ pub fn make_test_name(config: &Config, testfile: &Path) -> test::TestName { pub fn make_test_closure(config: &Config, testfile: &Path) -> test::TestFn { let config = (*config).clone(); // FIXME (#9639): This needs to handle non-utf8 paths - let testfile = testfile.as_str().unwrap().to_strbuf(); + let testfile = testfile.as_str().unwrap().to_string(); test::DynTestFn(proc() { runtest::run(config, testfile) }) @@ -376,7 +376,7 @@ pub fn make_test_closure(config: &Config, testfile: &Path) -> test::TestFn { pub fn make_metrics_test_closure(config: &Config, testfile: &Path) -> test::TestFn { let config = (*config).clone(); // FIXME (#9639): This needs to handle non-utf8 paths - let testfile = testfile.as_str().unwrap().to_strbuf(); + let testfile = testfile.as_str().unwrap().to_string(); test::DynMetricFn(proc(mm) { runtest::run_metrics(config, testfile, mm) }) diff --git a/src/compiletest/errors.rs b/src/compiletest/errors.rs index f3ebe30b37dd9..c96e688c2900c 100644 --- a/src/compiletest/errors.rs +++ b/src/compiletest/errors.rs @@ -31,8 +31,8 @@ pub fn load_errors(re: &Regex, testfile: &Path) -> Vec { fn parse_expected(line_num: uint, line: &str, re: &Regex) -> Option { re.captures(line).and_then(|caps| { let adjusts = caps.name("adjusts").len(); - let kind = caps.name("kind").to_ascii().to_lower().into_str().to_strbuf(); - let msg = caps.name("msg").trim().to_strbuf(); + let kind = caps.name("kind").to_ascii().to_lower().into_str().to_string(); + let msg = caps.name("msg").trim().to_string(); debug!("line={} kind={} msg={}", line_num, kind, msg); Some(ExpectedError { diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs index 44fc8e8ce528e..531f51f982f6b 100644 --- a/src/compiletest/header.rs +++ b/src/compiletest/header.rs @@ -170,23 +170,23 @@ fn iter_header(testfile: &Path, it: |&str| -> bool) -> bool { } fn parse_error_pattern(line: &str) -> Option { - parse_name_value_directive(line, "error-pattern".to_strbuf()) + parse_name_value_directive(line, "error-pattern".to_string()) } fn parse_aux_build(line: &str) -> Option { - parse_name_value_directive(line, "aux-build".to_strbuf()) + parse_name_value_directive(line, "aux-build".to_string()) } fn parse_compile_flags(line: &str) -> Option { - parse_name_value_directive(line, "compile-flags".to_strbuf()) + parse_name_value_directive(line, "compile-flags".to_string()) } fn parse_run_flags(line: &str) -> Option { - parse_name_value_directive(line, "run-flags".to_strbuf()) + parse_name_value_directive(line, "run-flags".to_string()) } fn parse_check_line(line: &str) -> Option { - parse_name_value_directive(line, "check".to_strbuf()) + parse_name_value_directive(line, "check".to_string()) } fn parse_force_host(line: &str) -> bool { @@ -206,15 +206,15 @@ fn parse_no_pretty_expanded(line: &str) -> bool { } fn parse_exec_env(line: &str) -> Option<(String, String)> { - parse_name_value_directive(line, "exec-env".to_strbuf()).map(|nv| { + parse_name_value_directive(line, "exec-env".to_string()).map(|nv| { // nv is either FOO or FOO=BAR let mut strs: Vec = nv.as_slice() .splitn('=', 1) - .map(|s| s.to_strbuf()) + .map(|s| s.to_string()) .collect(); match strs.len() { - 1u => (strs.pop().unwrap(), "".to_strbuf()), + 1u => (strs.pop().unwrap(), "".to_string()), 2u => { let end = strs.pop().unwrap(); (strs.pop().unwrap(), end) @@ -225,7 +225,7 @@ fn parse_exec_env(line: &str) -> Option<(String, String)> { } fn parse_pp_exact(line: &str, testfile: &Path) -> Option { - match parse_name_value_directive(line, "pp-exact".to_strbuf()) { + match parse_name_value_directive(line, "pp-exact".to_string()) { Some(s) => Some(Path::new(s)), None => { if parse_name_directive(line, "pp-exact") { @@ -247,7 +247,7 @@ pub fn parse_name_value_directive(line: &str, directive: String) match line.find_str(keycolon.as_slice()) { Some(colon) => { let value = line.slice(colon + keycolon.len(), - line.len()).to_strbuf(); + line.len()).to_string(); debug!("{}: {}", directive, value); Some(value) } diff --git a/src/compiletest/procsrv.rs b/src/compiletest/procsrv.rs index 49430a8d45be5..a48a9f1be7541 100644 --- a/src/compiletest/procsrv.rs +++ b/src/compiletest/procsrv.rs @@ -15,7 +15,7 @@ use std::unstable::dynamic_lib::DynamicLibrary; fn target_env(lib_path: &str, prog: &str) -> Vec<(String, String)> { let prog = if cfg!(windows) {prog.slice_to(prog.len() - 4)} else {prog}; - let mut aux_path = prog.to_strbuf(); + let mut aux_path = prog.to_string(); aux_path.push_str(".libaux"); // Need to be sure to put both the lib_path and the aux path in the dylib @@ -27,7 +27,7 @@ fn target_env(lib_path: &str, prog: &str) -> Vec<(String, String)> { // Remove the previous dylib search path var let var = DynamicLibrary::envvar(); let mut env: Vec<(String,String)> = - os::env().move_iter().map(|(a,b)|(a.to_strbuf(), b.to_strbuf())).collect(); + os::env().move_iter().map(|(a,b)|(a.to_string(), b.to_string())).collect(); match env.iter().position(|&(ref k, _)| k.as_slice() == var) { Some(i) => { env.remove(i); } None => {} @@ -35,8 +35,8 @@ fn target_env(lib_path: &str, prog: &str) -> Vec<(String, String)> { // Add the new dylib search path var let newpath = DynamicLibrary::create_path(path.as_slice()); - env.push((var.to_strbuf(), - str::from_utf8(newpath.as_slice()).unwrap().to_strbuf())); + env.push((var.to_string(), + str::from_utf8(newpath.as_slice()).unwrap().to_string())); return env; } @@ -59,8 +59,8 @@ pub fn run(lib_path: &str, Some(Result { status: status, - out: str::from_utf8(output.as_slice()).unwrap().to_strbuf(), - err: str::from_utf8(error.as_slice()).unwrap().to_strbuf() + out: str::from_utf8(output.as_slice()).unwrap().to_string(), + err: str::from_utf8(error.as_slice()).unwrap().to_string() }) }, Err(..) => None diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index f1dd783214a5b..7ad302646b36c 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -73,7 +73,7 @@ fn run_cfail_test(config: &Config, props: &TestProps, testfile: &Path) { let proc_res = compile_test(config, props, testfile); if proc_res.status.success() { - fatal_ProcRes("compile-fail test compiled successfully!".to_strbuf(), + fatal_ProcRes("compile-fail test compiled successfully!".to_string(), &proc_res); } @@ -83,7 +83,7 @@ fn run_cfail_test(config: &Config, props: &TestProps, testfile: &Path) { if !expected_errors.is_empty() { if !props.error_patterns.is_empty() { fatal("both error pattern and expected errors \ - specified".to_strbuf()); + specified".to_string()); } check_expected_errors(expected_errors, testfile, &proc_res); } else { @@ -97,7 +97,7 @@ fn run_rfail_test(config: &Config, props: &TestProps, testfile: &Path) { let proc_res = compile_test(config, props, testfile); if !proc_res.status.success() { - fatal_ProcRes("compilation failed!".to_strbuf(), &proc_res); + fatal_ProcRes("compilation failed!".to_string(), &proc_res); } exec_compiled_test(config, props, testfile) @@ -108,7 +108,7 @@ fn run_rfail_test(config: &Config, props: &TestProps, testfile: &Path) { // The value our Makefile configures valgrind to return on failure static VALGRIND_ERR: int = 100; if proc_res.status.matches_exit_status(VALGRIND_ERR) { - fatal_ProcRes("run-fail test isn't valgrind-clean!".to_strbuf(), + fatal_ProcRes("run-fail test isn't valgrind-clean!".to_string(), &proc_res); } @@ -132,35 +132,35 @@ fn run_rpass_test(config: &Config, props: &TestProps, testfile: &Path) { let mut proc_res = compile_test(config, props, testfile); if !proc_res.status.success() { - fatal_ProcRes("compilation failed!".to_strbuf(), &proc_res); + fatal_ProcRes("compilation failed!".to_string(), &proc_res); } proc_res = exec_compiled_test(config, props, testfile); if !proc_res.status.success() { - fatal_ProcRes("test run failed!".to_strbuf(), &proc_res); + fatal_ProcRes("test run failed!".to_string(), &proc_res); } } else { let proc_res = jit_test(config, props, testfile); if !proc_res.status.success() { - fatal_ProcRes("jit failed!".to_strbuf(), &proc_res); + fatal_ProcRes("jit failed!".to_string(), &proc_res); } } } fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) { if props.pp_exact.is_some() { - logv(config, "testing for exact pretty-printing".to_strbuf()); + logv(config, "testing for exact pretty-printing".to_string()); } else { - logv(config, "testing for converging pretty-printing".to_strbuf()); + logv(config, "testing for converging pretty-printing".to_string()); } let rounds = match props.pp_exact { Some(_) => 1, None => 2 }; let src = File::open(testfile).read_to_end().unwrap(); - let src = str::from_utf8(src.as_slice()).unwrap().to_strbuf(); + let src = str::from_utf8(src.as_slice()).unwrap().to_string(); let mut srcs = vec!(src); let mut round = 0; @@ -169,7 +169,7 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) { let proc_res = print_source(config, props, testfile, - (*srcs.get(round)).to_strbuf(), + (*srcs.get(round)).to_string(), "normal"); if !proc_res.status.success() { @@ -187,7 +187,7 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) { Some(ref file) => { let filepath = testfile.dir_path().join(file); let s = File::open(&filepath).read_to_end().unwrap(); - str::from_utf8(s.as_slice()).unwrap().to_strbuf() + str::from_utf8(s.as_slice()).unwrap().to_string() } None => { (*srcs.get(srcs.len() - 2u)).clone() } }; @@ -195,9 +195,9 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) { if props.pp_exact.is_some() { // Now we have to care about line endings - let cr = "\r".to_strbuf(); - actual = actual.replace(cr.as_slice(), "").to_strbuf(); - expected = expected.replace(cr.as_slice(), "").to_strbuf(); + let cr = "\r".to_string(); + actual = actual.replace(cr.as_slice(), "").to_string(); + expected = expected.replace(cr.as_slice(), "").to_string(); } compare_source(expected.as_slice(), actual.as_slice()); @@ -206,7 +206,7 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) { let proc_res = typecheck_source(config, props, testfile, actual); if !proc_res.status.success() { - fatal_ProcRes("pretty-printed source does not typecheck".to_strbuf(), + fatal_ProcRes("pretty-printed source does not typecheck".to_string(), &proc_res); } if props.no_pretty_expanded { return } @@ -238,7 +238,7 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) { make_pp_args(config, props, testfile, - pretty_type.to_strbuf()), + pretty_type.to_string()), props.exec_env.clone(), config.compile_lib_path.as_slice(), Some(src)) @@ -250,16 +250,16 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) { pretty_type: String) -> ProcArgs { let aux_dir = aux_output_dir_name(config, testfile); // FIXME (#9639): This needs to handle non-utf8 paths - let mut args = vec!("-".to_strbuf(), - "--pretty".to_strbuf(), + let mut args = vec!("-".to_string(), + "--pretty".to_string(), pretty_type, format_strbuf!("--target={}", config.target), - "-L".to_strbuf(), - aux_dir.as_str().unwrap().to_strbuf()); + "-L".to_string(), + aux_dir.as_str().unwrap().to_string()); args.push_all_move(split_maybe_args(&config.target_rustcflags)); args.push_all_move(split_maybe_args(&props.compile_flags)); return ProcArgs { - prog: config.rustc_path.as_str().unwrap().to_strbuf(), + prog: config.rustc_path.as_str().unwrap().to_string(), args: args, }; } @@ -267,7 +267,7 @@ fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) { fn compare_source(expected: &str, actual: &str) { if expected != actual { error("pretty-printed source does not match expected \ - source".to_strbuf()); + source".to_string()); println!("\n\ expected:\n\ ------------------------------------------\n\ @@ -297,19 +297,19 @@ actual:\n\ config.target.as_slice() }; // FIXME (#9639): This needs to handle non-utf8 paths - let mut args = vec!("-".to_strbuf(), - "--no-trans".to_strbuf(), - "--crate-type=lib".to_strbuf(), + let mut args = vec!("-".to_string(), + "--no-trans".to_string(), + "--crate-type=lib".to_string(), format_strbuf!("--target={}", target), - "-L".to_strbuf(), - config.build_base.as_str().unwrap().to_strbuf(), - "-L".to_strbuf(), - aux_dir.as_str().unwrap().to_strbuf()); + "-L".to_string(), + config.build_base.as_str().unwrap().to_string(), + "-L".to_string(), + aux_dir.as_str().unwrap().to_string()); args.push_all_move(split_maybe_args(&config.target_rustcflags)); args.push_all_move(split_maybe_args(&props.compile_flags)); // FIXME (#9639): This needs to handle non-utf8 paths return ProcArgs { - prog: config.rustc_path.as_str().unwrap().to_strbuf(), + prog: config.rustc_path.as_str().unwrap().to_string(), args: args, }; } @@ -324,12 +324,12 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) { let config = &mut config; let DebuggerCommands { commands, check_lines, .. } = parse_debugger_commands(testfile, "gdb"); - let mut cmds = commands.connect("\n").to_strbuf(); + let mut cmds = commands.connect("\n").to_string(); // compile test file (it shoud have 'compile-flags:-g' in the header) let compiler_run_result = compile_test(config, props, testfile); if !compiler_run_result.status.success() { - fatal_ProcRes("compilation failed!".to_strbuf(), &compiler_run_result); + fatal_ProcRes("compilation failed!".to_string(), &compiler_run_result); } let exe_file = make_exe_name(config, testfile); @@ -339,17 +339,17 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) { match config.target.as_slice() { "arm-linux-androideabi" => { - cmds = cmds.replace("run", "continue").to_strbuf(); + cmds = cmds.replace("run", "continue").to_string(); // write debugger script - let script_str = ["set charset UTF-8".to_strbuf(), + let script_str = ["set charset UTF-8".to_string(), format_strbuf!("file {}", exe_file.as_str() .unwrap() - .to_strbuf()), - "target remote :5039".to_strbuf(), + .to_string()), + "target remote :5039".to_string(), cmds, - "quit".to_strbuf()].connect("\n"); + "quit".to_string()].connect("\n"); debug!("script_str = {}", script_str); dump_output_file(config, testfile, @@ -360,24 +360,24 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) { procsrv::run("", config.adb_path.as_slice(), [ - "push".to_strbuf(), - exe_file.as_str().unwrap().to_strbuf(), + "push".to_string(), + exe_file.as_str().unwrap().to_string(), config.adb_test_dir.clone() ], - vec!(("".to_strbuf(), "".to_strbuf())), - Some("".to_strbuf())) + vec!(("".to_string(), "".to_string())), + Some("".to_string())) .expect(format_strbuf!("failed to exec `{}`", config.adb_path)); procsrv::run("", config.adb_path.as_slice(), [ - "forward".to_strbuf(), - "tcp:5039".to_strbuf(), - "tcp:5039".to_strbuf() + "forward".to_string(), + "tcp:5039".to_string(), + "tcp:5039".to_string() ], - vec!(("".to_strbuf(), "".to_strbuf())), - Some("".to_strbuf())) + vec!(("".to_string(), "".to_string())), + Some("".to_string())) .expect(format_strbuf!("failed to exec `{}`", config.adb_path)); let adb_arg = format_strbuf!("export LD_LIBRARY_PATH={}; \ @@ -392,12 +392,12 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) { config.adb_path .as_slice(), [ - "shell".to_strbuf(), + "shell".to_string(), adb_arg.clone() ], - vec!(("".to_strbuf(), - "".to_strbuf())), - Some("".to_strbuf())) + vec!(("".to_string(), + "".to_string())), + Some("".to_string())) .expect(format_strbuf!("failed to exec `{}`", config.adb_path)); loop { @@ -413,16 +413,16 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) { } let tool_path = match config.android_cross_path.as_str() { - Some(x) => x.to_strbuf(), - None => fatal("cannot find android cross path".to_strbuf()) + Some(x) => x.to_string(), + None => fatal("cannot find android cross path".to_string()) }; let debugger_script = make_out_name(config, testfile, "debugger.script"); // FIXME (#9639): This needs to handle non-utf8 paths let debugger_opts = - vec!("-quiet".to_strbuf(), - "-batch".to_strbuf(), - "-nx".to_strbuf(), + vec!("-quiet".to_string(), + "-batch".to_string(), + "-nx".to_string(), format_strbuf!("-command={}", debugger_script.as_str().unwrap())); @@ -434,7 +434,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) { } = procsrv::run("", gdb_path.as_slice(), debugger_opts.as_slice(), - vec!(("".to_strbuf(), "".to_strbuf())), + vec!(("".to_string(), "".to_string())), None) .expect(format_strbuf!("failed to exec `{}`", gdb_path)); let cmdline = { @@ -457,9 +457,9 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) { _=> { // write debugger script let script_str = [ - "set charset UTF-8".to_strbuf(), + "set charset UTF-8".to_string(), cmds, - "quit\n".to_strbuf() + "quit\n".to_string() ].connect("\n"); debug!("script_str = {}", script_str); dump_output_file(config, @@ -470,23 +470,23 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) { // run debugger script with gdb #[cfg(windows)] fn debugger() -> String { - "gdb.exe".to_strbuf() + "gdb.exe".to_string() } #[cfg(unix)] fn debugger() -> String { - "gdb".to_strbuf() + "gdb".to_string() } let debugger_script = make_out_name(config, testfile, "debugger.script"); // FIXME (#9639): This needs to handle non-utf8 paths let debugger_opts = - vec!("-quiet".to_strbuf(), - "-batch".to_strbuf(), - "-nx".to_strbuf(), + vec!("-quiet".to_string(), + "-batch".to_string(), + "-nx".to_string(), format_strbuf!("-command={}", debugger_script.as_str().unwrap()), - exe_file.as_str().unwrap().to_strbuf()); + exe_file.as_str().unwrap().to_string()); proc_args = ProcArgs { prog: debugger(), args: debugger_opts, @@ -501,7 +501,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) { } if !debugger_run_result.status.success() { - fatal("gdb failed to execute".to_strbuf()); + fatal("gdb failed to execute".to_string()); } check_debugger_output(&debugger_run_result, check_lines.as_slice()); @@ -512,7 +512,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path) if config.lldb_python_dir.is_none() { fatal("Can't run LLDB test because LLDB's python path is not \ - set.".to_strbuf()); + set.".to_string()); } let mut config = Config { @@ -526,7 +526,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path) // compile test file (it shoud have 'compile-flags:-g' in the header) let compile_result = compile_test(config, props, testfile); if !compile_result.status.success() { - fatal_ProcRes("compilation failed!".to_strbuf(), &compile_result); + fatal_ProcRes("compilation failed!".to_string(), &compile_result); } let exe_file = make_exe_name(config, testfile); @@ -569,7 +569,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path) let debugger_run_result = run_lldb(config, &exe_file, &debugger_script); if !debugger_run_result.status.success() { - fatal_ProcRes("Error while running LLDB".to_strbuf(), + fatal_ProcRes("Error while running LLDB".to_string(), &debugger_run_result); } @@ -589,8 +589,8 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path) process.wait_with_output().unwrap(); (status, - str::from_utf8(output.as_slice()).unwrap().to_strbuf(), - str::from_utf8(error.as_slice()).unwrap().to_strbuf()) + str::from_utf8(output.as_slice()).unwrap().to_string(), + str::from_utf8(error.as_slice()).unwrap().to_string()) }, Err(e) => { fatal(format_strbuf!("Failed to setup Python process for \ @@ -636,13 +636,13 @@ fn parse_debugger_commands(file_path: &Path, debugger_prefix: &str) header::parse_name_value_directive( line.as_slice(), - command_directive.to_strbuf()).map(|cmd| { + command_directive.to_string()).map(|cmd| { commands.push(cmd) }); header::parse_name_value_directive( line.as_slice(), - check_directive.to_strbuf()).map(|cmd| { + check_directive.to_string()).map(|cmd| { check_lines.push(cmd) }); } @@ -669,16 +669,16 @@ fn cleanup_debug_info_options(options: &Option) -> Option { // Remove options that are either unwanted (-O) or may lead to duplicates due to RUSTFLAGS. let options_to_remove = [ - "-O".to_strbuf(), - "-g".to_strbuf(), - "--debuginfo".to_strbuf() + "-O".to_string(), + "-g".to_string(), + "--debuginfo".to_string() ]; let new_options = split_maybe_args(options).move_iter() .filter(|x| !options_to_remove.contains(x)) .collect::>() .connect(" ") - .to_strbuf(); + .to_string(); Some(new_options) } @@ -692,7 +692,7 @@ fn check_debugger_output(debugger_run_result: &ProcRes, check_lines: &[String]) s.as_slice() .trim() .split_str("[...]") - .map(|x| x.to_strbuf()) + .map(|x| x.to_string()) .collect() }).collect(); // check if each line in props.check_lines appears in the @@ -749,7 +749,7 @@ fn check_error_patterns(props: &TestProps, } if proc_res.status.success() { - fatal("process did not return an error status".to_strbuf()); + fatal("process did not return an error status".to_string()); } let mut next_err_idx = 0u; @@ -784,7 +784,7 @@ fn check_error_patterns(props: &TestProps, for pattern in missing_patterns.iter() { error(format_strbuf!("error pattern '{}' not found!", *pattern)); } - fatal_ProcRes("multiple error patterns not found".to_strbuf(), + fatal_ProcRes("multiple error patterns not found".to_string(), proc_res); } } @@ -792,7 +792,7 @@ fn check_error_patterns(props: &TestProps, fn check_no_compiler_crash(proc_res: &ProcRes) { for line in proc_res.stderr.as_slice().lines() { if line.starts_with("error: internal compiler error:") { - fatal_ProcRes("compiler encountered internal error".to_strbuf(), + fatal_ProcRes("compiler encountered internal error".to_string(), proc_res); } } @@ -807,7 +807,7 @@ fn check_expected_errors(expected_errors: Vec , expected_errors.len(), false); if proc_res.status.success() { - fatal("process did not return an error status".to_strbuf()); + fatal("process did not return an error status".to_string()); } let prefixes = expected_errors.iter().map(|ee| { @@ -824,7 +824,7 @@ fn check_expected_errors(expected_errors: Vec , c } } ).collect(); - str::from_chars(c.as_slice()).to_strbuf() + str::from_chars(c.as_slice()).to_string() } #[cfg(target_os = "win32")] @@ -983,15 +983,15 @@ fn compile_test(config: &Config, props: &TestProps, } fn jit_test(config: &Config, props: &TestProps, testfile: &Path) -> ProcRes { - compile_test_(config, props, testfile, ["--jit".to_strbuf()]) + compile_test_(config, props, testfile, ["--jit".to_string()]) } fn compile_test_(config: &Config, props: &TestProps, testfile: &Path, extra_args: &[String]) -> ProcRes { let aux_dir = aux_output_dir_name(config, testfile); // FIXME (#9639): This needs to handle non-utf8 paths - let link_args = vec!("-L".to_strbuf(), - aux_dir.as_str().unwrap().to_strbuf()); + let link_args = vec!("-L".to_string(), + aux_dir.as_str().unwrap().to_string()); let args = make_compile_args(config, props, link_args.append(extra_args), @@ -1034,7 +1034,7 @@ fn compose_and_run_compiler( let aux_dir = aux_output_dir_name(config, testfile); // FIXME (#9639): This needs to handle non-utf8 paths - let extra_link_args = vec!("-L".to_string(), aux_dir.as_str().unwrap().to_owned()); + let extra_link_args = vec!("-L".to_string(), aux_dir.as_str().unwrap().to_string()); for rel_ab in props.aux_builds.iter() { let abs_ab = config.aux_base.join(rel_ab.as_slice()); @@ -1042,14 +1042,14 @@ fn compose_and_run_compiler( let crate_type = if aux_props.no_prefer_dynamic { Vec::new() } else { - vec!("--crate-type=dylib".to_strbuf()) + vec!("--crate-type=dylib".to_string()) }; let aux_args = make_compile_args(config, &aux_props, crate_type.append( extra_link_args.iter() - .map(|x| x.to_strbuf()) + .map(|x| x.to_string()) .collect::>() .as_slice()), |a,b| { @@ -1118,26 +1118,26 @@ fn make_compile_args(config: &Config, config.target.as_slice() }; // FIXME (#9639): This needs to handle non-utf8 paths - let mut args = vec!(testfile.as_str().unwrap().to_strbuf(), - "-L".to_strbuf(), - config.build_base.as_str().unwrap().to_strbuf(), + let mut args = vec!(testfile.as_str().unwrap().to_string(), + "-L".to_string(), + config.build_base.as_str().unwrap().to_string(), format_strbuf!("--target={}", target)); args.push_all(extras.as_slice()); if !props.no_prefer_dynamic { - args.push("-C".to_strbuf()); - args.push("prefer-dynamic".to_strbuf()); + args.push("-C".to_string()); + args.push("prefer-dynamic".to_string()); } let path = match xform_file { ThisFile(path) => { - args.push("-o".to_strbuf()); + args.push("-o".to_string()); path } ThisDirectory(path) => { - args.push("--out-dir".to_strbuf()); + args.push("--out-dir".to_string()); path } }; - args.push(path.as_str().unwrap().to_strbuf()); + args.push(path.as_str().unwrap().to_string()); if props.force_host { args.push_all_move(split_maybe_args(&config.host_rustcflags)); } else { @@ -1145,7 +1145,7 @@ fn make_compile_args(config: &Config, } args.push_all_move(split_maybe_args(&props.compile_flags)); return ProcArgs { - prog: config.rustc_path.as_str().unwrap().to_strbuf(), + prog: config.rustc_path.as_str().unwrap().to_string(), args: args, }; } @@ -1176,7 +1176,7 @@ fn make_run_args(config: &Config, props: &TestProps, testfile: &Path) -> let exe_file = make_exe_name(config, testfile); // FIXME (#9639): This needs to handle non-utf8 paths - args.push(exe_file.as_str().unwrap().to_strbuf()); + args.push(exe_file.as_str().unwrap().to_string()); // Add the arguments in the run_flags directive args.push_all_move(split_maybe_args(&props.run_flags)); @@ -1197,7 +1197,7 @@ fn split_maybe_args(argstr: &Option) -> Vec { if s.is_whitespace() { None } else { - Some(s.to_strbuf()) + Some(s.to_string()) } }).collect() } @@ -1342,7 +1342,7 @@ fn _arm_exec_compiled_test(config: &Config, let mut tvec: Vec = args.prog .as_slice() .split('/') - .map(|ts| ts.to_strbuf()) + .map(|ts| ts.to_string()) .collect(); let prog_short = tvec.pop().unwrap(); @@ -1350,12 +1350,12 @@ fn _arm_exec_compiled_test(config: &Config, let copy_result = procsrv::run("", config.adb_path.as_slice(), [ - "push".to_strbuf(), + "push".to_string(), args.prog.clone(), config.adb_test_dir.clone() ], - vec!(("".to_strbuf(), "".to_strbuf())), - Some("".to_strbuf())) + vec!(("".to_string(), "".to_string())), + Some("".to_string())) .expect(format_strbuf!("failed to exec `{}`", config.adb_path)); if config.verbose { @@ -1371,7 +1371,7 @@ fn _arm_exec_compiled_test(config: &Config, let mut runargs = Vec::new(); // run test via adb_run_wrapper - runargs.push("shell".to_strbuf()); + runargs.push("shell".to_string()); for (key, val) in env.move_iter() { runargs.push(format_strbuf!("{}={}", key, val)); } @@ -1381,18 +1381,18 @@ fn _arm_exec_compiled_test(config: &Config, runargs.push(format_strbuf!("{}", prog_short)); for tv in args.args.iter() { - runargs.push(tv.to_strbuf()); + runargs.push(tv.to_string()); } procsrv::run("", config.adb_path.as_slice(), runargs.as_slice(), - vec!(("".to_strbuf(), "".to_strbuf())), Some("".to_strbuf())) + vec!(("".to_string(), "".to_string())), Some("".to_string())) .expect(format_strbuf!("failed to exec `{}`", config.adb_path)); // get exitcode of result runargs = Vec::new(); - runargs.push("shell".to_strbuf()); - runargs.push("cat".to_strbuf()); + runargs.push("shell".to_string()); + runargs.push("cat".to_string()); runargs.push(format_strbuf!("{}/{}.exitcode", config.adb_test_dir, prog_short)); @@ -1401,8 +1401,8 @@ fn _arm_exec_compiled_test(config: &Config, procsrv::run("", config.adb_path.as_slice(), runargs.as_slice(), - vec!(("".to_strbuf(), "".to_strbuf())), - Some("".to_strbuf())) + vec!(("".to_string(), "".to_string())), + Some("".to_string())) .expect(format_strbuf!("failed to exec `{}`", config.adb_path)); let mut exitcode: int = 0; @@ -1416,8 +1416,8 @@ fn _arm_exec_compiled_test(config: &Config, // get stdout of result runargs = Vec::new(); - runargs.push("shell".to_strbuf()); - runargs.push("cat".to_strbuf()); + runargs.push("shell".to_string()); + runargs.push("cat".to_string()); runargs.push(format_strbuf!("{}/{}.stdout", config.adb_test_dir, prog_short)); @@ -1426,14 +1426,14 @@ fn _arm_exec_compiled_test(config: &Config, procsrv::run("", config.adb_path.as_slice(), runargs.as_slice(), - vec!(("".to_strbuf(), "".to_strbuf())), - Some("".to_strbuf())) + vec!(("".to_string(), "".to_string())), + Some("".to_string())) .expect(format_strbuf!("failed to exec `{}`", config.adb_path)); // get stderr of result runargs = Vec::new(); - runargs.push("shell".to_strbuf()); - runargs.push("cat".to_strbuf()); + runargs.push("shell".to_string()); + runargs.push("cat".to_string()); runargs.push(format_strbuf!("{}/{}.stderr", config.adb_test_dir, prog_short)); @@ -1442,8 +1442,8 @@ fn _arm_exec_compiled_test(config: &Config, procsrv::run("", config.adb_path.as_slice(), runargs.as_slice(), - vec!(("".to_strbuf(), "".to_strbuf())), - Some("".to_strbuf())) + vec!(("".to_string(), "".to_string())), + Some("".to_string())) .expect(format_strbuf!("failed to exec `{}`", config.adb_path)); dump_output(config, @@ -1469,15 +1469,15 @@ fn _arm_push_aux_shared_library(config: &Config, testfile: &Path) { let copy_result = procsrv::run("", config.adb_path.as_slice(), [ - "push".to_strbuf(), + "push".to_string(), file.as_str() .unwrap() - .to_strbuf(), - config.adb_test_dir.to_strbuf() + .to_string(), + config.adb_test_dir.to_string() ], - vec!(("".to_strbuf(), - "".to_strbuf())), - Some("".to_strbuf())) + vec!(("".to_string(), + "".to_string())), + Some("".to_string())) .expect(format_strbuf!("failed to exec `{}`", config.adb_path)); @@ -1509,12 +1509,12 @@ fn compile_test_and_save_bitcode(config: &Config, props: &TestProps, testfile: &Path) -> ProcRes { let aux_dir = aux_output_dir_name(config, testfile); // FIXME (#9639): This needs to handle non-utf8 paths - let link_args = vec!("-L".to_strbuf(), - aux_dir.as_str().unwrap().to_strbuf()); - let llvm_args = vec!("--emit=obj".to_strbuf(), - "--crate-type=lib".to_strbuf(), - "-C".to_strbuf(), - "save-temps".to_strbuf()); + let link_args = vec!("-L".to_string(), + aux_dir.as_str().unwrap().to_string()); + let llvm_args = vec!("--emit=obj".to_string(), + "--crate-type=lib".to_string(), + "-C".to_string(), + "save-temps".to_string()); let args = make_compile_args(config, props, link_args.append(llvm_args.as_slice()), @@ -1529,12 +1529,12 @@ fn compile_cc_with_clang_and_save_bitcode(config: &Config, _props: &TestProps, let testcc = testfile.with_extension("cc"); let proc_args = ProcArgs { // FIXME (#9639): This needs to handle non-utf8 paths - prog: config.clang_path.get_ref().as_str().unwrap().to_strbuf(), - args: vec!("-c".to_strbuf(), - "-emit-llvm".to_strbuf(), - "-o".to_strbuf(), - bitcodefile.as_str().unwrap().to_strbuf(), - testcc.as_str().unwrap().to_strbuf()) + prog: config.clang_path.get_ref().as_str().unwrap().to_string(), + args: vec!("-c".to_string(), + "-emit-llvm".to_string(), + "-o".to_string(), + bitcodefile.as_str().unwrap().to_string(), + testcc.as_str().unwrap().to_string()) }; compose_and_run(config, testfile, proc_args, Vec::new(), "", None) } @@ -1548,10 +1548,10 @@ fn extract_function_from_bitcode(config: &Config, _props: &TestProps, let prog = config.llvm_bin_path.get_ref().join("llvm-extract"); let proc_args = ProcArgs { // FIXME (#9639): This needs to handle non-utf8 paths - prog: prog.as_str().unwrap().to_strbuf(), + prog: prog.as_str().unwrap().to_string(), args: vec!(format_strbuf!("-func={}", fname), format_strbuf!("-o={}", extracted_bc.as_str().unwrap()), - bitcodefile.as_str().unwrap().to_strbuf()) + bitcodefile.as_str().unwrap().to_string()) }; compose_and_run(config, testfile, proc_args, Vec::new(), "", None) } @@ -1565,9 +1565,9 @@ fn disassemble_extract(config: &Config, _props: &TestProps, let prog = config.llvm_bin_path.get_ref().join("llvm-dis"); let proc_args = ProcArgs { // FIXME (#9639): This needs to handle non-utf8 paths - prog: prog.as_str().unwrap().to_strbuf(), + prog: prog.as_str().unwrap().to_string(), args: vec!(format_strbuf!("-o={}", extracted_ll.as_str().unwrap()), - extracted_bc.as_str().unwrap().to_strbuf()) + extracted_bc.as_str().unwrap().to_string()) }; compose_and_run(config, testfile, proc_args, Vec::new(), "", None) } @@ -1584,44 +1584,44 @@ fn run_codegen_test(config: &Config, props: &TestProps, testfile: &Path, mm: &mut MetricMap) { if config.llvm_bin_path.is_none() { - fatal("missing --llvm-bin-path".to_strbuf()); + fatal("missing --llvm-bin-path".to_string()); } if config.clang_path.is_none() { - fatal("missing --clang-path".to_strbuf()); + fatal("missing --clang-path".to_string()); } let mut proc_res = compile_test_and_save_bitcode(config, props, testfile); if !proc_res.status.success() { - fatal_ProcRes("compilation failed!".to_strbuf(), &proc_res); + fatal_ProcRes("compilation failed!".to_string(), &proc_res); } proc_res = extract_function_from_bitcode(config, props, "test", testfile, ""); if !proc_res.status.success() { - fatal_ProcRes("extracting 'test' function failed".to_strbuf(), + fatal_ProcRes("extracting 'test' function failed".to_string(), &proc_res); } proc_res = disassemble_extract(config, props, testfile, ""); if !proc_res.status.success() { - fatal_ProcRes("disassembling extract failed".to_strbuf(), &proc_res); + fatal_ProcRes("disassembling extract failed".to_string(), &proc_res); } let mut proc_res = compile_cc_with_clang_and_save_bitcode(config, props, testfile); if !proc_res.status.success() { - fatal_ProcRes("compilation failed!".to_strbuf(), &proc_res); + fatal_ProcRes("compilation failed!".to_string(), &proc_res); } proc_res = extract_function_from_bitcode(config, props, "test", testfile, "clang"); if !proc_res.status.success() { - fatal_ProcRes("extracting 'test' function failed".to_strbuf(), + fatal_ProcRes("extracting 'test' function failed".to_string(), &proc_res); } proc_res = disassemble_extract(config, props, testfile, "clang"); if !proc_res.status.success() { - fatal_ProcRes("disassembling extract failed".to_strbuf(), &proc_res); + fatal_ProcRes("disassembling extract failed".to_string(), &proc_res); } let base = output_base_name(config, testfile); diff --git a/src/compiletest/util.rs b/src/compiletest/util.rs index 5e69f38057380..8f1d5cceb2b99 100644 --- a/src/compiletest/util.rs +++ b/src/compiletest/util.rs @@ -41,15 +41,15 @@ pub fn make_new_path(path: &str) -> String { Some(curr) => { format_strbuf!("{}{}{}", path, path_div(), curr) } - None => path.to_str().to_strbuf() + None => path.to_str().to_string() } } #[cfg(target_os = "win32")] -pub fn lib_path_env_var() -> String { "PATH".to_strbuf() } +pub fn lib_path_env_var() -> String { "PATH".to_string() } #[cfg(target_os = "win32")] -pub fn path_div() -> String { ";".to_strbuf() } +pub fn path_div() -> String { ";".to_string() } pub fn logv(config: &Config, s: String) { debug!("{}", s); diff --git a/src/doc/complement-cheatsheet.md b/src/doc/complement-cheatsheet.md index 3c41bb1b9d965..759518b676917 100644 --- a/src/doc/complement-cheatsheet.md +++ b/src/doc/complement-cheatsheet.md @@ -8,7 +8,7 @@ Use [`ToStr`](../std/to_str/trait.ToStr.html). ~~~ let x: int = 42; -let y: String = x.to_str().to_strbuf(); +let y: String = x.to_str().to_string(); ~~~ **String to int** @@ -65,7 +65,7 @@ To return an Owned String use the str helper function use std::str; let x: Option = - str::from_utf8([ 104u8, 105u8 ]).map(|x| x.to_strbuf()); + str::from_utf8([ 104u8, 105u8 ]).map(|x| x.to_string()); let y: String = x.unwrap(); ~~~ @@ -211,13 +211,13 @@ fn open(Door(name): Door) -> Door { Door::(name) } -let _ = close(Door::("front".to_strbuf())); +let _ = close(Door::("front".to_string())); ~~~ Attempting to close a closed door is prevented statically: ~~~ {.ignore} -let _ = close(Door::("front".to_strbuf())); // error: mismatched types: expected `main::Door` but found `main::Door` +let _ = close(Door::("front".to_string())); // error: mismatched types: expected `main::Door` but found `main::Door` ~~~ # FFI (Foreign Function Interface) diff --git a/src/doc/guide-tasks.md b/src/doc/guide-tasks.md index b0a0f10327c67..f6b7946c86c68 100644 --- a/src/doc/guide-tasks.md +++ b/src/doc/guide-tasks.md @@ -467,7 +467,7 @@ fn stringifier(channel: &sync::DuplexStream) { let mut value: uint; loop { value = channel.recv(); - channel.send(value.to_str().to_strbuf()); + channel.send(value.to_str().to_string()); if value == 0 { break; } } } @@ -492,7 +492,7 @@ extern crate sync; # let mut value: uint; # loop { # value = channel.recv(); -# channel.send(value.to_str().to_strbuf()); +# channel.send(value.to_str().to_string()); # if value == 0u { break; } # } # } diff --git a/src/doc/rust.md b/src/doc/rust.md index 2f002dcfb9a70..4ea17e735dfcd 100644 --- a/src/doc/rust.md +++ b/src/doc/rust.md @@ -1264,8 +1264,8 @@ enum Animal { Cat { name: String, weight: f64 } } -let mut a: Animal = Dog("Cocoa".to_strbuf(), 37.2); -a = Cat { name: "Spotty".to_strbuf(), weight: 2.7 }; +let mut a: Animal = Dog("Cocoa".to_string(), 37.2); +a = Cat { name: "Spotty".to_string(), weight: 2.7 }; ~~~~ In this example, `Cat` is a _struct-like enum variant_, @@ -3578,7 +3578,7 @@ trait Printable { } impl Printable for int { - fn to_string(&self) -> String { self.to_str().to_strbuf() } + fn to_string(&self) -> String { self.to_str().to_string() } } fn print(a: Box) { diff --git a/src/doc/tutorial.md b/src/doc/tutorial.md index 4b15e82ea3bf9..fd51d3dac7482 100644 --- a/src/doc/tutorial.md +++ b/src/doc/tutorial.md @@ -2236,7 +2236,7 @@ impl Printable for String { } # 1.print(); -# ("foo".to_strbuf()).print(); +# ("foo".to_string()).print(); ~~~~ Methods defined in an impl for a trait may be called just like @@ -2286,7 +2286,7 @@ impl Printable for bool {} impl Printable for f32 {} # 1.print(); -# ("foo".to_strbuf()).print(); +# ("foo".to_string()).print(); # true.print(); # 3.14159.print(); ~~~~ diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index ce3fc46cf4ebf..58d8bf289e173 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -547,7 +547,7 @@ mod tests { let arena = TypedArena::new(); for _ in range(0, 100000) { arena.alloc(Noncopy { - string: "hello world".to_strbuf(), + string: "hello world".to_string(), array: vec!( 1, 2, 3, 4, 5 ), }); } @@ -558,7 +558,7 @@ mod tests { let arena = TypedArena::new(); b.iter(|| { arena.alloc(Noncopy { - string: "hello world".to_strbuf(), + string: "hello world".to_string(), array: vec!( 1, 2, 3, 4, 5 ), }) }) @@ -568,7 +568,7 @@ mod tests { pub fn bench_noncopy_nonarena(b: &mut Bencher) { b.iter(|| { box Noncopy { - string: "hello world".to_strbuf(), + string: "hello world".to_string(), array: vec!( 1, 2, 3, 4, 5 ), } }) @@ -579,7 +579,7 @@ mod tests { let arena = Arena::new(); b.iter(|| { arena.alloc(|| Noncopy { - string: "hello world".to_strbuf(), + string: "hello world".to_string(), array: vec!( 1, 2, 3, 4, 5 ), }) }) diff --git a/src/libcollections/lru_cache.rs b/src/libcollections/lru_cache.rs index f4a6cdaa71202..7db3525a36ece 100644 --- a/src/libcollections/lru_cache.rs +++ b/src/libcollections/lru_cache.rs @@ -271,22 +271,22 @@ mod tests { #[test] fn test_put_update() { let mut cache: LruCache> = LruCache::new(1); - cache.put("1".to_strbuf(), vec![10, 10]); - cache.put("1".to_strbuf(), vec![10, 19]); - assert_opt_eq(cache.get(&"1".to_strbuf()), vec![10, 19]); + cache.put("1".to_string(), vec![10, 10]); + cache.put("1".to_string(), vec![10, 19]); + assert_opt_eq(cache.get(&"1".to_string()), vec![10, 19]); assert_eq!(cache.len(), 1); } #[test] fn test_expire_lru() { let mut cache: LruCache = LruCache::new(2); - cache.put("foo1".to_strbuf(), "bar1".to_strbuf()); - cache.put("foo2".to_strbuf(), "bar2".to_strbuf()); - cache.put("foo3".to_strbuf(), "bar3".to_strbuf()); - assert!(cache.get(&"foo1".to_strbuf()).is_none()); - cache.put("foo2".to_strbuf(), "bar2update".to_strbuf()); - cache.put("foo4".to_strbuf(), "bar4".to_strbuf()); - assert!(cache.get(&"foo3".to_strbuf()).is_none()); + cache.put("foo1".to_string(), "bar1".to_string()); + cache.put("foo2".to_string(), "bar2".to_string()); + cache.put("foo3".to_string(), "bar3".to_string()); + assert!(cache.get(&"foo1".to_string()).is_none()); + cache.put("foo2".to_string(), "bar2update".to_string()); + cache.put("foo4".to_string(), "bar4".to_string()); + assert!(cache.get(&"foo3".to_string()).is_none()); } #[test] diff --git a/src/libcore/option.rs b/src/libcore/option.rs index eac1f76d9f423..975736cb40cef 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -194,7 +194,7 @@ impl Option { /// to the value inside the original. /// /// ``` - /// let num_as_str: Option = Some("10".to_strbuf()); + /// let num_as_str: Option = Some("10".to_string()); /// // First, cast `Option` to `Option<&String>` with `as_ref`, /// // then consume *that* with `map`, leaving `num_as_str` on the stack. /// let num_as_int: Option = num_as_str.as_ref().map(|n| n.len()); @@ -281,7 +281,7 @@ impl Option { /// Convert an `Option` into an `Option`, consuming the original: /// /// ``` - /// let num_as_str: Option = Some("10".to_strbuf()); + /// let num_as_str: Option = Some("10".to_string()); /// // `Option::map` takes self *by value*, consuming `num_as_str` /// let num_as_int: Option = num_as_str.map(|n| n.len()); /// ``` @@ -620,7 +620,7 @@ mod tests { #[test] fn test_get_str() { - let x = "test".to_strbuf(); + let x = "test".to_string(); let addr_x = x.as_slice().as_ptr(); let opt = Some(x); let y = opt.unwrap(); @@ -746,7 +746,7 @@ mod tests { #[test] fn test_unwrap() { assert_eq!(Some(1).unwrap(), 1); - let s = Some("hello".to_strbuf()).unwrap(); + let s = Some("hello".to_string()).unwrap(); assert_eq!(s.as_slice(), "hello"); } diff --git a/src/libfmt_macros/lib.rs b/src/libfmt_macros/lib.rs index f575767b0bb54..5300374333b2e 100644 --- a/src/libfmt_macros/lib.rs +++ b/src/libfmt_macros/lib.rs @@ -249,7 +249,7 @@ impl<'a> Parser<'a> { /// String, but I think it does when this eventually uses conditions so it /// might as well start using it now. fn err(&mut self, msg: &str) { - self.errors.push(msg.to_strbuf()); + self.errors.push(msg.to_string()); } /// Optionally consumes the specified character. If the character is not at diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs index 0738462b8260e..08aead025985a 100644 --- a/src/libgetopts/lib.rs +++ b/src/libgetopts/lib.rs @@ -50,7 +50,7 @@ //! //! fn main() { //! let args: Vec = os::args().iter() -//! .map(|x| x.to_strbuf()) +//! .map(|x| x.to_string()) //! .collect(); //! //! let program = args.get(0).clone(); @@ -215,14 +215,14 @@ impl Name { if nm.len() == 1u { Short(nm.char_at(0u)) } else { - Long(nm.to_strbuf()) + Long(nm.to_string()) } } fn to_str(&self) -> String { match *self { - Short(ch) => ch.to_str().to_strbuf(), - Long(ref s) => s.to_strbuf() + Short(ch) => ch.to_str().to_string(), + Long(ref s) => s.to_string() } } } @@ -362,7 +362,7 @@ impl Matches { } match vals.get(0) { &Val(ref s) => Some((*s).clone()), - _ => Some(def.to_strbuf()) + _ => Some(def.to_string()) } } @@ -394,10 +394,10 @@ pub fn reqopt(short_name: &str, long_name: &str, desc: &str, hint: &str) -> OptG let len = short_name.len(); assert!(len == 1 || len == 0); OptGroup { - short_name: short_name.to_strbuf(), - long_name: long_name.to_strbuf(), - hint: hint.to_strbuf(), - desc: desc.to_strbuf(), + short_name: short_name.to_string(), + long_name: long_name.to_string(), + hint: hint.to_string(), + desc: desc.to_string(), hasarg: Yes, occur: Req } @@ -408,10 +408,10 @@ pub fn optopt(short_name: &str, long_name: &str, desc: &str, hint: &str) -> OptG let len = short_name.len(); assert!(len == 1 || len == 0); OptGroup { - short_name: short_name.to_strbuf(), - long_name: long_name.to_strbuf(), - hint: hint.to_strbuf(), - desc: desc.to_strbuf(), + short_name: short_name.to_string(), + long_name: long_name.to_string(), + hint: hint.to_string(), + desc: desc.to_string(), hasarg: Yes, occur: Optional } @@ -422,10 +422,10 @@ pub fn optflag(short_name: &str, long_name: &str, desc: &str) -> OptGroup { let len = short_name.len(); assert!(len == 1 || len == 0); OptGroup { - short_name: short_name.to_strbuf(), - long_name: long_name.to_strbuf(), - hint: "".to_strbuf(), - desc: desc.to_strbuf(), + short_name: short_name.to_string(), + long_name: long_name.to_string(), + hint: "".to_string(), + desc: desc.to_string(), hasarg: No, occur: Optional } @@ -437,10 +437,10 @@ pub fn optflagmulti(short_name: &str, long_name: &str, desc: &str) -> OptGroup { let len = short_name.len(); assert!(len == 1 || len == 0); OptGroup { - short_name: short_name.to_strbuf(), - long_name: long_name.to_strbuf(), - hint: "".to_strbuf(), - desc: desc.to_strbuf(), + short_name: short_name.to_string(), + long_name: long_name.to_string(), + hint: "".to_string(), + desc: desc.to_string(), hasarg: No, occur: Multi } @@ -451,10 +451,10 @@ pub fn optflagopt(short_name: &str, long_name: &str, desc: &str, hint: &str) -> let len = short_name.len(); assert!(len == 1 || len == 0); OptGroup { - short_name: short_name.to_strbuf(), - long_name: long_name.to_strbuf(), - hint: hint.to_strbuf(), - desc: desc.to_strbuf(), + short_name: short_name.to_string(), + long_name: long_name.to_string(), + hint: hint.to_string(), + desc: desc.to_string(), hasarg: Maybe, occur: Optional } @@ -466,10 +466,10 @@ pub fn optmulti(short_name: &str, long_name: &str, desc: &str, hint: &str) -> Op let len = short_name.len(); assert!(len == 1 || len == 0); OptGroup { - short_name: short_name.to_strbuf(), - long_name: long_name.to_strbuf(), - hint: hint.to_strbuf(), - desc: desc.to_strbuf(), + short_name: short_name.to_string(), + long_name: long_name.to_string(), + hint: hint.to_string(), + desc: desc.to_string(), hasarg: Yes, occur: Multi } @@ -485,10 +485,10 @@ pub fn opt(short_name: &str, let len = short_name.len(); assert!(len == 1 || len == 0); OptGroup { - short_name: short_name.to_strbuf(), - long_name: long_name.to_strbuf(), - hint: hint.to_strbuf(), - desc: desc.to_strbuf(), + short_name: short_name.to_string(), + long_name: long_name.to_string(), + hint: hint.to_string(), + desc: desc.to_string(), hasarg: hasarg, occur: occur } @@ -548,11 +548,11 @@ pub fn getopts(args: &[String], optgrps: &[OptGroup]) -> Result { let tail = cur.as_slice().slice(2, curlen); let tail_eq: Vec<&str> = tail.split('=').collect(); if tail_eq.len() <= 1 { - names = vec!(Long(tail.to_strbuf())); + names = vec!(Long(tail.to_string())); } else { names = - vec!(Long((*tail_eq.get(0)).to_strbuf())); - i_arg = Some((*tail_eq.get(1)).to_strbuf()); + vec!(Long((*tail_eq.get(0)).to_string())); + i_arg = Some((*tail_eq.get(1)).to_string()); } } else { let mut j = 1; @@ -582,7 +582,7 @@ pub fn getopts(args: &[String], optgrps: &[OptGroup]) -> Result { }; if arg_follows && j < curlen { i_arg = Some(cur.as_slice() - .slice(j, curlen).to_strbuf()); + .slice(j, curlen).to_string()); break; } else { last_valid_opt_id = None; @@ -900,19 +900,19 @@ fn each_split_within<'a>(ss: &'a str, lim: uint, it: |&'a str| -> bool) fn test_split_within() { fn t(s: &str, i: uint, u: &[String]) { let mut v = Vec::new(); - each_split_within(s, i, |s| { v.push(s.to_strbuf()); true }); + each_split_within(s, i, |s| { v.push(s.to_string()); true }); assert!(v.iter().zip(u.iter()).all(|(a,b)| a == b)); } t("", 0, []); t("", 15, []); - t("hello", 15, ["hello".to_strbuf()]); + t("hello", 15, ["hello".to_string()]); t("\nMary had a little lamb\nLittle lamb\n", 15, [ - "Mary had a".to_strbuf(), - "little lamb".to_strbuf(), - "Little lamb".to_strbuf() + "Mary had a".to_string(), + "little lamb".to_string(), + "Little lamb".to_string() ]); t("\nMary had a little lamb\nLittle lamb\n", ::std::uint::MAX, - ["Mary had a little lamb\nLittle lamb".to_strbuf()]); + ["Mary had a little lamb\nLittle lamb".to_string()]); } #[cfg(test)] @@ -935,25 +935,25 @@ mod tests { // Tests for reqopt #[test] fn test_reqopt() { - let long_args = vec!("--test=20".to_strbuf()); + let long_args = vec!("--test=20".to_string()); let opts = vec!(reqopt("t", "test", "testing", "TEST")); let rs = getopts(long_args.as_slice(), opts.as_slice()); match rs { Ok(ref m) => { assert!(m.opt_present("test")); - assert_eq!(m.opt_str("test").unwrap(), "20".to_strbuf()); + assert_eq!(m.opt_str("test").unwrap(), "20".to_string()); assert!(m.opt_present("t")); - assert_eq!(m.opt_str("t").unwrap(), "20".to_strbuf()); + assert_eq!(m.opt_str("t").unwrap(), "20".to_string()); } _ => { fail!("test_reqopt failed (long arg)"); } } - let short_args = vec!("-t".to_strbuf(), "20".to_strbuf()); + let short_args = vec!("-t".to_string(), "20".to_string()); match getopts(short_args.as_slice(), opts.as_slice()) { Ok(ref m) => { assert!((m.opt_present("test"))); - assert_eq!(m.opt_str("test").unwrap(), "20".to_strbuf()); + assert_eq!(m.opt_str("test").unwrap(), "20".to_string()); assert!((m.opt_present("t"))); - assert_eq!(m.opt_str("t").unwrap(), "20".to_strbuf()); + assert_eq!(m.opt_str("t").unwrap(), "20".to_string()); } _ => { fail!("test_reqopt failed (short arg)"); } } @@ -961,7 +961,7 @@ mod tests { #[test] fn test_reqopt_missing() { - let args = vec!("blah".to_strbuf()); + let args = vec!("blah".to_string()); let opts = vec!(reqopt("t", "test", "testing", "TEST")); let rs = getopts(args.as_slice(), opts.as_slice()); match rs { @@ -972,14 +972,14 @@ mod tests { #[test] fn test_reqopt_no_arg() { - let long_args = vec!("--test".to_strbuf()); + let long_args = vec!("--test".to_string()); let opts = vec!(reqopt("t", "test", "testing", "TEST")); let rs = getopts(long_args.as_slice(), opts.as_slice()); match rs { Err(f) => check_fail_type(f, ArgumentMissing_), _ => fail!() } - let short_args = vec!("-t".to_strbuf()); + let short_args = vec!("-t".to_string()); match getopts(short_args.as_slice(), opts.as_slice()) { Err(f) => check_fail_type(f, ArgumentMissing_), _ => fail!() @@ -988,7 +988,7 @@ mod tests { #[test] fn test_reqopt_multi() { - let args = vec!("--test=20".to_strbuf(), "-t".to_strbuf(), "30".to_strbuf()); + let args = vec!("--test=20".to_string(), "-t".to_string(), "30".to_string()); let opts = vec!(reqopt("t", "test", "testing", "TEST")); let rs = getopts(args.as_slice(), opts.as_slice()); match rs { @@ -1000,25 +1000,25 @@ mod tests { // Tests for optopt #[test] fn test_optopt() { - let long_args = vec!("--test=20".to_strbuf()); + let long_args = vec!("--test=20".to_string()); let opts = vec!(optopt("t", "test", "testing", "TEST")); let rs = getopts(long_args.as_slice(), opts.as_slice()); match rs { Ok(ref m) => { assert!(m.opt_present("test")); - assert_eq!(m.opt_str("test").unwrap(), "20".to_strbuf()); + assert_eq!(m.opt_str("test").unwrap(), "20".to_string()); assert!((m.opt_present("t"))); - assert_eq!(m.opt_str("t").unwrap(), "20".to_strbuf()); + assert_eq!(m.opt_str("t").unwrap(), "20".to_string()); } _ => fail!() } - let short_args = vec!("-t".to_strbuf(), "20".to_strbuf()); + let short_args = vec!("-t".to_string(), "20".to_string()); match getopts(short_args.as_slice(), opts.as_slice()) { Ok(ref m) => { assert!((m.opt_present("test"))); - assert_eq!(m.opt_str("test").unwrap(), "20".to_strbuf()); + assert_eq!(m.opt_str("test").unwrap(), "20".to_string()); assert!((m.opt_present("t"))); - assert_eq!(m.opt_str("t").unwrap(), "20".to_strbuf()); + assert_eq!(m.opt_str("t").unwrap(), "20".to_string()); } _ => fail!() } @@ -1026,7 +1026,7 @@ mod tests { #[test] fn test_optopt_missing() { - let args = vec!("blah".to_strbuf()); + let args = vec!("blah".to_string()); let opts = vec!(optopt("t", "test", "testing", "TEST")); let rs = getopts(args.as_slice(), opts.as_slice()); match rs { @@ -1040,14 +1040,14 @@ mod tests { #[test] fn test_optopt_no_arg() { - let long_args = vec!("--test".to_strbuf()); + let long_args = vec!("--test".to_string()); let opts = vec!(optopt("t", "test", "testing", "TEST")); let rs = getopts(long_args.as_slice(), opts.as_slice()); match rs { Err(f) => check_fail_type(f, ArgumentMissing_), _ => fail!() } - let short_args = vec!("-t".to_strbuf()); + let short_args = vec!("-t".to_string()); match getopts(short_args.as_slice(), opts.as_slice()) { Err(f) => check_fail_type(f, ArgumentMissing_), _ => fail!() @@ -1056,7 +1056,7 @@ mod tests { #[test] fn test_optopt_multi() { - let args = vec!("--test=20".to_strbuf(), "-t".to_strbuf(), "30".to_strbuf()); + let args = vec!("--test=20".to_string(), "-t".to_string(), "30".to_string()); let opts = vec!(optopt("t", "test", "testing", "TEST")); let rs = getopts(args.as_slice(), opts.as_slice()); match rs { @@ -1068,7 +1068,7 @@ mod tests { // Tests for optflag #[test] fn test_optflag() { - let long_args = vec!("--test".to_strbuf()); + let long_args = vec!("--test".to_string()); let opts = vec!(optflag("t", "test", "testing")); let rs = getopts(long_args.as_slice(), opts.as_slice()); match rs { @@ -1078,7 +1078,7 @@ mod tests { } _ => fail!() } - let short_args = vec!("-t".to_strbuf()); + let short_args = vec!("-t".to_string()); match getopts(short_args.as_slice(), opts.as_slice()) { Ok(ref m) => { assert!(m.opt_present("test")); @@ -1090,7 +1090,7 @@ mod tests { #[test] fn test_optflag_missing() { - let args = vec!("blah".to_strbuf()); + let args = vec!("blah".to_string()); let opts = vec!(optflag("t", "test", "testing")); let rs = getopts(args.as_slice(), opts.as_slice()); match rs { @@ -1104,7 +1104,7 @@ mod tests { #[test] fn test_optflag_long_arg() { - let args = vec!("--test=20".to_strbuf()); + let args = vec!("--test=20".to_string()); let opts = vec!(optflag("t", "test", "testing")); let rs = getopts(args.as_slice(), opts.as_slice()); match rs { @@ -1118,7 +1118,7 @@ mod tests { #[test] fn test_optflag_multi() { - let args = vec!("--test".to_strbuf(), "-t".to_strbuf()); + let args = vec!("--test".to_string(), "-t".to_string()); let opts = vec!(optflag("t", "test", "testing")); let rs = getopts(args.as_slice(), opts.as_slice()); match rs { @@ -1129,14 +1129,14 @@ mod tests { #[test] fn test_optflag_short_arg() { - let args = vec!("-t".to_strbuf(), "20".to_strbuf()); + let args = vec!("-t".to_string(), "20".to_string()); let opts = vec!(optflag("t", "test", "testing")); let rs = getopts(args.as_slice(), opts.as_slice()); match rs { Ok(ref m) => { // The next variable after the flag is just a free argument - assert!(*m.free.get(0) == "20".to_strbuf()); + assert!(*m.free.get(0) == "20".to_string()); } _ => fail!() } @@ -1145,7 +1145,7 @@ mod tests { // Tests for optflagmulti #[test] fn test_optflagmulti_short1() { - let args = vec!("-v".to_strbuf()); + let args = vec!("-v".to_string()); let opts = vec!(optflagmulti("v", "verbose", "verbosity")); let rs = getopts(args.as_slice(), opts.as_slice()); match rs { @@ -1158,7 +1158,7 @@ mod tests { #[test] fn test_optflagmulti_short2a() { - let args = vec!("-v".to_strbuf(), "-v".to_strbuf()); + let args = vec!("-v".to_string(), "-v".to_string()); let opts = vec!(optflagmulti("v", "verbose", "verbosity")); let rs = getopts(args.as_slice(), opts.as_slice()); match rs { @@ -1171,7 +1171,7 @@ mod tests { #[test] fn test_optflagmulti_short2b() { - let args = vec!("-vv".to_strbuf()); + let args = vec!("-vv".to_string()); let opts = vec!(optflagmulti("v", "verbose", "verbosity")); let rs = getopts(args.as_slice(), opts.as_slice()); match rs { @@ -1184,7 +1184,7 @@ mod tests { #[test] fn test_optflagmulti_long1() { - let args = vec!("--verbose".to_strbuf()); + let args = vec!("--verbose".to_string()); let opts = vec!(optflagmulti("v", "verbose", "verbosity")); let rs = getopts(args.as_slice(), opts.as_slice()); match rs { @@ -1197,7 +1197,7 @@ mod tests { #[test] fn test_optflagmulti_long2() { - let args = vec!("--verbose".to_strbuf(), "--verbose".to_strbuf()); + let args = vec!("--verbose".to_string(), "--verbose".to_string()); let opts = vec!(optflagmulti("v", "verbose", "verbosity")); let rs = getopts(args.as_slice(), opts.as_slice()); match rs { @@ -1210,8 +1210,8 @@ mod tests { #[test] fn test_optflagmulti_mix() { - let args = vec!("--verbose".to_strbuf(), "-v".to_strbuf(), - "-vv".to_strbuf(), "verbose".to_strbuf()); + let args = vec!("--verbose".to_string(), "-v".to_string(), + "-vv".to_string(), "verbose".to_string()); let opts = vec!(optflagmulti("v", "verbose", "verbosity")); let rs = getopts(args.as_slice(), opts.as_slice()); match rs { @@ -1226,25 +1226,25 @@ mod tests { // Tests for optmulti #[test] fn test_optmulti() { - let long_args = vec!("--test=20".to_strbuf()); + let long_args = vec!("--test=20".to_string()); let opts = vec!(optmulti("t", "test", "testing", "TEST")); let rs = getopts(long_args.as_slice(), opts.as_slice()); match rs { Ok(ref m) => { assert!((m.opt_present("test"))); - assert_eq!(m.opt_str("test").unwrap(), "20".to_strbuf()); + assert_eq!(m.opt_str("test").unwrap(), "20".to_string()); assert!((m.opt_present("t"))); - assert_eq!(m.opt_str("t").unwrap(), "20".to_strbuf()); + assert_eq!(m.opt_str("t").unwrap(), "20".to_string()); } _ => fail!() } - let short_args = vec!("-t".to_strbuf(), "20".to_strbuf()); + let short_args = vec!("-t".to_string(), "20".to_string()); match getopts(short_args.as_slice(), opts.as_slice()) { Ok(ref m) => { assert!((m.opt_present("test"))); - assert_eq!(m.opt_str("test").unwrap(), "20".to_strbuf()); + assert_eq!(m.opt_str("test").unwrap(), "20".to_string()); assert!((m.opt_present("t"))); - assert_eq!(m.opt_str("t").unwrap(), "20".to_strbuf()); + assert_eq!(m.opt_str("t").unwrap(), "20".to_string()); } _ => fail!() } @@ -1252,7 +1252,7 @@ mod tests { #[test] fn test_optmulti_missing() { - let args = vec!("blah".to_strbuf()); + let args = vec!("blah".to_string()); let opts = vec!(optmulti("t", "test", "testing", "TEST")); let rs = getopts(args.as_slice(), opts.as_slice()); match rs { @@ -1266,14 +1266,14 @@ mod tests { #[test] fn test_optmulti_no_arg() { - let long_args = vec!("--test".to_strbuf()); + let long_args = vec!("--test".to_string()); let opts = vec!(optmulti("t", "test", "testing", "TEST")); let rs = getopts(long_args.as_slice(), opts.as_slice()); match rs { Err(f) => check_fail_type(f, ArgumentMissing_), _ => fail!() } - let short_args = vec!("-t".to_strbuf()); + let short_args = vec!("-t".to_string()); match getopts(short_args.as_slice(), opts.as_slice()) { Err(f) => check_fail_type(f, ArgumentMissing_), _ => fail!() @@ -1282,18 +1282,18 @@ mod tests { #[test] fn test_optmulti_multi() { - let args = vec!("--test=20".to_strbuf(), "-t".to_strbuf(), "30".to_strbuf()); + let args = vec!("--test=20".to_string(), "-t".to_string(), "30".to_string()); let opts = vec!(optmulti("t", "test", "testing", "TEST")); let rs = getopts(args.as_slice(), opts.as_slice()); match rs { Ok(ref m) => { assert!(m.opt_present("test")); - assert_eq!(m.opt_str("test").unwrap(), "20".to_strbuf()); + assert_eq!(m.opt_str("test").unwrap(), "20".to_string()); assert!(m.opt_present("t")); - assert_eq!(m.opt_str("t").unwrap(), "20".to_strbuf()); + assert_eq!(m.opt_str("t").unwrap(), "20".to_string()); let pair = m.opt_strs("test"); - assert!(*pair.get(0) == "20".to_strbuf()); - assert!(*pair.get(1) == "30".to_strbuf()); + assert!(*pair.get(0) == "20".to_string()); + assert!(*pair.get(1) == "30".to_string()); } _ => fail!() } @@ -1301,14 +1301,14 @@ mod tests { #[test] fn test_unrecognized_option() { - let long_args = vec!("--untest".to_strbuf()); + let long_args = vec!("--untest".to_string()); let opts = vec!(optmulti("t", "test", "testing", "TEST")); let rs = getopts(long_args.as_slice(), opts.as_slice()); match rs { Err(f) => check_fail_type(f, UnrecognizedOption_), _ => fail!() } - let short_args = vec!("-u".to_strbuf()); + let short_args = vec!("-u".to_string()); match getopts(short_args.as_slice(), opts.as_slice()) { Err(f) => check_fail_type(f, UnrecognizedOption_), _ => fail!() @@ -1318,22 +1318,22 @@ mod tests { #[test] fn test_combined() { let args = - vec!("prog".to_strbuf(), - "free1".to_strbuf(), - "-s".to_strbuf(), - "20".to_strbuf(), - "free2".to_strbuf(), - "--flag".to_strbuf(), - "--long=30".to_strbuf(), - "-f".to_strbuf(), - "-m".to_strbuf(), - "40".to_strbuf(), - "-m".to_strbuf(), - "50".to_strbuf(), - "-n".to_strbuf(), - "-A B".to_strbuf(), - "-n".to_strbuf(), - "-60 70".to_strbuf()); + vec!("prog".to_string(), + "free1".to_string(), + "-s".to_string(), + "20".to_string(), + "free2".to_string(), + "--flag".to_string(), + "--long=30".to_string(), + "-f".to_string(), + "-m".to_string(), + "40".to_string(), + "-m".to_string(), + "50".to_string(), + "-n".to_string(), + "-A B".to_string(), + "-n".to_string(), + "-60 70".to_string()); let opts = vec!(optopt("s", "something", "something", "SOMETHING"), optflag("", "flag", "a flag"), @@ -1345,19 +1345,19 @@ mod tests { let rs = getopts(args.as_slice(), opts.as_slice()); match rs { Ok(ref m) => { - assert!(*m.free.get(0) == "prog".to_strbuf()); - assert!(*m.free.get(1) == "free1".to_strbuf()); - assert_eq!(m.opt_str("s").unwrap(), "20".to_strbuf()); - assert!(*m.free.get(2) == "free2".to_strbuf()); + assert!(*m.free.get(0) == "prog".to_string()); + assert!(*m.free.get(1) == "free1".to_string()); + assert_eq!(m.opt_str("s").unwrap(), "20".to_string()); + assert!(*m.free.get(2) == "free2".to_string()); assert!((m.opt_present("flag"))); - assert_eq!(m.opt_str("long").unwrap(), "30".to_strbuf()); + assert_eq!(m.opt_str("long").unwrap(), "30".to_string()); assert!((m.opt_present("f"))); let pair = m.opt_strs("m"); - assert!(*pair.get(0) == "40".to_strbuf()); - assert!(*pair.get(1) == "50".to_strbuf()); + assert!(*pair.get(0) == "40".to_string()); + assert!(*pair.get(1) == "50".to_string()); let pair = m.opt_strs("n"); - assert!(*pair.get(0) == "-A B".to_strbuf()); - assert!(*pair.get(1) == "-60 70".to_strbuf()); + assert!(*pair.get(0) == "-A B".to_string()); + assert!(*pair.get(1) == "-60 70".to_string()); assert!((!m.opt_present("notpresent"))); } _ => fail!() @@ -1370,68 +1370,68 @@ mod tests { optopt("", "encrypt", "encrypt", "ENCRYPT"), optopt("f", "", "flag", "FLAG")); - let args_single = vec!("-e".to_strbuf(), "foo".to_strbuf()); + let args_single = vec!("-e".to_string(), "foo".to_string()); let matches_single = &match getopts(args_single.as_slice(), opts.as_slice()) { result::Ok(m) => m, result::Err(_) => fail!() }; - assert!(matches_single.opts_present(["e".to_strbuf()])); - assert!(matches_single.opts_present(["encrypt".to_strbuf(), "e".to_strbuf()])); - assert!(matches_single.opts_present(["e".to_strbuf(), "encrypt".to_strbuf()])); - assert!(!matches_single.opts_present(["encrypt".to_strbuf()])); - assert!(!matches_single.opts_present(["thing".to_strbuf()])); + assert!(matches_single.opts_present(["e".to_string()])); + assert!(matches_single.opts_present(["encrypt".to_string(), "e".to_string()])); + assert!(matches_single.opts_present(["e".to_string(), "encrypt".to_string()])); + assert!(!matches_single.opts_present(["encrypt".to_string()])); + assert!(!matches_single.opts_present(["thing".to_string()])); assert!(!matches_single.opts_present([])); - assert_eq!(matches_single.opts_str(["e".to_strbuf()]).unwrap(), "foo".to_strbuf()); - assert_eq!(matches_single.opts_str(["e".to_strbuf(), "encrypt".to_strbuf()]).unwrap(), - "foo".to_strbuf()); - assert_eq!(matches_single.opts_str(["encrypt".to_strbuf(), "e".to_strbuf()]).unwrap(), - "foo".to_strbuf()); + assert_eq!(matches_single.opts_str(["e".to_string()]).unwrap(), "foo".to_string()); + assert_eq!(matches_single.opts_str(["e".to_string(), "encrypt".to_string()]).unwrap(), + "foo".to_string()); + assert_eq!(matches_single.opts_str(["encrypt".to_string(), "e".to_string()]).unwrap(), + "foo".to_string()); - let args_both = vec!("-e".to_strbuf(), "foo".to_strbuf(), "--encrypt".to_strbuf(), - "foo".to_strbuf()); + let args_both = vec!("-e".to_string(), "foo".to_string(), "--encrypt".to_string(), + "foo".to_string()); let matches_both = &match getopts(args_both.as_slice(), opts.as_slice()) { result::Ok(m) => m, result::Err(_) => fail!() }; - assert!(matches_both.opts_present(["e".to_strbuf()])); - assert!(matches_both.opts_present(["encrypt".to_strbuf()])); - assert!(matches_both.opts_present(["encrypt".to_strbuf(), "e".to_strbuf()])); - assert!(matches_both.opts_present(["e".to_strbuf(), "encrypt".to_strbuf()])); - assert!(!matches_both.opts_present(["f".to_strbuf()])); - assert!(!matches_both.opts_present(["thing".to_strbuf()])); + assert!(matches_both.opts_present(["e".to_string()])); + assert!(matches_both.opts_present(["encrypt".to_string()])); + assert!(matches_both.opts_present(["encrypt".to_string(), "e".to_string()])); + assert!(matches_both.opts_present(["e".to_string(), "encrypt".to_string()])); + assert!(!matches_both.opts_present(["f".to_string()])); + assert!(!matches_both.opts_present(["thing".to_string()])); assert!(!matches_both.opts_present([])); - assert_eq!(matches_both.opts_str(["e".to_strbuf()]).unwrap(), "foo".to_strbuf()); - assert_eq!(matches_both.opts_str(["encrypt".to_strbuf()]).unwrap(), "foo".to_strbuf()); - assert_eq!(matches_both.opts_str(["e".to_strbuf(), "encrypt".to_strbuf()]).unwrap(), - "foo".to_strbuf()); - assert_eq!(matches_both.opts_str(["encrypt".to_strbuf(), "e".to_strbuf()]).unwrap(), - "foo".to_strbuf()); + assert_eq!(matches_both.opts_str(["e".to_string()]).unwrap(), "foo".to_string()); + assert_eq!(matches_both.opts_str(["encrypt".to_string()]).unwrap(), "foo".to_string()); + assert_eq!(matches_both.opts_str(["e".to_string(), "encrypt".to_string()]).unwrap(), + "foo".to_string()); + assert_eq!(matches_both.opts_str(["encrypt".to_string(), "e".to_string()]).unwrap(), + "foo".to_string()); } #[test] fn test_nospace() { - let args = vec!("-Lfoo".to_strbuf(), "-M.".to_strbuf()); + let args = vec!("-Lfoo".to_string(), "-M.".to_string()); let opts = vec!(optmulti("L", "", "library directory", "LIB"), optmulti("M", "", "something", "MMMM")); let matches = &match getopts(args.as_slice(), opts.as_slice()) { result::Ok(m) => m, result::Err(_) => fail!() }; - assert!(matches.opts_present(["L".to_strbuf()])); - assert_eq!(matches.opts_str(["L".to_strbuf()]).unwrap(), "foo".to_strbuf()); - assert!(matches.opts_present(["M".to_strbuf()])); - assert_eq!(matches.opts_str(["M".to_strbuf()]).unwrap(), ".".to_strbuf()); + assert!(matches.opts_present(["L".to_string()])); + assert_eq!(matches.opts_str(["L".to_string()]).unwrap(), "foo".to_string()); + assert!(matches.opts_present(["M".to_string()])); + assert_eq!(matches.opts_str(["M".to_string()]).unwrap(), ".".to_string()); } #[test] fn test_long_to_short() { let mut short = Opt { - name: Long("banana".to_strbuf()), + name: Long("banana".to_string()), hasarg: Yes, occur: Req, aliases: Vec::new(), @@ -1450,7 +1450,7 @@ mod tests { let opts = vec!( optflagmulti("a", "apple", "Desc")); - let args = vec!("-a".to_strbuf(), "--apple".to_strbuf(), "-a".to_strbuf()); + let args = vec!("-a".to_string(), "--apple".to_string(), "-a".to_string()); let matches = getopts(args.as_slice(), opts.as_slice()).unwrap(); assert_eq!(3, matches.opt_count("a")); @@ -1477,7 +1477,7 @@ Options: -k --kiwi Desc -p [VAL] Desc -l VAL Desc -".to_strbuf(); +".to_string(); let generated_usage = usage("Usage: fruits", optgroups.as_slice()); @@ -1504,7 +1504,7 @@ Options: -k --kiwi This is a long description which won't be wrapped..+.. -a --apple This is a long description which _will_ be wrapped..+.. -".to_strbuf(); +".to_string(); let usage = usage("Usage: fruits", optgroups.as_slice()); @@ -1530,7 +1530,7 @@ Options: -a --apple This “description” has some characters that could confuse the line wrapping; an apple costs 0.51€ in some parts of Europe. -".to_strbuf(); +".to_string(); let usage = usage("Usage: fruits", optgroups.as_slice()); @@ -1549,7 +1549,7 @@ Options: optflagopt("p", "", "Desc", "VAL"), optmulti("l", "", "Desc", "VAL")); - let expected = "Usage: fruits -b VAL [-a VAL] [-k] [-p [VAL]] [-l VAL]..".to_strbuf(); + let expected = "Usage: fruits -b VAL [-a VAL] [-k] [-p [VAL]] [-l VAL]..".to_string(); let generated_usage = short_usage("fruits", optgroups.as_slice()); debug!("expected: <<{}>>", expected); diff --git a/src/libglob/lib.rs b/src/libglob/lib.rs index d2587746e0de6..1affeadbff1f2 100644 --- a/src/libglob/lib.rs +++ b/src/libglob/lib.rs @@ -767,7 +767,7 @@ mod test { #[test] fn test_pattern_escape() { let s = "_[_]_?_*_!_"; - assert_eq!(Pattern::escape(s), "_[[]_[]]_[?]_[*]_!_".to_strbuf()); + assert_eq!(Pattern::escape(s), "_[[]_[]]_[?]_[*]_!_".to_string()); assert!(Pattern::new(Pattern::escape(s).as_slice()).matches(s)); } diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs index 15030da75d714..e5fb200a1c417 100644 --- a/src/libgraphviz/lib.rs +++ b/src/libgraphviz/lib.rs @@ -435,8 +435,8 @@ impl<'a> LabelText<'a> { /// Renders text as string suitable for a label in a .dot file. pub fn escape(&self) -> String { match self { - &LabelStr(ref s) => s.as_slice().escape_default().to_strbuf(), - &EscStr(ref s) => LabelText::escape_str(s.as_slice()).to_strbuf(), + &LabelStr(ref s) => s.as_slice().escape_default().to_string(), + &EscStr(ref s) => LabelText::escape_str(s.as_slice()).to_string(), } } } @@ -666,7 +666,7 @@ mod tests { render(&g, &mut writer).unwrap(); let mut r = BufReader::new(writer.get_ref()); match r.read_to_str() { - Ok(string) => Ok(string.to_strbuf()), + Ok(string) => Ok(string.to_string()), Err(err) => Err(err), } } diff --git a/src/libhexfloat/lib.rs b/src/libhexfloat/lib.rs index 8f0630bbb86ea..ee14f1aaea9a2 100644 --- a/src/libhexfloat/lib.rs +++ b/src/libhexfloat/lib.rs @@ -75,34 +75,34 @@ fn hex_float_lit_err(s: &str) -> Option<(uint, String)> { let mut i = 0; if chars.peek() == Some(&'-') { chars.next(); i+= 1 } if chars.next() != Some('0') { - return Some((i, "Expected '0'".to_strbuf())); + return Some((i, "Expected '0'".to_string())); } i+=1; if chars.next() != Some('x') { - return Some((i, "Expected 'x'".to_strbuf())); + return Some((i, "Expected 'x'".to_string())); } i+=1; let mut d_len = 0; for _ in chars.take_while(|c| c.is_digit_radix(16)) { chars.next(); i+=1; d_len += 1;} if chars.next() != Some('.') { - return Some((i, "Expected '.'".to_strbuf())); + return Some((i, "Expected '.'".to_string())); } i+=1; let mut f_len = 0; for _ in chars.take_while(|c| c.is_digit_radix(16)) { chars.next(); i+=1; f_len += 1;} if d_len == 0 && f_len == 0 { return Some((i, "Expected digits before or after decimal \ - point".to_strbuf())); + point".to_string())); } if chars.next() != Some('p') { - return Some((i, "Expected 'p'".to_strbuf())); + return Some((i, "Expected 'p'".to_string())); } i+=1; if chars.peek() == Some(&'-') { chars.next(); i+= 1 } let mut e_len = 0; for _ in chars.take_while(|c| c.is_digit()) { chars.next(); i+=1; e_len += 1} if e_len == 0 { - return Some((i, "Expected exponent digits".to_strbuf())); + return Some((i, "Expected exponent digits".to_string())); } match chars.next() { None => None, - Some(_) => Some((i, "Expected end of string".to_strbuf())) + Some(_) => Some((i, "Expected end of string".to_string())) } } diff --git a/src/liblog/directive.rs b/src/liblog/directive.rs index 3569f8f542069..2062bb4c7b1b6 100644 --- a/src/liblog/directive.rs +++ b/src/liblog/directive.rs @@ -64,7 +64,7 @@ pub fn parse_logging_spec(spec: &str) -> Vec { } }; dirs.push(LogDirective { - name: name.map(|s| s.to_strbuf()), + name: name.map(|s| s.to_string()), level: log_level, }); } @@ -80,13 +80,13 @@ mod tests { let dirs = parse_logging_spec("crate1::mod1=1,crate1::mod2,crate2=4"); let dirs = dirs.as_slice(); assert_eq!(dirs.len(), 3); - assert_eq!(dirs[0].name, Some("crate1::mod1".to_strbuf())); + assert_eq!(dirs[0].name, Some("crate1::mod1".to_string())); assert_eq!(dirs[0].level, 1); - assert_eq!(dirs[1].name, Some("crate1::mod2".to_strbuf())); + assert_eq!(dirs[1].name, Some("crate1::mod2".to_string())); assert_eq!(dirs[1].level, ::MAX_LOG_LEVEL); - assert_eq!(dirs[2].name, Some("crate2".to_strbuf())); + assert_eq!(dirs[2].name, Some("crate2".to_string())); assert_eq!(dirs[2].level, 4); } @@ -96,7 +96,7 @@ mod tests { let dirs = parse_logging_spec("crate1::mod1=1=2,crate2=4"); let dirs = dirs.as_slice(); assert_eq!(dirs.len(), 1); - assert_eq!(dirs[0].name, Some("crate2".to_strbuf())); + assert_eq!(dirs[0].name, Some("crate2".to_string())); assert_eq!(dirs[0].level, 4); } @@ -106,7 +106,7 @@ mod tests { let dirs = parse_logging_spec("crate1::mod1=noNumber,crate2=4"); let dirs = dirs.as_slice(); assert_eq!(dirs.len(), 1); - assert_eq!(dirs[0].name, Some("crate2".to_strbuf())); + assert_eq!(dirs[0].name, Some("crate2".to_string())); assert_eq!(dirs[0].level, 4); } @@ -116,7 +116,7 @@ mod tests { let dirs = parse_logging_spec("crate1::mod1=wrong,crate2=warn"); let dirs = dirs.as_slice(); assert_eq!(dirs.len(), 1); - assert_eq!(dirs[0].name, Some("crate2".to_strbuf())); + assert_eq!(dirs[0].name, Some("crate2".to_string())); assert_eq!(dirs[0].level, ::WARN); } @@ -128,7 +128,7 @@ mod tests { assert_eq!(dirs.len(), 2); assert_eq!(dirs[0].name, None); assert_eq!(dirs[0].level, 2); - assert_eq!(dirs[1].name, Some("crate2".to_strbuf())); + assert_eq!(dirs[1].name, Some("crate2".to_string())); assert_eq!(dirs[1].level, 4); } } diff --git a/src/liblog/lib.rs b/src/liblog/lib.rs index fd05e54ad3ba1..6f9f3f2e21e03 100644 --- a/src/liblog/lib.rs +++ b/src/liblog/lib.rs @@ -366,11 +366,11 @@ mod tests { fn match_full_path() { let dirs = [ LogDirective { - name: Some("crate2".to_strbuf()), + name: Some("crate2".to_string()), level: 3 }, LogDirective { - name: Some("crate1::mod1".to_strbuf()), + name: Some("crate1::mod1".to_string()), level: 2 } ]; @@ -383,8 +383,8 @@ mod tests { #[test] fn no_match() { let dirs = [ - LogDirective { name: Some("crate2".to_strbuf()), level: 3 }, - LogDirective { name: Some("crate1::mod1".to_strbuf()), level: 2 } + LogDirective { name: Some("crate2".to_string()), level: 3 }, + LogDirective { name: Some("crate1::mod1".to_string()), level: 2 } ]; assert!(!enabled(2, "crate3", dirs.iter())); } @@ -392,8 +392,8 @@ mod tests { #[test] fn match_beginning() { let dirs = [ - LogDirective { name: Some("crate2".to_strbuf()), level: 3 }, - LogDirective { name: Some("crate1::mod1".to_strbuf()), level: 2 } + LogDirective { name: Some("crate2".to_string()), level: 3 }, + LogDirective { name: Some("crate1::mod1".to_string()), level: 2 } ]; assert!(enabled(3, "crate2::mod1", dirs.iter())); } @@ -401,9 +401,9 @@ mod tests { #[test] fn match_beginning_longest_match() { let dirs = [ - LogDirective { name: Some("crate2".to_strbuf()), level: 3 }, - LogDirective { name: Some("crate2::mod".to_strbuf()), level: 4 }, - LogDirective { name: Some("crate1::mod1".to_strbuf()), level: 2 } + LogDirective { name: Some("crate2".to_string()), level: 3 }, + LogDirective { name: Some("crate2::mod".to_string()), level: 4 }, + LogDirective { name: Some("crate1::mod1".to_string()), level: 2 } ]; assert!(enabled(4, "crate2::mod1", dirs.iter())); assert!(!enabled(4, "crate2", dirs.iter())); @@ -413,7 +413,7 @@ mod tests { fn match_default() { let dirs = [ LogDirective { name: None, level: 3 }, - LogDirective { name: Some("crate1::mod1".to_strbuf()), level: 2 } + LogDirective { name: Some("crate1::mod1".to_string()), level: 2 } ]; assert!(enabled(2, "crate1::mod1", dirs.iter())); assert!(enabled(3, "crate2::mod2", dirs.iter())); @@ -423,7 +423,7 @@ mod tests { fn zero_level() { let dirs = [ LogDirective { name: None, level: 3 }, - LogDirective { name: Some("crate1::mod1".to_strbuf()), level: 0 } + LogDirective { name: Some("crate1::mod1".to_string()), level: 0 } ]; assert!(!enabled(1, "crate1::mod1", dirs.iter())); assert!(enabled(3, "crate2::mod2", dirs.iter())); diff --git a/src/libnative/io/addrinfo.rs b/src/libnative/io/addrinfo.rs index 64b082d9f3f58..6bc41a9c4c5b2 100644 --- a/src/libnative/io/addrinfo.rs +++ b/src/libnative/io/addrinfo.rs @@ -106,7 +106,7 @@ fn get_error(s: c_int) -> IoError { use std::io; let err_str = unsafe { - CString::new(gai_strerror(s), false).as_str().unwrap().to_strbuf() + CString::new(gai_strerror(s), false).as_str().unwrap().to_string() }; IoError { kind: io::OtherIoError, diff --git a/src/libnum/bigint.rs b/src/libnum/bigint.rs index 88a4807184c85..e8d0434c39285 100644 --- a/src/libnum/bigint.rs +++ b/src/libnum/bigint.rs @@ -629,7 +629,7 @@ impl ToStrRadix for BigUint { fn fill_concat(v: &[BigDigit], radix: uint, l: uint) -> String { if v.is_empty() { - return "0".to_strbuf() + return "0".to_string() } let mut s = String::with_capacity(v.len() * l); for n in v.iter().rev() { @@ -637,7 +637,7 @@ impl ToStrRadix for BigUint { s.push_str("0".repeat(l - ss.len()).as_slice()); s.push_str(ss.as_slice()); } - s.as_slice().trim_left_chars('0').to_strbuf() + s.as_slice().trim_left_chars('0').to_string() } } } @@ -1214,7 +1214,7 @@ impl ToStrRadix for BigInt { fn to_str_radix(&self, radix: uint) -> String { match self.sign { Plus => self.data.to_str_radix(radix), - Zero => "0".to_strbuf(), + Zero => "0".to_string(), Minus => format_strbuf!("-{}", self.data.to_str_radix(radix)), } } @@ -2032,35 +2032,35 @@ mod biguint_tests { fn to_str_pairs() -> Vec<(BigUint, Vec<(uint, String)>)> { let bits = BigDigit::bits; vec!(( Zero::zero(), vec!( - (2, "0".to_strbuf()), (3, "0".to_strbuf()) + (2, "0".to_string()), (3, "0".to_string()) )), ( BigUint::from_slice([ 0xff ]), vec!( - (2, "11111111".to_strbuf()), - (3, "100110".to_strbuf()), - (4, "3333".to_strbuf()), - (5, "2010".to_strbuf()), - (6, "1103".to_strbuf()), - (7, "513".to_strbuf()), - (8, "377".to_strbuf()), - (9, "313".to_strbuf()), - (10, "255".to_strbuf()), - (11, "212".to_strbuf()), - (12, "193".to_strbuf()), - (13, "168".to_strbuf()), - (14, "143".to_strbuf()), - (15, "120".to_strbuf()), - (16, "ff".to_strbuf()) + (2, "11111111".to_string()), + (3, "100110".to_string()), + (4, "3333".to_string()), + (5, "2010".to_string()), + (6, "1103".to_string()), + (7, "513".to_string()), + (8, "377".to_string()), + (9, "313".to_string()), + (10, "255".to_string()), + (11, "212".to_string()), + (12, "193".to_string()), + (13, "168".to_string()), + (14, "143".to_string()), + (15, "120".to_string()), + (16, "ff".to_string()) )), ( BigUint::from_slice([ 0xfff ]), vec!( - (2, "111111111111".to_strbuf()), - (4, "333333".to_strbuf()), - (16, "fff".to_strbuf()) + (2, "111111111111".to_string()), + (4, "333333".to_string()), + (16, "fff".to_string()) )), ( BigUint::from_slice([ 1, 2 ]), vec!( (2, format_strbuf!("10{}1", "0".repeat(bits - 1))), (4, format_strbuf!("2{}1", "0".repeat(bits / 2 - 1))), (10, match bits { - 32 => "8589934593".to_strbuf(), - 16 => "131073".to_strbuf(), + 32 => "8589934593".to_string(), + 16 => "131073".to_string(), _ => fail!() }), (16, @@ -2075,8 +2075,8 @@ mod biguint_tests { "0".repeat(bits / 2 - 1), "0".repeat(bits / 2 - 1))), (10, match bits { - 32 => "55340232229718589441".to_strbuf(), - 16 => "12885032961".to_strbuf(), + 32 => "55340232229718589441".to_string(), + 16 => "12885032961".to_string(), _ => fail!() }), (16, diff --git a/src/libnum/complex.rs b/src/libnum/complex.rs index 5ba67f3fccf56..a4c2183921433 100644 --- a/src/libnum/complex.rs +++ b/src/libnum/complex.rs @@ -349,14 +349,14 @@ mod test { #[test] fn test_to_str() { fn test(c : Complex64, s: String) { - assert_eq!(c.to_str().to_strbuf(), s); + assert_eq!(c.to_str().to_string(), s); } - test(_0_0i, "0+0i".to_strbuf()); - test(_1_0i, "1+0i".to_strbuf()); - test(_0_1i, "0+1i".to_strbuf()); - test(_1_1i, "1+1i".to_strbuf()); - test(_neg1_1i, "-1+1i".to_strbuf()); - test(-_neg1_1i, "1-1i".to_strbuf()); - test(_05_05i, "0.5+0.5i".to_strbuf()); + test(_0_0i, "0+0i".to_string()); + test(_1_0i, "1+0i".to_string()); + test(_0_1i, "0+1i".to_string()); + test(_1_1i, "1+1i".to_string()); + test(_neg1_1i, "-1+1i".to_string()); + test(-_neg1_1i, "1-1i".to_string()); + test(_05_05i, "0.5+0.5i".to_string()); } } diff --git a/src/libnum/rational.rs b/src/libnum/rational.rs index a51d1d1690587..e916265396e26 100644 --- a/src/libnum/rational.rs +++ b/src/libnum/rational.rs @@ -559,14 +559,14 @@ mod test { fn test_to_from_str() { fn test(r: Rational, s: String) { assert_eq!(FromStr::from_str(s.as_slice()), Some(r)); - assert_eq!(r.to_str().to_strbuf(), s); + assert_eq!(r.to_str().to_string(), s); } - test(_1, "1/1".to_strbuf()); - test(_0, "0/1".to_strbuf()); - test(_1_2, "1/2".to_strbuf()); - test(_3_2, "3/2".to_strbuf()); - test(_2, "2/1".to_strbuf()); - test(_neg1_2, "-1/2".to_strbuf()); + test(_1, "1/1".to_string()); + test(_0, "0/1".to_string()); + test(_1_2, "1/2".to_string()); + test(_3_2, "3/2".to_string()); + test(_2, "2/1".to_string()); + test(_neg1_2, "-1/2".to_string()); } #[test] fn test_from_str_fail() { @@ -586,28 +586,28 @@ mod test { fn test(r: Rational, s: String, n: uint) { assert_eq!(FromStrRadix::from_str_radix(s.as_slice(), n), Some(r)); - assert_eq!(r.to_str_radix(n).to_strbuf(), s); + assert_eq!(r.to_str_radix(n).to_string(), s); } fn test3(r: Rational, s: String) { test(r, s, 3) } fn test16(r: Rational, s: String) { test(r, s, 16) } - test3(_1, "1/1".to_strbuf()); - test3(_0, "0/1".to_strbuf()); - test3(_1_2, "1/2".to_strbuf()); - test3(_3_2, "10/2".to_strbuf()); - test3(_2, "2/1".to_strbuf()); - test3(_neg1_2, "-1/2".to_strbuf()); - test3(_neg1_2 / _2, "-1/11".to_strbuf()); - - test16(_1, "1/1".to_strbuf()); - test16(_0, "0/1".to_strbuf()); - test16(_1_2, "1/2".to_strbuf()); - test16(_3_2, "3/2".to_strbuf()); - test16(_2, "2/1".to_strbuf()); - test16(_neg1_2, "-1/2".to_strbuf()); - test16(_neg1_2 / _2, "-1/4".to_strbuf()); - test16(Ratio::new(13,15), "d/f".to_strbuf()); - test16(_1_2*_1_2*_1_2*_1_2, "1/10".to_strbuf()); + test3(_1, "1/1".to_string()); + test3(_0, "0/1".to_string()); + test3(_1_2, "1/2".to_string()); + test3(_3_2, "10/2".to_string()); + test3(_2, "2/1".to_string()); + test3(_neg1_2, "-1/2".to_string()); + test3(_neg1_2 / _2, "-1/11".to_string()); + + test16(_1, "1/1".to_string()); + test16(_0, "0/1".to_string()); + test16(_1_2, "1/2".to_string()); + test16(_3_2, "3/2".to_string()); + test16(_2, "2/1".to_string()); + test16(_neg1_2, "-1/2".to_string()); + test16(_neg1_2 / _2, "-1/4".to_string()); + test16(Ratio::new(13,15), "d/f".to_string()); + test16(_1_2*_1_2*_1_2*_1_2, "1/10".to_string()); } #[test] diff --git a/src/libregex/parse/mod.rs b/src/libregex/parse/mod.rs index bc365582ca444..87b6e2b110441 100644 --- a/src/libregex/parse/mod.rs +++ b/src/libregex/parse/mod.rs @@ -222,7 +222,7 @@ impl<'a> Parser<'a> { self.caps += 1; self.stack.push(Paren(self.flags, self.caps, - "".to_strbuf())) + "".to_string())) } } ')' => { @@ -796,7 +796,7 @@ impl<'a> Parser<'a> { } if self.cur() == ':' { // Save the old flags with the opening paren. - self.stack.push(Paren(self.flags, 0, "".to_strbuf())); + self.stack.push(Paren(self.flags, 0, "".to_string())); } self.flags = flags; return Ok(()) @@ -922,7 +922,7 @@ impl<'a> Parser<'a> { fn err(&self, msg: &str) -> Result { Err(Error { pos: self.chari, - msg: msg.to_strbuf(), + msg: msg.to_string(), }) } @@ -942,7 +942,7 @@ impl<'a> Parser<'a> { } fn slice(&self, start: uint, end: uint) -> String { - str::from_chars(self.chars.as_slice().slice(start, end)).to_strbuf() + str::from_chars(self.chars.as_slice().slice(start, end)).to_string() } } diff --git a/src/libregex/re.rs b/src/libregex/re.rs index 91b24888c24fa..5958089a8a47d 100644 --- a/src/libregex/re.rs +++ b/src/libregex/re.rs @@ -154,7 +154,7 @@ impl Regex { let ast = try!(parse::parse(re)); let (prog, names) = Program::new(ast); Ok(Dynamic(Dynamic { - original: re.to_strbuf(), + original: re.to_string(), names: names, prog: prog, })) @@ -539,8 +539,8 @@ enum NamesIter<'a> { impl<'a> Iterator> for NamesIter<'a> { fn next(&mut self) -> Option> { match *self { - NamesIterNative(ref mut i) => i.next().map(|x| x.map(|s| s.to_strbuf())), - NamesIterDynamic(ref mut i) => i.next().map(|x| x.as_ref().map(|s| s.to_strbuf())), + NamesIterNative(ref mut i) => i.next().map(|x| x.map(|s| s.to_string())), + NamesIterDynamic(ref mut i) => i.next().map(|x| x.as_ref().map(|s| s.to_string())), } } } @@ -764,8 +764,8 @@ impl<'t> Captures<'t> { format_strbuf!("{}{}", pre, match from_str::(name.as_slice()) { - None => self.name(name).to_strbuf(), - Some(i) => self.at(i).to_strbuf(), + None => self.name(name).to_string(), + Some(i) => self.at(i).to_string(), }) }); let re = Regex::new(r"\$\$").unwrap(); diff --git a/src/libregex/test/bench.rs b/src/libregex/test/bench.rs index 5bbb37c2490ff..8dc6484a13629 100644 --- a/src/libregex/test/bench.rs +++ b/src/libregex/test/bench.rs @@ -161,7 +161,7 @@ fn gen_text(n: uint) -> String { *b = '\n' as u8 } } - str::from_utf8(bytes.as_slice()).unwrap().to_strbuf() + str::from_utf8(bytes.as_slice()).unwrap().to_string() } throughput!(easy0_32, easy0(), 32) diff --git a/src/libregex_macros/lib.rs b/src/libregex_macros/lib.rs index 971b727a165a3..71e3d06cf967c 100644 --- a/src/libregex_macros/lib.rs +++ b/src/libregex_macros/lib.rs @@ -97,7 +97,7 @@ fn native(cx: &mut ExtCtxt, sp: codemap::Span, tts: &[ast::TokenTree]) let mut gen = NfaGen { cx: &*cx, sp: sp, prog: prog, - names: re.names_iter().collect(), original: re.as_str().to_strbuf(), + names: re.names_iter().collect(), original: re.as_str().to_string(), }; MacExpr::new(gen.code()) } @@ -611,7 +611,7 @@ fn parse(cx: &mut ExtCtxt, tts: &[ast::TokenTree]) -> Option { let regex = match entry.node { ast::ExprLit(lit) => { match lit.node { - ast::LitStr(ref s, _) => s.to_str().to_strbuf(), + ast::LitStr(ref s, _) => s.to_str().to_string(), _ => { cx.span_err(entry.span, format!( "expected string literal but got `{}`", diff --git a/src/librustc/back/archive.rs b/src/librustc/back/archive.rs index d7875d47c6ac4..82cda6f13f108 100644 --- a/src/librustc/back/archive.rs +++ b/src/librustc/back/archive.rs @@ -139,7 +139,7 @@ impl<'a> Archive<'a> { let output = str::from_utf8(output.output.as_slice()).unwrap(); // use lines_any because windows delimits output with `\r\n` instead of // just `\n` - output.lines_any().map(|s| s.to_strbuf()).collect() + output.lines_any().map(|s| s.to_string()).collect() } fn add_archive(&mut self, archive: &Path, name: &str, diff --git a/src/librustc/back/arm.rs b/src/librustc/back/arm.rs index fcce2fe25035a..e5e8126ace184 100644 --- a/src/librustc/back/arm.rs +++ b/src/librustc/back/arm.rs @@ -15,15 +15,15 @@ use syntax::abi; pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs::t { let cc_args = if target_triple.as_slice().contains("thumb") { - vec!("-mthumb".to_strbuf()) + vec!("-mthumb".to_string()) } else { - vec!("-marm".to_strbuf()) + vec!("-marm".to_string()) }; return target_strs::t { - module_asm: "".to_strbuf(), + module_asm: "".to_string(), meta_sect_name: - meta_section_name(cfg_os_to_meta_os(target_os)).to_strbuf(), + meta_section_name(cfg_os_to_meta_os(target_os)).to_string(), data_layout: match target_os { abi::OsMacos => { @@ -31,7 +31,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a0:0:64-n32".to_strbuf() + -a0:0:64-n32".to_string() } abi::OsWin32 => { @@ -39,7 +39,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a0:0:64-n32".to_strbuf() + -a0:0:64-n32".to_string() } abi::OsLinux => { @@ -47,7 +47,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a0:0:64-n32".to_strbuf() + -a0:0:64-n32".to_string() } abi::OsAndroid => { @@ -55,7 +55,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a0:0:64-n32".to_strbuf() + -a0:0:64-n32".to_string() } abi::OsFreebsd => { @@ -63,7 +63,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a0:0:64-n32".to_strbuf() + -a0:0:64-n32".to_string() } }, diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs index 0b1efd3cfbb78..2baf8c2469728 100644 --- a/src/librustc/back/link.rs +++ b/src/librustc/back/link.rs @@ -81,7 +81,7 @@ pub fn WriteOutputFile( let result = llvm::LLVMRustWriteOutputFile( target, pm, m, output, file_type); if !result { - llvm_err(sess, "could not write output".to_strbuf()); + llvm_err(sess, "could not write output".to_string()); } }) } @@ -554,7 +554,7 @@ pub fn crate_id_hash(crate_id: &CrateId) -> String { // not by path. let mut s = Sha256::new(); s.input_str(crate_id.short_name_with_version().as_slice()); - truncated_hash_result(&mut s).as_slice().slice_to(8).to_strbuf() + truncated_hash_result(&mut s).as_slice().slice_to(8).to_string() } // FIXME (#9639): This needs to handle non-utf8 `out_filestem` values @@ -570,7 +570,7 @@ pub fn build_link_meta(krate: &ast::Crate, out_filestem: &str) -> LinkMeta { fn truncated_hash_result(symbol_hasher: &mut Sha256) -> String { let output = symbol_hasher.result_bytes(); // 64 bits should be enough to avoid collisions. - output.slice_to(8).to_hex().to_strbuf() + output.slice_to(8).to_hex().to_string() } @@ -597,7 +597,7 @@ fn symbol_hash(tcx: &ty::ctxt, fn get_symbol_hash(ccx: &CrateContext, t: ty::t) -> String { match ccx.type_hashcodes.borrow().find(&t) { - Some(h) => return h.to_strbuf(), + Some(h) => return h.to_string(), None => {} } @@ -649,7 +649,7 @@ pub fn sanitize(s: &str) -> String { if result.len() > 0u && result.as_slice()[0] != '_' as u8 && ! char::is_XID_start(result.as_slice()[0] as char) { - return format!("_{}", result.as_slice()).to_strbuf(); + return format!("_{}", result.as_slice()).to_string(); } return result; @@ -759,7 +759,7 @@ pub fn output_lib_filename(id: &CrateId) -> String { pub fn get_cc_prog(sess: &Session) -> String { match sess.opts.cg.linker { - Some(ref linker) => return linker.to_strbuf(), + Some(ref linker) => return linker.to_string(), None => {} } @@ -770,13 +770,13 @@ pub fn get_cc_prog(sess: &Session) -> String { match sess.targ_cfg.os { abi::OsWin32 => "gcc", _ => "cc", - }.to_strbuf() + }.to_string() } pub fn get_ar_prog(sess: &Session) -> String { match sess.opts.cg.ar { Some(ref ar) => (*ar).clone(), - None => "ar".to_strbuf() + None => "ar".to_string() } } diff --git a/src/librustc/back/mips.rs b/src/librustc/back/mips.rs index 3b9ec546a10a1..9f640a2c9cbe0 100644 --- a/src/librustc/back/mips.rs +++ b/src/librustc/back/mips.rs @@ -15,10 +15,10 @@ use syntax::abi; pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs::t { return target_strs::t { - module_asm: "".to_strbuf(), + module_asm: "".to_string(), meta_sect_name: - meta_section_name(cfg_os_to_meta_os(target_os)).to_strbuf(), + meta_section_name(cfg_os_to_meta_os(target_os)).to_string(), data_layout: match target_os { abi::OsMacos => { @@ -26,7 +26,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a0:0:64-n32".to_strbuf() + -a0:0:64-n32".to_string() } abi::OsWin32 => { @@ -34,7 +34,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a0:0:64-n32".to_strbuf() + -a0:0:64-n32".to_string() } abi::OsLinux => { @@ -42,7 +42,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a0:0:64-n32".to_strbuf() + -a0:0:64-n32".to_string() } abi::OsAndroid => { @@ -50,7 +50,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a0:0:64-n32".to_strbuf() + -a0:0:64-n32".to_string() } abi::OsFreebsd => { @@ -58,7 +58,7 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\ -f32:32:32-f64:64:64\ -v64:64:64-v128:64:128\ - -a0:0:64-n32".to_strbuf() + -a0:0:64-n32".to_string() } }, diff --git a/src/librustc/back/rpath.rs b/src/librustc/back/rpath.rs index f99515603b232..3cee832227817 100644 --- a/src/librustc/back/rpath.rs +++ b/src/librustc/back/rpath.rs @@ -33,9 +33,9 @@ pub fn get_rpath_flags(sess: &Session, out_filename: &Path) -> Vec { let mut flags = Vec::new(); if sess.targ_cfg.os == abi::OsFreebsd { - flags.push_all(["-Wl,-rpath,/usr/local/lib/gcc46".to_strbuf(), - "-Wl,-rpath,/usr/local/lib/gcc44".to_strbuf(), - "-Wl,-z,origin".to_strbuf()]); + flags.push_all(["-Wl,-rpath,/usr/local/lib/gcc46".to_string(), + "-Wl,-rpath,/usr/local/lib/gcc44".to_string(), + "-Wl,-z,origin".to_string()]); } debug!("preparing the RPATH!"); @@ -145,7 +145,7 @@ pub fn get_install_prefix_rpath(sysroot: &Path, target_triple: &str) -> String { path.push(&tlib); let path = os::make_absolute(&path); // FIXME (#9639): This needs to handle non-utf8 paths - path.as_str().expect("non-utf8 component in rpath").to_strbuf() + path.as_str().expect("non-utf8 component in rpath").to_string() } pub fn minimize_rpaths(rpaths: &[String]) -> Vec { @@ -169,12 +169,12 @@ mod test { #[test] fn test_rpaths_to_flags() { let flags = rpaths_to_flags([ - "path1".to_strbuf(), - "path2".to_strbuf() + "path1".to_string(), + "path2".to_string() ]); assert_eq!(flags, - vec!("-Wl,-rpath,path1".to_strbuf(), - "-Wl,-rpath,path2".to_strbuf())); + vec!("-Wl,-rpath,path1".to_string(), + "-Wl,-rpath,path2".to_string())); } #[test] @@ -201,35 +201,35 @@ mod test { #[test] fn test_minimize1() { let res = minimize_rpaths([ - "rpath1".to_strbuf(), - "rpath2".to_strbuf(), - "rpath1".to_strbuf() + "rpath1".to_string(), + "rpath2".to_string(), + "rpath1".to_string() ]); assert!(res.as_slice() == [ - "rpath1".to_strbuf(), - "rpath2".to_strbuf() + "rpath1".to_string(), + "rpath2".to_string() ]); } #[test] fn test_minimize2() { let res = minimize_rpaths([ - "1a".to_strbuf(), - "2".to_strbuf(), - "2".to_strbuf(), - "1a".to_strbuf(), - "4a".to_strbuf(), - "1a".to_strbuf(), - "2".to_strbuf(), - "3".to_strbuf(), - "4a".to_strbuf(), - "3".to_strbuf() + "1a".to_string(), + "2".to_string(), + "2".to_string(), + "1a".to_string(), + "4a".to_string(), + "1a".to_string(), + "2".to_string(), + "3".to_string(), + "4a".to_string(), + "3".to_string() ]); assert!(res.as_slice() == [ - "1a".to_strbuf(), - "2".to_strbuf(), - "4a".to_strbuf(), - "3".to_strbuf() + "1a".to_string(), + "2".to_string(), + "4a".to_string(), + "3".to_string() ]); } diff --git a/src/librustc/back/svh.rs b/src/librustc/back/svh.rs index 00dbb3da39a90..9fd829ab901f6 100644 --- a/src/librustc/back/svh.rs +++ b/src/librustc/back/svh.rs @@ -61,7 +61,7 @@ pub struct Svh { impl Svh { pub fn new(hash: &str) -> Svh { assert!(hash.len() == 16); - Svh { hash: hash.to_strbuf() } + Svh { hash: hash.to_string() } } pub fn as_str<'a>(&'a self) -> &'a str { diff --git a/src/librustc/back/x86.rs b/src/librustc/back/x86.rs index c9c007185b8b2..3ef013d47c91d 100644 --- a/src/librustc/back/x86.rs +++ b/src/librustc/back/x86.rs @@ -17,10 +17,10 @@ use syntax::abi; pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs::t { return target_strs::t { - module_asm: "".to_strbuf(), + module_asm: "".to_string(), meta_sect_name: - meta_section_name(cfg_os_to_meta_os(target_os)).to_strbuf(), + meta_section_name(cfg_os_to_meta_os(target_os)).to_string(), data_layout: match target_os { abi::OsMacos => { @@ -28,27 +28,27 @@ pub fn get_target_strs(target_triple: String, target_os: abi::Os) -i32:32:32-i64:32:64\ -f32:32:32-f64:32:64-v64:64:64\ -v128:128:128-a0:0:64-f80:128:128\ - -n8:16:32".to_strbuf() + -n8:16:32".to_string() } abi::OsWin32 => { - "e-p:32:32-f64:64:64-i64:64:64-f80:32:32-n8:16:32".to_strbuf() + "e-p:32:32-f64:64:64-i64:64:64-f80:32:32-n8:16:32".to_string() } abi::OsLinux => { - "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_strbuf() + "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string() } abi::OsAndroid => { - "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_strbuf() + "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string() } abi::OsFreebsd => { - "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_strbuf() + "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string() } }, target_triple: target_triple, - cc_args: vec!("-m32".to_strbuf()), + cc_args: vec!("-m32".to_string()), }; } diff --git a/src/librustc/back/x86_64.rs b/src/librustc/back/x86_64.rs index bd8d7f13e4efb..80dd2b2c51629 100644 --- a/src/librustc/back/x86_64.rs +++ b/src/librustc/back/x86_64.rs @@ -16,45 +16,45 @@ use syntax::abi; pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs::t { return target_strs::t { - module_asm: "".to_strbuf(), + module_asm: "".to_string(), meta_sect_name: - meta_section_name(cfg_os_to_meta_os(target_os)).to_strbuf(), + meta_section_name(cfg_os_to_meta_os(target_os)).to_string(), data_layout: match target_os { abi::OsMacos => { "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\ f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-\ - s0:64:64-f80:128:128-n8:16:32:64".to_strbuf() + s0:64:64-f80:128:128-n8:16:32:64".to_string() } abi::OsWin32 => { // FIXME: Test this. Copied from linux (#2398) "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\ f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-\ - s0:64:64-f80:128:128-n8:16:32:64-S128".to_strbuf() + s0:64:64-f80:128:128-n8:16:32:64-S128".to_string() } abi::OsLinux => { "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\ f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-\ - s0:64:64-f80:128:128-n8:16:32:64-S128".to_strbuf() + s0:64:64-f80:128:128-n8:16:32:64-S128".to_string() } abi::OsAndroid => { "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\ f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-\ - s0:64:64-f80:128:128-n8:16:32:64-S128".to_strbuf() + s0:64:64-f80:128:128-n8:16:32:64-S128".to_string() } abi::OsFreebsd => { "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\ f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-\ - s0:64:64-f80:128:128-n8:16:32:64-S128".to_strbuf() + s0:64:64-f80:128:128-n8:16:32:64-S128".to_string() } }, target_triple: target_triple, - cc_args: vec!("-m64".to_strbuf()), + cc_args: vec!("-m64".to_string()), }; } diff --git a/src/librustc/driver/config.rs b/src/librustc/driver/config.rs index df79e71436c7f..16965bfa67fa8 100644 --- a/src/librustc/driver/config.rs +++ b/src/librustc/driver/config.rs @@ -107,7 +107,7 @@ pub fn basic_options() -> Options { output_types: Vec::new(), addl_lib_search_paths: RefCell::new(HashSet::new()), maybe_sysroot: None, - target_triple: driver::host_triple().to_strbuf(), + target_triple: driver::host_triple().to_string(), cfg: Vec::new(), test: false, parse_only: false, @@ -252,14 +252,14 @@ macro_rules! cgoptions( fn parse_opt_string(slot: &mut Option, v: Option<&str>) -> bool { match v { - Some(s) => { *slot = Some(s.to_strbuf()); true }, + Some(s) => { *slot = Some(s.to_string()); true }, None => false, } } fn parse_string(slot: &mut String, v: Option<&str>) -> bool { match v { - Some(s) => { *slot = s.to_strbuf(); true }, + Some(s) => { *slot = s.to_string(); true }, None => false, } } @@ -269,7 +269,7 @@ macro_rules! cgoptions( match v { Some(s) => { for s in s.words() { - slot.push(s.to_strbuf()); + slot.push(s.to_string()); } true }, @@ -287,9 +287,9 @@ cgoptions!( "system linker to link outputs with"), link_args: Vec = (Vec::new(), parse_list, "extra arguments to pass to the linker (space separated)"), - target_cpu: String = ("generic".to_strbuf(), parse_string, + target_cpu: String = ("generic".to_string(), parse_string, "select target processor (llc -mcpu=help for details)"), - target_feature: String = ("".to_strbuf(), parse_string, + target_feature: String = ("".to_string(), parse_string, "target specific attributes (llc -mattr=help for details)"), passes: Vec = (Vec::new(), parse_list, "a list of extra LLVM passes to run (space separated)"), @@ -311,7 +311,7 @@ cgoptions!( "prefer dynamic linking to static linking"), no_integrated_as: bool = (false, parse_bool, "use an external assembler rather than LLVM's integrated one"), - relocation_model: String = ("pic".to_strbuf(), parse_string, + relocation_model: String = ("pic".to_string(), parse_string, "choose the relocation model to use (llc -relocation-model for details)"), ) @@ -557,8 +557,8 @@ pub fn optgroups() -> Vec { // Convert strings provided as --cfg [cfgspec] into a crate_cfg fn parse_cfgspecs(cfgspecs: Vec ) -> ast::CrateConfig { cfgspecs.move_iter().map(|s| { - parse::parse_meta_from_source_str("cfgspec".to_strbuf(), - s.to_strbuf(), + parse::parse_meta_from_source_str("cfgspec".to_string(), + s.to_string(), Vec::new(), &parse::new_parse_sess()) }).collect::() @@ -602,7 +602,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options { .collect::>() .append(matches.opt_strs(level_name).as_slice()); for lint_name in flags.iter() { - let lint_name = lint_name.replace("-", "_").into_strbuf(); + let lint_name = lint_name.replace("-", "_").into_string(); match lint_dict.find_equiv(&lint_name) { None => { early_error(format!("unknown {} flag: {}", @@ -667,8 +667,8 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options { let sysroot_opt = matches.opt_str("sysroot").map(|m| Path::new(m)); let target = match matches.opt_str("target") { - Some(supplied_target) => supplied_target.to_strbuf(), - None => driver::host_triple().to_strbuf(), + Some(supplied_target) => supplied_target.to_string(), + None => driver::host_triple().to_string(), }; let opt_level = { if (debugging_opts & NO_OPT) != 0 { @@ -723,7 +723,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options { let cfg = parse_cfgspecs(matches.opt_strs("cfg") .move_iter() - .map(|x| x.to_strbuf()) + .map(|x| x.to_string()) .collect()); let test = matches.opt_present("test"); let write_dependency_info = (matches.opt_present("dep-info"), @@ -787,7 +787,7 @@ mod test { #[test] fn test_switch_implies_cfg_test() { let matches = - &match getopts(["--test".to_strbuf()], optgroups().as_slice()) { + &match getopts(["--test".to_string()], optgroups().as_slice()) { Ok(m) => m, Err(f) => fail!("test_switch_implies_cfg_test: {}", f.to_err_msg()) }; @@ -802,7 +802,7 @@ mod test { #[test] fn test_switch_implies_cfg_test_unless_cfg_test() { let matches = - &match getopts(["--test".to_strbuf(), "--cfg=test".to_strbuf()], + &match getopts(["--test".to_string(), "--cfg=test".to_string()], optgroups().as_slice()) { Ok(m) => m, Err(f) => { diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs index 5f5b30c9c708a..bc0d8e2f75c15 100644 --- a/src/librustc/driver/driver.rs +++ b/src/librustc/driver/driver.rs @@ -106,13 +106,13 @@ pub fn compile_input(sess: Session, * (e.g. source from stdin or a string) */ pub fn anon_src() -> String { - "".to_strbuf() + "".to_string() } pub fn source_name(input: &Input) -> String { match *input { // FIXME (#9639): This needs to handle non-utf8 paths - FileInput(ref ifile) => ifile.as_str().unwrap().to_strbuf(), + FileInput(ref ifile) => ifile.as_str().unwrap().to_string(), StrInput(_) => anon_src() } } @@ -127,8 +127,8 @@ pub enum Input { impl Input { fn filestem(&self) -> String { match *self { - FileInput(ref ifile) => ifile.filestem_str().unwrap().to_strbuf(), - StrInput(_) => "rust_out".to_strbuf(), + FileInput(ref ifile) => ifile.filestem_str().unwrap().to_string(), + StrInput(_) => "rust_out".to_string(), } } } @@ -142,8 +142,8 @@ pub fn phase_1_parse_input(sess: &Session, cfg: ast::CrateConfig, input: &Input) parse::parse_crate_from_file(&(*file), cfg.clone(), &sess.parse_sess) } StrInput(ref src) => { - parse::parse_crate_from_source_str(anon_src().to_strbuf(), - src.to_strbuf(), + parse::parse_crate_from_source_str(anon_src().to_string(), + src.to_string(), cfg.clone(), &sess.parse_sess) } @@ -497,7 +497,7 @@ fn write_out_deps(sess: &Session, // write Makefile-compatible dependency rules let files: Vec = sess.codemap().files.borrow() .iter().filter(|fmap| fmap.is_real_file()) - .map(|fmap| fmap.name.to_strbuf()) + .map(|fmap| fmap.name.to_string()) .collect(); let mut file = try!(io::File::create(&deps_filename)); for path in out_filenames.iter() { @@ -533,20 +533,20 @@ impl pprust::PpAnn for IdentifiedAnnotation { match node { pprust::NodeItem(item) => { try!(pp::space(&mut s.s)); - s.synth_comment(item.id.to_str().to_strbuf()) + s.synth_comment(item.id.to_str().to_string()) } pprust::NodeBlock(blk) => { try!(pp::space(&mut s.s)); - s.synth_comment((format!("block {}", blk.id)).to_strbuf()) + s.synth_comment((format!("block {}", blk.id)).to_string()) } pprust::NodeExpr(expr) => { try!(pp::space(&mut s.s)); - try!(s.synth_comment(expr.id.to_str().to_strbuf())); + try!(s.synth_comment(expr.id.to_str().to_string())); s.pclose() } pprust::NodePat(pat) => { try!(pp::space(&mut s.s)); - s.synth_comment((format!("pat {}", pat.id)).to_strbuf()) + s.synth_comment((format!("pat {}", pat.id)).to_string()) } } } @@ -629,7 +629,7 @@ pub fn pretty_print_input(sess: Session, pprust::print_crate(sess.codemap(), sess.diagnostic(), &krate, - src_name.to_strbuf(), + src_name.to_string(), &mut rdr, out, &IdentifiedAnnotation, @@ -644,7 +644,7 @@ pub fn pretty_print_input(sess: Session, pprust::print_crate(annotation.analysis.ty_cx.sess.codemap(), annotation.analysis.ty_cx.sess.diagnostic(), &krate, - src_name.to_strbuf(), + src_name.to_string(), &mut rdr, out, &annotation, @@ -677,7 +677,7 @@ pub fn pretty_print_input(sess: Session, pprust::print_crate(sess.codemap(), sess.diagnostic(), &krate, - src_name.to_strbuf(), + src_name.to_string(), &mut rdr, out, &pprust::NoAnn, @@ -694,7 +694,7 @@ fn print_flowgraph(analysis: CrateAnalysis, let cfg = cfg::CFG::new(ty_cx, block); let lcfg = LabelledCFG { ast_map: &ty_cx.map, cfg: &cfg, - name: format!("block{}", block.id).to_strbuf(), }; + name: format!("block{}", block.id).to_string(), }; debug!("cfg: {:?}", cfg); let r = dot::render(&lcfg, &mut out); return expand_err_details(r); @@ -705,7 +705,7 @@ fn print_flowgraph(analysis: CrateAnalysis, let m = "graphviz::render failed"; io::IoError { detail: Some(match orig_detail { - None => m.into_strbuf(), + None => m.into_string(), Some(d) => format_strbuf!("{}: {}", m, d) }), ..ioerr @@ -738,7 +738,7 @@ pub fn collect_crate_types(session: &Session, ast::CRATE_NODE_ID, a.span, "invalid `crate_type` \ - value".to_strbuf()); + value".to_string()); None } _ => { @@ -746,7 +746,7 @@ pub fn collect_crate_types(session: &Session, ast::CRATE_NODE_ID, a.span, "`crate_type` requires a \ - value".to_strbuf()); + value".to_string()); None } } @@ -832,7 +832,7 @@ pub fn build_output_filenames(input: &Input, let crateid = attr::find_crateid(attrs); match crateid { None => {} - Some(crateid) => stem = crateid.name.to_strbuf(), + Some(crateid) => stem = crateid.name.to_string(), } OutputFilenames { out_directory: dirpath, @@ -854,7 +854,7 @@ pub fn build_output_filenames(input: &Input, } OutputFilenames { out_directory: out_file.dir_path(), - out_filestem: out_file.filestem_str().unwrap().to_strbuf(), + out_filestem: out_file.filestem_str().unwrap().to_string(), single_output_file: ofile, } } diff --git a/src/librustc/driver/mod.rs b/src/librustc/driver/mod.rs index 998a88bcea9e5..04bc46e5dfc0d 100644 --- a/src/librustc/driver/mod.rs +++ b/src/librustc/driver/mod.rs @@ -57,7 +57,7 @@ fn run_compiler(args: &[String]) { if ifile == "-" { let contents = io::stdin().read_to_end().unwrap(); let src = str::from_utf8(contents.as_slice()).unwrap() - .to_strbuf(); + .to_string(); (StrInput(src), None) } else { (FileInput(Path::new(ifile)), Some(Path::new(ifile))) @@ -84,7 +84,7 @@ fn run_compiler(args: &[String]) { } let r = matches.opt_strs("Z"); - if r.contains(&("ls".to_strbuf())) { + if r.contains(&("ls".to_string())) { match input { FileInput(ref ifile) => { let mut stdout = io::stdout(); @@ -233,7 +233,7 @@ pub fn handle_options(mut args: Vec) -> Option { return None; } - if cg_flags.contains(&"passes=list".to_strbuf()) { + if cg_flags.contains(&"passes=list".to_string()) { unsafe { ::lib::llvm::llvm::LLVMRustPrintPasses(); } return None; } @@ -332,8 +332,8 @@ fn parse_crate_attrs(sess: &Session, input: &Input) -> } StrInput(ref src) => { parse::parse_crate_attrs_from_source_str( - driver::anon_src().to_strbuf(), - src.to_strbuf(), + driver::anon_src().to_string(), + src.to_string(), Vec::new(), &sess.parse_sess) } diff --git a/src/librustc/front/feature_gate.rs b/src/librustc/front/feature_gate.rs index 4f9957ee98029..25f0dc808c849 100644 --- a/src/librustc/front/feature_gate.rs +++ b/src/librustc/front/feature_gate.rs @@ -361,7 +361,7 @@ pub fn check_crate(sess: &Session, krate: &ast::Crate) { sess.add_lint(lint::UnknownFeatures, ast::CRATE_NODE_ID, mi.span, - "unknown feature".to_strbuf()); + "unknown feature".to_string()); } } } diff --git a/src/librustc/front/test.rs b/src/librustc/front/test.rs index 6794442380855..b21f3c2a01932 100644 --- a/src/librustc/front/test.rs +++ b/src/librustc/front/test.rs @@ -168,7 +168,7 @@ fn generate_test_harness(sess: &Session, krate: ast::Crate) cx.ext_cx.bt_push(ExpnInfo { call_site: DUMMY_SP, callee: NameAndSpan { - name: "test".to_strbuf(), + name: "test".to_string(), format: MacroAttribute, span: None } diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index 350dec7676801..2459c1d53c0c4 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -123,7 +123,7 @@ pub mod lib { pub fn main() { let args = std::os::args().iter() - .map(|x| x.to_strbuf()) + .map(|x| x.to_string()) .collect::>(); std::os::set_exit_status(driver::main_args(args.as_slice())); } diff --git a/src/librustc/lib/llvm.rs b/src/librustc/lib/llvm.rs index bc403d5a76c1d..781720277a980 100644 --- a/src/librustc/lib/llvm.rs +++ b/src/librustc/lib/llvm.rs @@ -1873,7 +1873,7 @@ impl TypeNames { } pub fn associate_type(&self, s: &str, t: &Type) { - assert!(self.named_types.borrow_mut().insert(s.to_strbuf(), + assert!(self.named_types.borrow_mut().insert(s.to_string(), t.to_ref())); } @@ -1886,13 +1886,13 @@ impl TypeNames { let s = llvm::LLVMTypeToString(ty.to_ref()); let ret = from_c_str(s); free(s as *mut c_void); - ret.to_strbuf() + ret.to_string() } } pub fn types_to_str(&self, tys: &[Type]) -> String { let strs: Vec = tys.iter().map(|t| self.type_to_str(*t)).collect(); - format_strbuf!("[{}]", strs.connect(",").to_strbuf()) + format_strbuf!("[{}]", strs.connect(",").to_string()) } pub fn val_to_str(&self, val: ValueRef) -> String { @@ -1900,7 +1900,7 @@ impl TypeNames { let s = llvm::LLVMValueToString(val); let ret = from_c_str(s); free(s as *mut c_void); - ret.to_strbuf() + ret.to_string() } } } diff --git a/src/librustc/metadata/creader.rs b/src/librustc/metadata/creader.rs index 1b4e52f542c42..e613fa7eb76c8 100644 --- a/src/librustc/metadata/creader.rs +++ b/src/librustc/metadata/creader.rs @@ -165,7 +165,7 @@ fn extract_crate_info(e: &Env, i: &ast::ViewItem) -> Option { None => from_str(ident.get().to_str().as_slice()).unwrap() }; Some(CrateInfo { - ident: ident.get().to_strbuf(), + ident: ident.get().to_string(), crate_id: crate_id, id: id, should_link: should_link(i), @@ -251,7 +251,7 @@ fn visit_item(e: &Env, i: &ast::Item) { } else { e.sess .cstore - .add_used_library(n.get().to_strbuf(), kind); + .add_used_library(n.get().to_string(), kind); } } None => {} @@ -293,7 +293,7 @@ fn register_crate<'a>(e: &mut Env, // Stash paths for top-most crate locally if necessary. let crate_paths = if root.is_none() { Some(CratePaths { - ident: ident.to_strbuf(), + ident: ident.to_string(), dylib: lib.dylib.clone(), rlib: lib.rlib.clone(), }) @@ -308,7 +308,7 @@ fn register_crate<'a>(e: &mut Env, let loader::Library{ dylib, rlib, metadata } = lib; let cmeta = Rc::new( cstore::crate_metadata { - name: crate_id.name.to_strbuf(), + name: crate_id.name.to_string(), data: metadata, cnum_map: cnum_map, cnum: cnum, @@ -442,11 +442,11 @@ impl<'a> CrateLoader for Loader<'a> { }; let macros = decoder::get_exported_macros(library.metadata.as_slice()); let registrar = decoder::get_macro_registrar_fn(library.metadata.as_slice()).map(|id| { - decoder::get_symbol(library.metadata.as_slice(), id).to_strbuf() + decoder::get_symbol(library.metadata.as_slice(), id).to_string() }); let mc = MacroCrate { lib: library.dylib.clone(), - macros: macros.move_iter().map(|x| x.to_strbuf()).collect(), + macros: macros.move_iter().map(|x| x.to_string()).collect(), registrar_symbol: registrar, }; if should_link { diff --git a/src/librustc/metadata/csearch.rs b/src/librustc/metadata/csearch.rs index d407cc046807b..781222a3a6e89 100644 --- a/src/librustc/metadata/csearch.rs +++ b/src/librustc/metadata/csearch.rs @@ -211,14 +211,14 @@ pub fn get_field_type(tcx: &ty::ctxt, class_id: ast::DefId, decoder::maybe_find_item(class_id.node, all_items), || { (format!("get_field_type: class ID {:?} not found", - class_id)).to_strbuf() + class_id)).to_string() }); let the_field = expect(tcx.sess.diagnostic(), decoder::maybe_find_item(def.node, class_doc), || { (format!("get_field_type: in class {:?}, field ID {:?} not found", class_id, - def)).to_strbuf() + def)).to_string() }); let ty = decoder::item_type(def, the_field, tcx, &*cdata); ty::ty_param_bounds_and_ty { diff --git a/src/librustc/metadata/cstore.rs b/src/librustc/metadata/cstore.rs index 467bafeb2ecc6..eb1beda898fd5 100644 --- a/src/librustc/metadata/cstore.rs +++ b/src/librustc/metadata/cstore.rs @@ -201,7 +201,7 @@ impl CStore { pub fn add_used_link_args(&self, args: &str) { for s in args.split(' ') { - self.used_link_args.borrow_mut().push(s.to_strbuf()); + self.used_link_args.borrow_mut().push(s.to_string()); } } diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index e8be05feae806..ddd493b2c1354 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -186,7 +186,7 @@ fn item_method_sort(item: ebml::Doc) -> char { } fn item_symbol(item: ebml::Doc) -> String { - reader::get_doc(item, tag_items_data_item_symbol).as_str().to_strbuf() + reader::get_doc(item, tag_items_data_item_symbol).as_str().to_string() } fn item_parent_item(d: ebml::Doc) -> Option { @@ -1095,7 +1095,7 @@ pub fn get_crate_deps(data: &[u8]) -> Vec { let mut crate_num = 1; fn docstr(doc: ebml::Doc, tag_: uint) -> String { let d = reader::get_doc(doc, tag_); - d.as_str_slice().to_strbuf() + d.as_str_slice().to_string() } reader::tagged_docs(depsdoc, tag_crate_dep, |depdoc| { let crate_id = @@ -1145,7 +1145,7 @@ pub fn maybe_get_crate_id(data: &[u8]) -> Option { pub fn get_crate_triple(data: &[u8]) -> String { let cratedoc = reader::Doc(data); let triple_doc = reader::maybe_get_doc(cratedoc, tag_crate_triple); - triple_doc.expect("No triple in crate").as_str().to_strbuf() + triple_doc.expect("No triple in crate").as_str().to_string() } pub fn get_crate_id(data: &[u8]) -> CrateId { @@ -1247,7 +1247,7 @@ pub fn get_native_libraries(cdata: Cmd) let name_doc = reader::get_doc(lib_doc, tag_native_libraries_name); let kind: cstore::NativeLibaryKind = FromPrimitive::from_u32(reader::doc_as_u32(kind_doc)).unwrap(); - let name = name_doc.as_str().to_strbuf(); + let name = name_doc.as_str().to_string(); result.push((kind, name)); true }); @@ -1264,7 +1264,7 @@ pub fn get_exported_macros(data: &[u8]) -> Vec { tag_exported_macros); let mut result = Vec::new(); reader::tagged_docs(macros, tag_macro_def, |macro_doc| { - result.push(macro_doc.as_str().to_strbuf()); + result.push(macro_doc.as_str().to_string()); true }); result @@ -1316,7 +1316,7 @@ pub fn get_method_arg_names(cdata: Cmd, id: ast::NodeId) -> Vec { match reader::maybe_get_doc(method_doc, tag_method_argument_names) { Some(args_doc) => { reader::tagged_docs(args_doc, tag_method_argument_name, |name_doc| { - ret.push(name_doc.as_str_slice().to_strbuf()); + ret.push(name_doc.as_str_slice().to_string()); true }); } diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index 443a8acfb0cc6..60562e55ce687 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -1738,7 +1738,7 @@ fn encode_dylib_dependency_formats(ebml_w: &mut Encoder, ecx: &EncodeContext) { slot.map(|kind| (format!("{}:{}", i + 1, match kind { cstore::RequireDynamic => "d", cstore::RequireStatic => "s", - })).to_strbuf()) + })).to_string()) }).collect::>(); ebml_w.writer.write(s.connect(",").as_bytes()); } @@ -1909,5 +1909,5 @@ pub fn encoded_ty(tcx: &ty::ctxt, t: ty::t) -> String { tcx: tcx, abbrevs: &RefCell::new(HashMap::new()) }, t); - str::from_utf8_owned(Vec::from_slice(wr.get_ref())).unwrap().to_strbuf() + str::from_utf8_owned(Vec::from_slice(wr.get_ref())).unwrap().to_string() } diff --git a/src/librustc/metadata/filesearch.rs b/src/librustc/metadata/filesearch.rs index 70d3c6c359a3c..c47d4e5d9c265 100644 --- a/src/librustc/metadata/filesearch.rs +++ b/src/librustc/metadata/filesearch.rs @@ -187,7 +187,7 @@ static PATH_ENTRY_SEPARATOR: &'static str = ":"; /// Returns RUST_PATH as a string, without default paths added pub fn get_rust_path() -> Option { - os::getenv("RUST_PATH").map(|x| x.to_strbuf()) + os::getenv("RUST_PATH").map(|x| x.to_string()) } /// Returns the value of RUST_PATH, as a list @@ -251,26 +251,26 @@ fn find_libdir(sysroot: &Path) -> String { #[cfg(target_word_size = "64")] fn primary_libdir_name() -> String { - "lib64".to_strbuf() + "lib64".to_string() } #[cfg(target_word_size = "32")] fn primary_libdir_name() -> String { - "lib32".to_strbuf() + "lib32".to_string() } fn secondary_libdir_name() -> String { - "lib".to_strbuf() + "lib".to_string() } } #[cfg(windows)] fn find_libdir(_sysroot: &Path) -> String { - "bin".to_strbuf() + "bin".to_string() } // The name of rustc's own place to organize libraries. // Used to be "rustc", now the default is "rustlib" pub fn rustlibdir() -> String { - "rustlib".to_strbuf() + "rustlib".to_string() } diff --git a/src/librustc/metadata/loader.rs b/src/librustc/metadata/loader.rs index 18c1c48e58f70..5cc8d9f7a1569 100644 --- a/src/librustc/metadata/loader.rs +++ b/src/librustc/metadata/loader.rs @@ -327,13 +327,13 @@ impl<'a> Context<'a> { Some(..) => {} // check the hash // hash is irrelevant, no version specified - None => return Some(hash.to_strbuf()) + None => return Some(hash.to_string()) } debug!("matching -- {}, vers ok", file); // hashes in filenames are prefixes of the "true hash" if self.id_hash == hash.as_slice() { debug!("matching -- {}, hash ok", file); - Some(hash.to_strbuf()) + Some(hash.to_string()) } else { None } @@ -423,7 +423,7 @@ impl<'a> Context<'a> { info!("Rejecting via crate triple: expected {} got {}", self.triple, triple); self.rejected_via_triple.push(CrateMismatch { path: libpath.clone(), - got: triple.to_strbuf() + got: triple.to_string() }); return false; } @@ -435,7 +435,7 @@ impl<'a> Context<'a> { info!("Rejecting via hash: expected {} got {}", *myhash, hash); self.rejected_via_hash.push(CrateMismatch { path: libpath.clone(), - got: myhash.as_str().to_strbuf() + got: myhash.as_str().to_string() }); false } else { diff --git a/src/librustc/middle/borrowck/check_loans.rs b/src/librustc/middle/borrowck/check_loans.rs index 65ecec2d2ed9f..052baac785540 100644 --- a/src/librustc/middle/borrowck/check_loans.rs +++ b/src/librustc/middle/borrowck/check_loans.rs @@ -243,7 +243,7 @@ impl<'a> CheckLoanCtxt<'a> { if restr.loan_path != loan2.loan_path { continue; } let old_pronoun = if new_loan.loan_path == old_loan.loan_path { - "it".to_strbuf() + "it".to_string() } else { format!("`{}`", self.bccx.loan_path_to_str(&*old_loan.loan_path)) diff --git a/src/librustc/middle/borrowck/mod.rs b/src/librustc/middle/borrowck/mod.rs index 909434559a615..5dd988a82ce42 100644 --- a/src/librustc/middle/borrowck/mod.rs +++ b/src/librustc/middle/borrowck/mod.rs @@ -609,7 +609,7 @@ impl<'a> BorrowckCtxt<'a> { } err_out_of_scope(..) => { let msg = match opt_loan_path(&err.cmt) { - None => "borrowed value".to_strbuf(), + None => "borrowed value".to_string(), Some(lp) => { format_strbuf!("`{}`", self.loan_path_to_str(&*lp)) } @@ -826,7 +826,7 @@ impl Repr for Loan { self.kind, self.gen_scope, self.kill_scope, - self.restrictions.repr(tcx))).to_strbuf() + self.restrictions.repr(tcx))).to_string() } } @@ -834,7 +834,7 @@ impl Repr for Restriction { fn repr(&self, tcx: &ty::ctxt) -> String { (format!("Restriction({}, {:x})", self.loan_path.repr(tcx), - self.set.bits as uint)).to_strbuf() + self.set.bits as uint)).to_string() } } @@ -842,17 +842,17 @@ impl Repr for LoanPath { fn repr(&self, tcx: &ty::ctxt) -> String { match self { &LpVar(id) => { - (format!("$({})", tcx.map.node_to_str(id))).to_strbuf() + (format!("$({})", tcx.map.node_to_str(id))).to_string() } &LpExtend(ref lp, _, LpDeref(_)) => { - (format!("{}.*", lp.repr(tcx))).to_strbuf() + (format!("{}.*", lp.repr(tcx))).to_string() } &LpExtend(ref lp, _, LpInterior(ref interior)) => { (format!("{}.{}", lp.repr(tcx), - interior.repr(tcx))).to_strbuf() + interior.repr(tcx))).to_string() } } } diff --git a/src/librustc/middle/cfg/graphviz.rs b/src/librustc/middle/cfg/graphviz.rs index 87a7ce8b7a4af..c33580d869b15 100644 --- a/src/librustc/middle/cfg/graphviz.rs +++ b/src/librustc/middle/cfg/graphviz.rs @@ -43,7 +43,7 @@ fn replace_newline_with_backslash_l(s: String) -> String { if last_two.as_slice() != ['\\', 'l'] { s = s.append("\\l"); } - s.to_strbuf() + s.to_string() } else { s } diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs index fb797a027956f..b218576bce705 100644 --- a/src/librustc/middle/check_match.rs +++ b/src/librustc/middle/check_match.rs @@ -164,8 +164,8 @@ fn check_exhaustive(cx: &MatchCheckCtxt, sp: Span, pats: Vec<@Pat> ) { match ty::get(ty).sty { ty::ty_bool => { match *ctor { - val(const_bool(true)) => Some("true".to_strbuf()), - val(const_bool(false)) => Some("false".to_strbuf()), + val(const_bool(true)) => Some("true".to_string()), + val(const_bool(false)) => Some("false".to_string()), _ => None } } @@ -180,7 +180,7 @@ fn check_exhaustive(cx: &MatchCheckCtxt, sp: Span, pats: Vec<@Pat> ) { Some(v) => { Some(token::get_ident(v.name).get() .to_str() - .into_strbuf()) + .into_string()) } None => { fail!("check_exhaustive: bad variant in ctor") @@ -201,7 +201,7 @@ fn check_exhaustive(cx: &MatchCheckCtxt, sp: Span, pats: Vec<@Pat> ) { }; let msg = format_strbuf!("non-exhaustive patterns{}", match ext { Some(ref s) => format_strbuf!(": {} not covered", *s), - None => "".to_strbuf() + None => "".to_string() }); cx.tcx.sess.span_err(sp, msg.as_slice()); } diff --git a/src/librustc/middle/check_static.rs b/src/librustc/middle/check_static.rs index abf80fe5104c6..4bf56ad11e3b6 100644 --- a/src/librustc/middle/check_static.rs +++ b/src/librustc/middle/check_static.rs @@ -134,7 +134,7 @@ impl<'a> Visitor for CheckStaticVisitor<'a> { if ty::has_dtor(self.tcx, did) { self.report_error(e.span, Some("static items are not allowed to have \ - destructors".to_strbuf())); + destructors".to_string())); return; } } diff --git a/src/librustc/middle/const_eval.rs b/src/librustc/middle/const_eval.rs index d2a28692f7bd3..d8fe801b395c6 100644 --- a/src/librustc/middle/const_eval.rs +++ b/src/librustc/middle/const_eval.rs @@ -314,8 +314,8 @@ pub fn eval_const_expr_partial(tcx: &T, e: &Expr) Ok(const_float(f)) => Ok(const_float(-f)), Ok(const_int(i)) => Ok(const_int(-i)), Ok(const_uint(i)) => Ok(const_uint(-i)), - Ok(const_str(_)) => Err("negate on string".to_strbuf()), - Ok(const_bool(_)) => Err("negate on boolean".to_strbuf()), + Ok(const_str(_)) => Err("negate on string".to_string()), + Ok(const_bool(_)) => Err("negate on boolean".to_string()), ref err => ((*err).clone()) } } @@ -324,7 +324,7 @@ pub fn eval_const_expr_partial(tcx: &T, e: &Expr) Ok(const_int(i)) => Ok(const_int(!i)), Ok(const_uint(i)) => Ok(const_uint(!i)), Ok(const_bool(b)) => Ok(const_bool(!b)), - _ => Err("not on float or string".to_strbuf()) + _ => Err("not on float or string".to_string()) } } ExprBinary(op, a, b) => { @@ -343,7 +343,7 @@ pub fn eval_const_expr_partial(tcx: &T, e: &Expr) BiNe => fromb(a != b), BiGe => fromb(a >= b), BiGt => fromb(a > b), - _ => Err("can't do this op on floats".to_strbuf()) + _ => Err("can't do this op on floats".to_string()) } } (Ok(const_int(a)), Ok(const_int(b))) => { @@ -352,12 +352,12 @@ pub fn eval_const_expr_partial(tcx: &T, e: &Expr) BiSub => Ok(const_int(a - b)), BiMul => Ok(const_int(a * b)), BiDiv if b == 0 => { - Err("attempted to divide by zero".to_strbuf()) + Err("attempted to divide by zero".to_string()) } BiDiv => Ok(const_int(a / b)), BiRem if b == 0 => { Err("attempted remainder with a divisor of \ - zero".to_strbuf()) + zero".to_string()) } BiRem => Ok(const_int(a % b)), BiAnd | BiBitAnd => Ok(const_int(a & b)), @@ -379,12 +379,12 @@ pub fn eval_const_expr_partial(tcx: &T, e: &Expr) BiSub => Ok(const_uint(a - b)), BiMul => Ok(const_uint(a * b)), BiDiv if b == 0 => { - Err("attempted to divide by zero".to_strbuf()) + Err("attempted to divide by zero".to_string()) } BiDiv => Ok(const_uint(a / b)), BiRem if b == 0 => { Err("attempted remainder with a divisor of \ - zero".to_strbuf()) + zero".to_string()) } BiRem => Ok(const_uint(a % b)), BiAnd | BiBitAnd => Ok(const_uint(a & b)), @@ -405,14 +405,14 @@ pub fn eval_const_expr_partial(tcx: &T, e: &Expr) match op { BiShl => Ok(const_int(a << b)), BiShr => Ok(const_int(a >> b)), - _ => Err("can't do this op on an int and uint".to_strbuf()) + _ => Err("can't do this op on an int and uint".to_string()) } } (Ok(const_uint(a)), Ok(const_int(b))) => { match op { BiShl => Ok(const_uint(a << b)), BiShr => Ok(const_uint(a >> b)), - _ => Err("can't do this op on a uint and int".to_strbuf()) + _ => Err("can't do this op on a uint and int".to_string()) } } (Ok(const_bool(a)), Ok(const_bool(b))) => { @@ -424,10 +424,10 @@ pub fn eval_const_expr_partial(tcx: &T, e: &Expr) BiBitOr => a | b, BiEq => a == b, BiNe => a != b, - _ => return Err("can't do this op on bools".to_strbuf()) + _ => return Err("can't do this op on bools".to_string()) })) } - _ => Err("bad operands for binary".to_strbuf()) + _ => Err("bad operands for binary".to_string()) } } ExprCast(base, target_ty) => { @@ -452,7 +452,7 @@ pub fn eval_const_expr_partial(tcx: &T, e: &Expr) const_uint(u) => Ok(const_float(u as f64)), const_int(i) => Ok(const_float(i as f64)), const_float(f) => Ok(const_float(f)), - _ => Err("can't cast float to str".to_strbuf()), + _ => Err("can't cast float to str".to_string()), } } ty::ty_uint(_) => { @@ -460,7 +460,7 @@ pub fn eval_const_expr_partial(tcx: &T, e: &Expr) const_uint(u) => Ok(const_uint(u)), const_int(i) => Ok(const_uint(i as u64)), const_float(f) => Ok(const_uint(f as u64)), - _ => Err("can't cast str to uint".to_strbuf()), + _ => Err("can't cast str to uint".to_string()), } } ty::ty_int(_) | ty::ty_bool => { @@ -468,10 +468,10 @@ pub fn eval_const_expr_partial(tcx: &T, e: &Expr) const_uint(u) => Ok(const_int(u as i64)), const_int(i) => Ok(const_int(i)), const_float(f) => Ok(const_int(f as i64)), - _ => Err("can't cast str to int".to_strbuf()), + _ => Err("can't cast str to int".to_string()), } } - _ => Err("can't cast this type".to_strbuf()) + _ => Err("can't cast this type".to_string()) } } } @@ -479,7 +479,7 @@ pub fn eval_const_expr_partial(tcx: &T, e: &Expr) ExprPath(_) => { match lookup_const(tcx.ty_ctxt(), e) { Some(actual_e) => eval_const_expr_partial(tcx.ty_ctxt(), actual_e), - None => Err("non-constant path in constant expr".to_strbuf()) + None => Err("non-constant path in constant expr".to_string()) } } ExprLit(lit) => Ok(lit_to_const(lit)), @@ -492,7 +492,7 @@ pub fn eval_const_expr_partial(tcx: &T, e: &Expr) None => Ok(const_int(0i64)) } } - _ => Err("unsupported constant expr".to_strbuf()) + _ => Err("unsupported constant expr".to_string()) } } diff --git a/src/librustc/middle/dataflow.rs b/src/librustc/middle/dataflow.rs index 5d1237da1def4..91c1c0bcf9fb1 100644 --- a/src/librustc/middle/dataflow.rs +++ b/src/librustc/middle/dataflow.rs @@ -102,14 +102,14 @@ impl<'a, O:DataFlowOperator> pprust::PpAnn for DataFlowContext<'a, O> { let gens_str = if gens.iter().any(|&u| u != 0) { format!(" gen: {}", bits_to_str(gens)) } else { - "".to_strbuf() + "".to_string() }; let kills = self.kills.slice(start, end); let kills_str = if kills.iter().any(|&u| u != 0) { format!(" kill: {}", bits_to_str(kills)) } else { - "".to_strbuf() + "".to_string() }; try!(ps.synth_comment(format_strbuf!("id {}: {}{}{}", diff --git a/src/librustc/middle/kind.rs b/src/librustc/middle/kind.rs index 7114eb10c4058..2b82dd6fd579f 100644 --- a/src/librustc/middle/kind.rs +++ b/src/librustc/middle/kind.rs @@ -587,8 +587,8 @@ fn check_sized(tcx: &ty::ctxt, ty: ty::t, name: String, sp: Span) { // Check that any variables in a pattern have types with statically known size. fn check_pat(cx: &mut Context, pat: &Pat) { let var_name = match pat.node { - PatWild => Some("_".to_strbuf()), - PatIdent(_, ref path, _) => Some(path_to_str(path).to_strbuf()), + PatWild => Some("_".to_string()), + PatIdent(_, ref path, _) => Some(path_to_str(path).to_string()), _ => None }; diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index 192e7e9be9c24..5759a1005f093 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -162,7 +162,7 @@ fn live_node_kind_to_str(lnk: LiveNodeKind, cx: &ty::ctxt) -> String { VarDefNode(s) => { format_strbuf!("Var def node [{}]", cm.span_to_str(s)) } - ExitNode => "Exit node".to_strbuf(), + ExitNode => "Exit node".to_string(), } } @@ -325,9 +325,9 @@ impl<'a> IrMaps<'a> { fn variable_name(&self, var: Variable) -> String { match self.var_kinds.get(var.get()) { &Local(LocalInfo { ident: nm, .. }) | &Arg(_, nm) => { - token::get_ident(nm).get().to_str().to_strbuf() + token::get_ident(nm).get().to_str().to_string() }, - &ImplicitRet => "".to_strbuf() + &ImplicitRet => "".to_string() } } @@ -760,7 +760,7 @@ impl<'a> Liveness<'a> { self.write_vars(wr, ln, |idx| self.users.get(idx).writer); write!(wr, " precedes {}]", self.successors.get(ln.get()).to_str()); } - str::from_utf8(wr.unwrap().as_slice()).unwrap().to_strbuf() + str::from_utf8(wr.unwrap().as_slice()).unwrap().to_string() } fn init_empty(&mut self, ln: LiveNode, succ_ln: LiveNode) { diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index 2d878965d5c96..5787657d6396f 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -1096,24 +1096,24 @@ impl<'t,TYPER:Typer> MemCategorizationContext<'t,TYPER> { pub fn cmt_to_str(&self, cmt: &cmt_) -> String { match cmt.cat { cat_static_item => { - "static item".to_strbuf() + "static item".to_string() } cat_copied_upvar(_) => { - "captured outer variable in a proc".to_strbuf() + "captured outer variable in a proc".to_string() } cat_rvalue(..) => { - "non-lvalue".to_strbuf() + "non-lvalue".to_string() } cat_local(_) => { - "local variable".to_strbuf() + "local variable".to_string() } cat_arg(..) => { - "argument".to_strbuf() + "argument".to_string() } cat_deref(ref base, _, pk) => { match base.cat { cat_upvar(..) => { - "captured outer variable".to_strbuf() + "captured outer variable".to_string() } _ => { format_strbuf!("dereference of `{}`-pointer", @@ -1122,22 +1122,22 @@ impl<'t,TYPER:Typer> MemCategorizationContext<'t,TYPER> { } } cat_interior(_, InteriorField(NamedField(_))) => { - "field".to_strbuf() + "field".to_string() } cat_interior(_, InteriorField(PositionalField(_))) => { - "anonymous field".to_strbuf() + "anonymous field".to_string() } cat_interior(_, InteriorElement(VecElement)) => { - "vec content".to_strbuf() + "vec content".to_string() } cat_interior(_, InteriorElement(StrElement)) => { - "str content".to_strbuf() + "str content".to_string() } cat_interior(_, InteriorElement(OtherElement)) => { - "indexed content".to_strbuf() + "indexed content".to_string() } cat_upvar(..) => { - "captured outer variable".to_strbuf() + "captured outer variable".to_string() } cat_discr(ref cmt, _) => { self.cmt_to_str(&**cmt) @@ -1303,10 +1303,10 @@ impl Repr for InteriorKind { fn repr(&self, _tcx: &ty::ctxt) -> String { match *self { InteriorField(NamedField(fld)) => { - token::get_name(fld).get().to_str().to_strbuf() + token::get_name(fld).get().to_str().to_string() } InteriorField(PositionalField(i)) => format_strbuf!("\\#{:?}", i), - InteriorElement(_) => "[]".to_strbuf(), + InteriorElement(_) => "[]".to_string(), } } } diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs index 2d13079ae7d8f..814a387f90e77 100644 --- a/src/librustc/middle/privacy.rs +++ b/src/librustc/middle/privacy.rs @@ -357,7 +357,7 @@ enum FieldName { impl<'a> PrivacyVisitor<'a> { // used when debugging fn nodestr(&self, id: ast::NodeId) -> String { - self.tcx.map.node_to_str(id).to_strbuf() + self.tcx.map.node_to_str(id).to_string() } // Determines whether the given definition is public from the point of view @@ -1383,7 +1383,7 @@ impl<'a> Visitor<()> for VisiblePrivateTypesVisitor<'a> { lint::VisiblePrivateTypes, path_id, p.span, "private type in exported type \ - signature".to_strbuf()); + signature".to_string()); } } _ => {} diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index 946d2b4a969b9..1a29cff3cd6dd 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -2097,9 +2097,9 @@ impl<'a> Resolver<'a> { -> String { match subclass { SingleImport(_, source) => { - token::get_ident(source).get().to_strbuf() + token::get_ident(source).get().to_string() } - GlobImport => "*".to_strbuf() + GlobImport => "*".to_string() } } @@ -2113,7 +2113,7 @@ impl<'a> Resolver<'a> { (format!("{}::{}", self.idents_to_str(idents), self.import_directive_subclass_to_str( - subclass))).to_strbuf() + subclass))).to_string() } } @@ -3314,7 +3314,7 @@ impl<'a> Resolver<'a> { debug!("(computing exports) YES: export '{}' => {:?}", name, def_id_of_def(d)); exports2.push(Export2 { - name: name.get().to_strbuf(), + name: name.get().to_string(), def_id: def_id_of_def(d) }); } @@ -4591,7 +4591,7 @@ impl<'a> Resolver<'a> { .add_lint(UnnecessaryQualification, id, path.span, - "unnecessary qualification".to_strbuf()); + "unnecessary qualification".to_string()); } _ => () } @@ -5051,7 +5051,7 @@ impl<'a> Resolver<'a> { *values.get(smallest) <= max_distance && name != maybes.get(smallest).get() { - Some(maybes.get(smallest).get().to_strbuf()) + Some(maybes.get(smallest).get().to_string()) } else { None @@ -5145,7 +5145,7 @@ impl<'a> Resolver<'a> { // limit search to 5 to reduce the number // of stupid suggestions self.find_best_match_for_name(wrong_name.as_slice(), 5) - .map_or("".to_strbuf(), + .map_or("".to_string(), |x| format!("`{}`", x)) } Field => @@ -5426,7 +5426,7 @@ impl<'a> Resolver<'a> { .add_lint(UnusedImports, id, p.span, - "unused import".to_strbuf()); + "unused import".to_string()); } }, } @@ -5450,7 +5450,7 @@ impl<'a> Resolver<'a> { self.session.add_lint(UnusedImports, id, span, - "unused import".to_strbuf()); + "unused import".to_string()); } let (v_priv, t_priv) = match self.last_private.find(&id) { @@ -5518,7 +5518,7 @@ impl<'a> Resolver<'a> { collect_mod(&mut idents, module); if idents.len() == 0 { - return "???".to_strbuf(); + return "???".to_string(); } self.idents_to_str(idents.move_iter().rev() .collect::>() diff --git a/src/librustc/middle/subst.rs b/src/librustc/middle/subst.rs index ebce96b0abbbb..e4bd8243e435b 100644 --- a/src/librustc/middle/subst.rs +++ b/src/librustc/middle/subst.rs @@ -112,7 +112,7 @@ impl<'a> TypeFolder for SubstFolder<'a> { let root_msg = match self.root_ty { Some(root) => format!(" in the substitution of `{}`", root.repr(self.tcx)), - None => "".to_strbuf() + None => "".to_string() }; let m = format!("can't use type parameters from outer \ function{}; try using a local type \ @@ -134,7 +134,7 @@ impl<'a> TypeFolder for SubstFolder<'a> { let root_msg = match self.root_ty { Some(root) => format!(" in the substitution of `{}`", root.repr(self.tcx)), - None => "".to_strbuf() + None => "".to_string() }; let m = format!("missing `Self` type param{}", root_msg); diff --git a/src/librustc/middle/trans/asm.rs b/src/librustc/middle/trans/asm.rs index 1ead93ca36656..140f60c1ea973 100644 --- a/src/librustc/middle/trans/asm.rs +++ b/src/librustc/middle/trans/asm.rs @@ -65,7 +65,7 @@ pub fn trans_inline_asm<'a>(bcx: &'a Block<'a>, ia: &ast::InlineAsm) let mut constraints = String::from_str(constraints.iter() - .map(|s| s.get().to_strbuf()) + .map(|s| s.get().to_string()) .collect::>() .connect(",") .as_slice()); @@ -136,11 +136,11 @@ pub fn trans_inline_asm<'a>(bcx: &'a Block<'a>, ia: &ast::InlineAsm) #[cfg(target_arch = "arm")] #[cfg(target_arch = "mips")] fn getClobbers() -> String { - "".to_strbuf() + "".to_string() } #[cfg(target_arch = "x86")] #[cfg(target_arch = "x86_64")] fn getClobbers() -> String { - "~{dirflag},~{fpsr},~{flags}".to_strbuf() + "~{dirflag},~{fpsr},~{flags}".to_string() } diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs index ee0a802de3f17..77ce3b3249f3b 100644 --- a/src/librustc/middle/trans/base.rs +++ b/src/librustc/middle/trans/base.rs @@ -216,7 +216,7 @@ pub fn get_extern_fn(ccx: &CrateContext, None => {} } let f = decl_fn(ccx.llmod, name, cc, ty, output); - externs.insert(name.to_strbuf(), f); + externs.insert(name.to_string(), f); f } @@ -232,7 +232,7 @@ fn get_extern_rust_fn(ccx: &CrateContext, fn_ty: ty::t, name: &str, did: ast::De set_llvm_fn_attrs(attrs.as_slice(), f) }); - ccx.externs.borrow_mut().insert(name.to_strbuf(), f); + ccx.externs.borrow_mut().insert(name.to_string(), f); f } @@ -271,7 +271,7 @@ pub fn get_extern_const(externs: &mut ExternMap, llmod: ModuleRef, let c = name.with_c_str(|buf| { llvm::LLVMAddGlobal(llmod, ty.to_ref(), buf) }); - externs.insert(name.to_strbuf(), c); + externs.insert(name.to_string(), c); return c; } } @@ -1406,7 +1406,7 @@ pub fn trans_fn(ccx: &CrateContext, param_substs: Option<¶m_substs>, id: ast::NodeId, attrs: &[ast::Attribute]) { - let _s = StatRecorder::new(ccx, ccx.tcx.map.path_to_str(id).to_strbuf()); + let _s = StatRecorder::new(ccx, ccx.tcx.map.path_to_str(id).to_string()); debug!("trans_fn(param_substs={})", param_substs.map(|s| s.repr(ccx.tcx()))); let _icx = push_ctxt("trans_fn"); let output_type = ty::ty_fn_ret(ty::node_id_to_type(ccx.tcx(), id)); @@ -1923,15 +1923,15 @@ fn exported_name(ccx: &CrateContext, id: ast::NodeId, ty: ty::t, attrs: &[ast::Attribute]) -> String { match attr::first_attr_value_str_by_name(attrs, "export_name") { // Use provided name - Some(name) => name.get().to_strbuf(), + Some(name) => name.get().to_string(), _ => ccx.tcx.map.with_path(id, |mut path| { if attr::contains_name(attrs, "no_mangle") { // Don't mangle - path.last().unwrap().to_str().to_strbuf() + path.last().unwrap().to_str().to_string() } else { match weak_lang_items::link_name(attrs) { - Some(name) => name.get().to_strbuf(), + Some(name) => name.get().to_string(), None => { // Usual name mangling mangle_exported_name(ccx, path, ty, id) @@ -2328,7 +2328,7 @@ pub fn trans_crate(krate: ast::Crate, let llmod = ccx.llmod; let mut reachable: Vec = ccx.reachable.iter().filter_map(|id| { - ccx.item_symbols.borrow().find(id).map(|s| s.to_strbuf()) + ccx.item_symbols.borrow().find(id).map(|s| s.to_string()) }).collect(); // Make sure that some other crucial symbols are not eliminated from the @@ -2337,13 +2337,13 @@ pub fn trans_crate(krate: ast::Crate, // symbol. This symbol is required for use by the libmorestack library that // we link in, so we must ensure that this symbol is not internalized (if // defined in the crate). - reachable.push("main".to_strbuf()); - reachable.push("rust_stack_exhausted".to_strbuf()); + reachable.push("main".to_string()); + reachable.push("rust_stack_exhausted".to_string()); // referenced from .eh_frame section on some platforms - reachable.push("rust_eh_personality".to_strbuf()); + reachable.push("rust_eh_personality".to_string()); // referenced from rt/rust_try.ll - reachable.push("rust_eh_personality_catch".to_strbuf()); + reachable.push("rust_eh_personality_catch".to_string()); let metadata_module = ccx.metadata_llmod; let formats = ccx.tcx.dependency_formats.borrow().clone(); diff --git a/src/librustc/middle/trans/callee.rs b/src/librustc/middle/trans/callee.rs index 90600ea2d3b2f..1659ecaecd89c 100644 --- a/src/librustc/middle/trans/callee.rs +++ b/src/librustc/middle/trans/callee.rs @@ -358,7 +358,7 @@ pub fn trans_fn_ref_with_vtables( let map_node = session::expect( ccx.sess(), tcx.map.find(def_id.node), - || "local item should be in ast map".to_strbuf()); + || "local item should be in ast map".to_string()); match map_node { ast_map::NodeForeignItem(_) => { diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index 55638b9f80a6e..237c5e8711df5 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -443,11 +443,11 @@ impl<'a> Block<'a> { pub fn sess(&self) -> &'a Session { self.fcx.ccx.sess() } pub fn ident(&self, ident: Ident) -> String { - token::get_ident(ident).get().to_strbuf() + token::get_ident(ident).get().to_string() } pub fn node_id_to_str(&self, id: ast::NodeId) -> String { - self.tcx().map.node_to_str(id).to_strbuf() + self.tcx().map.node_to_str(id).to_string() } pub fn expr_to_str(&self, e: &ast::Expr) -> String { diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs index 94f17172d58f0..225c3c48cf406 100644 --- a/src/librustc/middle/trans/debuginfo.rs +++ b/src/librustc/middle/trans/debuginfo.rs @@ -736,7 +736,7 @@ pub fn create_function_debug_context(cx: &CrateContext, let containing_scope = namespace_node.scope; (linkage_name, containing_scope) } else { - (function_name.as_slice().to_strbuf(), file_metadata) + (function_name.as_slice().to_string(), file_metadata) }; // Clang sets this parameter to the opening brace of the function's block, so let's do this too. @@ -1119,7 +1119,7 @@ fn file_metadata(cx: &CrateContext, full_path: &str) -> DIFile { }); let mut created_files = debug_context(cx).created_files.borrow_mut(); - created_files.insert(full_path.to_strbuf(), file_metadata); + created_files.insert(full_path.to_string(), file_metadata); return file_metadata; } @@ -1255,9 +1255,9 @@ impl StructMemberDescriptionFactory { self.fields.iter().enumerate().map(|(i, field)| { let name = if field.ident.name == special_idents::unnamed_field.name { - "".to_strbuf() + "".to_string() } else { - token::get_ident(field.ident).get().to_strbuf() + token::get_ident(field.ident).get().to_string() }; let offset = if self.is_simd { @@ -1366,7 +1366,7 @@ impl TupleMemberDescriptionFactory { -> Vec { self.component_types.iter().map(|&component_type| { MemberDescription { - name: "".to_strbuf(), + name: "".to_string(), llvm_type: type_of::type_of(cx, component_type), type_metadata: type_metadata(cx, component_type, self.span), offset: ComputedMemberOffset, @@ -1444,7 +1444,7 @@ impl GeneralMemberDescriptionFactory { self.file_metadata, codemap::DUMMY_SP); MemberDescription { - name: "".to_strbuf(), + name: "".to_string(), llvm_type: variant_llvm_type, type_metadata: variant_type_metadata, offset: FixedMemberOffset { bytes: 0 }, @@ -1464,7 +1464,7 @@ impl EnumVariantMemberDescriptionFactory { -> Vec { self.args.iter().enumerate().map(|(i, &(ref name, ty))| { MemberDescription { - name: name.to_strbuf(), + name: name.to_string(), llvm_type: type_of::type_of(cx, ty), type_metadata: match self.discriminant_type_metadata { Some(metadata) if i == 0 => metadata, @@ -1513,21 +1513,21 @@ fn describe_enum_variant(cx: &CrateContext, Some(ref names) => { names.iter() .map(|ident| { - token::get_ident(*ident).get().to_str().into_strbuf() + token::get_ident(*ident).get().to_str().into_string() }).collect() } - None => variant_info.args.iter().map(|_| "".to_strbuf()).collect() + None => variant_info.args.iter().map(|_| "".to_string()).collect() }; // If this is not a univariant enum, there is also the (unnamed) discriminant field if discriminant_type_metadata.is_some() { - arg_names.insert(0, "".to_strbuf()); + arg_names.insert(0, "".to_string()); } // Build an array of (field name, field type) pairs to be captured in the factory closure. let args: Vec<(String, ty::t)> = arg_names.iter() .zip(struct_def.fields.iter()) - .map(|(s, &t)| (s.to_strbuf(), t)) + .map(|(s, &t)| (s.to_string(), t)) .collect(); let member_description_factory = @@ -1876,7 +1876,7 @@ fn boxed_type_metadata(cx: &CrateContext, -> DICompositeType { let box_type_name = match content_type_name { Some(content_type_name) => format!("Boxed<{}>", content_type_name), - None => "BoxedType".to_strbuf() + None => "BoxedType".to_string() }; let box_llvm_type = Type::at_box(cx, content_llvm_type); @@ -1891,31 +1891,31 @@ fn boxed_type_metadata(cx: &CrateContext, let member_descriptions = [ MemberDescription { - name: "refcnt".to_strbuf(), + name: "refcnt".to_string(), llvm_type: *member_llvm_types.get(0), type_metadata: type_metadata(cx, int_type, codemap::DUMMY_SP), offset: ComputedMemberOffset, }, MemberDescription { - name: "drop_glue".to_strbuf(), + name: "drop_glue".to_string(), llvm_type: *member_llvm_types.get(1), type_metadata: nil_pointer_type_metadata, offset: ComputedMemberOffset, }, MemberDescription { - name: "prev".to_strbuf(), + name: "prev".to_string(), llvm_type: *member_llvm_types.get(2), type_metadata: nil_pointer_type_metadata, offset: ComputedMemberOffset, }, MemberDescription { - name: "next".to_strbuf(), + name: "next".to_string(), llvm_type: *member_llvm_types.get(3), type_metadata: nil_pointer_type_metadata, offset: ComputedMemberOffset, }, MemberDescription { - name: "val".to_strbuf(), + name: "val".to_string(), llvm_type: *member_llvm_types.get(4), type_metadata: content_type_metadata, offset: ComputedMemberOffset, @@ -2004,19 +2004,19 @@ fn vec_metadata(cx: &CrateContext, let member_descriptions = [ MemberDescription { - name: "fill".to_strbuf(), + name: "fill".to_string(), llvm_type: *member_llvm_types.get(0), type_metadata: int_type_metadata, offset: ComputedMemberOffset, }, MemberDescription { - name: "alloc".to_strbuf(), + name: "alloc".to_string(), llvm_type: *member_llvm_types.get(1), type_metadata: int_type_metadata, offset: ComputedMemberOffset, }, MemberDescription { - name: "elements".to_strbuf(), + name: "elements".to_string(), llvm_type: *member_llvm_types.get(2), type_metadata: array_type_metadata, offset: ComputedMemberOffset, @@ -2061,13 +2061,13 @@ fn vec_slice_metadata(cx: &CrateContext, let member_descriptions = [ MemberDescription { - name: "data_ptr".to_strbuf(), + name: "data_ptr".to_string(), llvm_type: *member_llvm_types.get(0), type_metadata: type_metadata(cx, data_ptr_type, span), offset: ComputedMemberOffset, }, MemberDescription { - name: "length".to_strbuf(), + name: "length".to_string(), llvm_type: *member_llvm_types.get(1), type_metadata: type_metadata(cx, ty::mk_uint(), span), offset: ComputedMemberOffset, diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs index 8b5685ec4a43b..f254422226fcd 100644 --- a/src/librustc/middle/trans/expr.rs +++ b/src/librustc/middle/trans/expr.rs @@ -89,7 +89,7 @@ impl Dest { pub fn to_str(&self, ccx: &CrateContext) -> String { match *self { SaveIn(v) => format_strbuf!("SaveIn({})", ccx.tn.val_to_str(v)), - Ignore => "Ignore".to_strbuf() + Ignore => "Ignore".to_string() } } } diff --git a/src/librustc/middle/trans/foreign.rs b/src/librustc/middle/trans/foreign.rs index 0f14a3a097cae..96fb8ac0e980c 100644 --- a/src/librustc/middle/trans/foreign.rs +++ b/src/librustc/middle/trans/foreign.rs @@ -163,7 +163,7 @@ pub fn register_static(ccx: &CrateContext, }); lib::llvm::SetLinkage(g1, linkage); - let mut real_name = "_rust_extern_with_linkage_".to_strbuf(); + let mut real_name = "_rust_extern_with_linkage_".to_string(); real_name.push_str(ident.get()); let g2 = real_name.with_c_str(|buf| { llvm::LLVMAddGlobal(ccx.llmod, llty.to_ref(), buf) @@ -465,7 +465,7 @@ pub fn trans_foreign_mod(ccx: &CrateContext, foreign_mod: &ast::ForeignMod) { } ccx.item_symbols.borrow_mut().insert(foreign_item.id, - lname.get().to_strbuf()); + lname.get().to_string()); } } diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index d907b52f0c912..fe8db6fa8a11f 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -3205,7 +3205,7 @@ pub fn field_idx_strict(tcx: &ctxt, name: ast::Name, fields: &[field]) "no field named `{}` found in the list of fields `{:?}`", token::get_name(name), fields.iter() - .map(|f| token::get_ident(f.ident).get().to_strbuf()) + .map(|f| token::get_ident(f.ident).get().to_string()) .collect::>()).as_slice()); } @@ -3237,26 +3237,26 @@ pub fn ty_sort_str(cx: &ctxt, t: t) -> String { } ty_enum(id, _) => format_strbuf!("enum {}", item_path_str(cx, id)), - ty_box(_) => "@-ptr".to_strbuf(), - ty_uniq(_) => "box".to_strbuf(), - ty_vec(_, _) => "vector".to_strbuf(), - ty_ptr(_) => "*-ptr".to_strbuf(), - ty_rptr(_, _) => "&-ptr".to_strbuf(), - ty_bare_fn(_) => "extern fn".to_strbuf(), - ty_closure(_) => "fn".to_strbuf(), + ty_box(_) => "@-ptr".to_string(), + ty_uniq(_) => "box".to_string(), + ty_vec(_, _) => "vector".to_string(), + ty_ptr(_) => "*-ptr".to_string(), + ty_rptr(_, _) => "&-ptr".to_string(), + ty_bare_fn(_) => "extern fn".to_string(), + ty_closure(_) => "fn".to_string(), ty_trait(ref inner) => { format_strbuf!("trait {}", item_path_str(cx, inner.def_id)) } ty_struct(id, _) => { format_strbuf!("struct {}", item_path_str(cx, id)) } - ty_tup(_) => "tuple".to_strbuf(), - ty_infer(TyVar(_)) => "inferred type".to_strbuf(), - ty_infer(IntVar(_)) => "integral variable".to_strbuf(), - ty_infer(FloatVar(_)) => "floating-point variable".to_strbuf(), - ty_param(_) => "type parameter".to_strbuf(), - ty_self(_) => "self".to_strbuf(), - ty_err => "type error".to_strbuf(), + ty_tup(_) => "tuple".to_string(), + ty_infer(TyVar(_)) => "inferred type".to_string(), + ty_infer(IntVar(_)) => "integral variable".to_string(), + ty_infer(FloatVar(_)) => "floating-point variable".to_string(), + ty_param(_) => "type parameter".to_string(), + ty_self(_) => "self".to_string(), + ty_err => "type error".to_string(), } } @@ -3272,13 +3272,13 @@ pub fn type_err_to_str(cx: &ctxt, err: &type_err) -> String { fn tstore_to_closure(s: &TraitStore) -> String { match s { - &UniqTraitStore => "proc".to_strbuf(), - &RegionTraitStore(..) => "closure".to_strbuf() + &UniqTraitStore => "proc".to_string(), + &RegionTraitStore(..) => "closure".to_string() } } match *err { - terr_mismatch => "types differ".to_strbuf(), + terr_mismatch => "types differ".to_string(), terr_fn_style_mismatch(values) => { format_strbuf!("expected {} fn but found {} fn", values.expected.to_str(), @@ -3299,13 +3299,13 @@ pub fn type_err_to_str(cx: &ctxt, err: &type_err) -> String { tstore_to_closure(&values.expected), tstore_to_closure(&values.found)) } - terr_mutability => "values differ in mutability".to_strbuf(), + terr_mutability => "values differ in mutability".to_string(), terr_box_mutability => { - "boxed values differ in mutability".to_strbuf() + "boxed values differ in mutability".to_string() } - terr_vec_mutability => "vectors differ in mutability".to_strbuf(), - terr_ptr_mutability => "pointers differ in mutability".to_strbuf(), - terr_ref_mutability => "references differ in mutability".to_strbuf(), + terr_vec_mutability => "vectors differ in mutability".to_string(), + terr_ptr_mutability => "pointers differ in mutability".to_string(), + terr_ref_mutability => "references differ in mutability".to_string(), terr_ty_param_size(values) => { format_strbuf!("expected a type with {} type params \ but found one with {} type params", @@ -3325,7 +3325,7 @@ pub fn type_err_to_str(cx: &ctxt, err: &type_err) -> String { values.found) } terr_record_mutability => { - "record elements differ in mutability".to_strbuf() + "record elements differ in mutability".to_string() } terr_record_fields(values) => { format_strbuf!("expected a record with field `{}` but found one \ @@ -3334,16 +3334,16 @@ pub fn type_err_to_str(cx: &ctxt, err: &type_err) -> String { token::get_ident(values.found)) } terr_arg_count => { - "incorrect number of function parameters".to_strbuf() + "incorrect number of function parameters".to_string() } terr_regions_does_not_outlive(..) => { - "lifetime mismatch".to_strbuf() + "lifetime mismatch".to_string() } terr_regions_not_same(..) => { - "lifetimes are not the same".to_strbuf() + "lifetimes are not the same".to_string() } terr_regions_no_overlap(..) => { - "lifetimes do not intersect".to_strbuf() + "lifetimes do not intersect".to_string() } terr_regions_insufficiently_polymorphic(br, _) => { format_strbuf!("expected bound lifetime parameter {}, \ @@ -3385,7 +3385,7 @@ pub fn type_err_to_str(cx: &ctxt, err: &type_err) -> String { } } terr_integer_as_char => { - "expected an integral type but found `char`".to_strbuf() + "expected an integral type but found `char`".to_string() } terr_int_mismatch(ref values) => { format_strbuf!("expected `{}` but found `{}`", @@ -3714,7 +3714,7 @@ pub fn substd_enum_variants(cx: &ctxt, } pub fn item_path_str(cx: &ctxt, id: ast::DefId) -> String { - with_path(cx, id, |path| ast_map::path_to_str(path)).to_strbuf() + with_path(cx, id, |path| ast_map::path_to_str(path)).to_string() } pub enum DtorKind { diff --git a/src/librustc/middle/typeck/check/_match.rs b/src/librustc/middle/typeck/check/_match.rs index 6e164d07015d2..3d37de38e4523 100644 --- a/src/librustc/middle/typeck/check/_match.rs +++ b/src/librustc/middle/typeck/check/_match.rs @@ -166,14 +166,14 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: &ast::Pat, path: &ast::Path, // See [Note-Type-error-reporting] in middle/typeck/infer/mod.rs fcx.infcx().type_error_message_str_with_expected(pat.span, |expected, actual| { - expected.map_or("".to_strbuf(), |e| { + expected.map_or("".to_string(), |e| { format_strbuf!("mismatched types: expected `{}` but \ found {}", e, actual) })}, Some(expected), - "a structure pattern".to_strbuf(), + "a structure pattern".to_string(), None); fcx.write_error(pat.id); kind_name = "[error]"; @@ -221,7 +221,7 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: &ast::Pat, path: &ast::Path, // See [Note-Type-error-reporting] in middle/typeck/infer/mod.rs fcx.infcx().type_error_message_str_with_expected(pat.span, |expected, actual| { - expected.map_or("".to_strbuf(), + expected.map_or("".to_string(), |e| { format_strbuf!("mismatched types: expected `{}` but \ found {}", @@ -230,7 +230,7 @@ pub fn check_pat_variant(pcx: &pat_ctxt, pat: &ast::Pat, path: &ast::Path, }) }, Some(expected), - "an enum or structure pattern".to_strbuf(), + "an enum or structure pattern".to_string(), None); fcx.write_error(pat.id); kind_name = "[error]"; @@ -459,7 +459,7 @@ pub fn check_pat(pcx: &pat_ctxt, pat: &ast::Pat, expected: ty::t) { debug!("pat_range ending type: {:?}", e_ty); if !require_same_types( tcx, Some(fcx.infcx()), false, pat.span, b_ty, e_ty, - || "mismatched types in range".to_strbuf()) + || "mismatched types in range".to_string()) { // no-op } else if !ty::type_is_numeric(b_ty) && !ty::type_is_char(b_ty) { @@ -553,7 +553,7 @@ pub fn check_pat(pcx: &pat_ctxt, pat: &ast::Pat, expected: ty::t) { // See [Note-Type-error-reporting] in middle/typeck/infer/mod.rs fcx.infcx().type_error_message_str_with_expected(pat.span, |expected, actual| { - expected.map_or("".to_strbuf(), + expected.map_or("".to_string(), |e| { format_strbuf!("mismatched types: expected \ `{}` but found {}", @@ -561,7 +561,7 @@ pub fn check_pat(pcx: &pat_ctxt, pat: &ast::Pat, expected: ty::t) { actual) })}, Some(expected), - "a structure pattern".to_strbuf(), + "a structure pattern".to_string(), None); match tcx.def_map.borrow().find(&pat.id) { Some(&ast::DefStruct(supplied_def_id)) => { @@ -620,7 +620,7 @@ pub fn check_pat(pcx: &pat_ctxt, pat: &ast::Pat, expected: ty::t) { fcx.infcx().type_error_message_str_with_expected(pat.span, |expected, actual| { - expected.map_or("".to_strbuf(), |e| { + expected.map_or("".to_string(), |e| { format_strbuf!("mismatched types: expected `{}` \ but found {}", e, @@ -628,7 +628,7 @@ pub fn check_pat(pcx: &pat_ctxt, pat: &ast::Pat, expected: ty::t) { } )}, Some(expected), - "tuple".to_strbuf(), + "tuple".to_string(), Some(&type_error)); fcx.write_error(pat.id); } @@ -659,7 +659,7 @@ pub fn check_pat(pcx: &pat_ctxt, pat: &ast::Pat, expected: ty::t) { fcx.infcx().type_error_message_str_with_expected( pat.span, |expected, actual| { - expected.map_or("".to_strbuf(), + expected.map_or("".to_string(), |e| { format_strbuf!("mismatched types: expected `{}` but \ found {}", @@ -668,7 +668,7 @@ pub fn check_pat(pcx: &pat_ctxt, pat: &ast::Pat, expected: ty::t) { }) }, Some(expected), - "a vector pattern".to_strbuf(), + "a vector pattern".to_string(), None); fcx.write_error(pat.id); }; @@ -682,7 +682,7 @@ pub fn check_pat(pcx: &pat_ctxt, pat: &ast::Pat, expected: ty::t) { fcx.type_error_message(pat.span, |_| { "unique vector patterns are no \ - longer supported".to_strbuf() + longer supported".to_string() }, expected, None); @@ -750,7 +750,7 @@ pub fn check_pointer_pat(pcx: &pat_ctxt, fcx.infcx().type_error_message_str_with_expected( span, |expected, actual| { - expected.map_or("".to_strbuf(), |e| { + expected.map_or("".to_string(), |e| { format_strbuf!("mismatched types: expected `{}` but \ found {}", e, diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index d287abfcda1f7..cdf8b50a1cd23 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -3355,7 +3355,7 @@ fn check_expr_with_unifier(fcx: &FnCtxt, ppaux::ty_to_str(tcx, fcx.expr_ty(expr)), match expected { Some(t) => ppaux::ty_to_str(tcx, t), - _ => "empty".to_strbuf() + _ => "empty".to_string() }); unifier(); @@ -3511,7 +3511,7 @@ pub fn check_block_with_expected(fcx: &FnCtxt, .add_lint(UnreachableCode, s_id, s.span, - "unreachable statement".to_strbuf()); + "unreachable statement".to_string()); warned = true; } if ty::type_is_bot(s_ty) { @@ -3538,7 +3538,7 @@ pub fn check_block_with_expected(fcx: &FnCtxt, .add_lint(UnreachableCode, e.id, e.span, - "unreachable expression".to_strbuf()); + "unreachable expression".to_string()); } check_expr_with_opt_hint(fcx, e, expected); let ety = fcx.expr_ty(e); @@ -4077,7 +4077,7 @@ pub fn structurally_resolved_type(fcx: &FnCtxt, sp: Span, tp: ty::t) -> ty::t { _ => { fcx.type_error_message(sp, |_actual| { "the type of this value must be known in this \ - context".to_strbuf() + context".to_string() }, tp, None); demand::suptype(fcx, sp, ty::mk_err(), tp); tp diff --git a/src/librustc/middle/typeck/infer/error_reporting.rs b/src/librustc/middle/typeck/infer/error_reporting.rs index 1cbee01db284f..d7e70205f5d48 100644 --- a/src/librustc/middle/typeck/infer/error_reporting.rs +++ b/src/librustc/middle/typeck/infer/error_reporting.rs @@ -1227,12 +1227,12 @@ impl<'a> ErrorReportingHelpers for InferCtxt<'a> { fn report_inference_failure(&self, var_origin: RegionVariableOrigin) { let var_description = match var_origin { - infer::MiscVariable(_) => "".to_strbuf(), - infer::PatternRegion(_) => " for pattern".to_strbuf(), - infer::AddrOfRegion(_) => " for borrow expression".to_strbuf(), - infer::AddrOfSlice(_) => " for slice expression".to_strbuf(), - infer::Autoref(_) => " for autoref".to_strbuf(), - infer::Coercion(_) => " for automatic coercion".to_strbuf(), + infer::MiscVariable(_) => "".to_string(), + infer::PatternRegion(_) => " for pattern".to_string(), + infer::AddrOfRegion(_) => " for borrow expression".to_string(), + infer::AddrOfSlice(_) => " for slice expression".to_string(), + infer::Autoref(_) => " for autoref".to_string(), + infer::Coercion(_) => " for automatic coercion".to_string(), infer::LateBoundRegion(_, br) => { format!(" for {}in function call", bound_region_to_str(self.tcx, "lifetime parameter ", true, br)) @@ -1475,7 +1475,7 @@ impl LifeGiver { fn with_taken(taken: &[ast::Lifetime]) -> LifeGiver { let mut taken_ = HashSet::new(); for lt in taken.iter() { - let lt_name = token::get_name(lt.name).get().to_strbuf(); + let lt_name = token::get_name(lt.name).get().to_string(); taken_.insert(lt_name); } LifeGiver { diff --git a/src/librustc/middle/typeck/infer/glb.rs b/src/librustc/middle/typeck/infer/glb.rs index 7c1866cf81ddf..38b2cdcb52810 100644 --- a/src/librustc/middle/typeck/infer/glb.rs +++ b/src/librustc/middle/typeck/infer/glb.rs @@ -36,7 +36,7 @@ impl<'f> Glb<'f> { impl<'f> Combine for Glb<'f> { fn infcx<'a>(&'a self) -> &'a InferCtxt<'a> { self.get_ref().infcx } - fn tag(&self) -> String { "glb".to_strbuf() } + fn tag(&self) -> String { "glb".to_string() } fn a_is_expected(&self) -> bool { self.get_ref().a_is_expected } fn trace(&self) -> TypeTrace { self.get_ref().trace.clone() } diff --git a/src/librustc/middle/typeck/infer/lub.rs b/src/librustc/middle/typeck/infer/lub.rs index 22caad79c198f..98086fcf6613c 100644 --- a/src/librustc/middle/typeck/infer/lub.rs +++ b/src/librustc/middle/typeck/infer/lub.rs @@ -35,7 +35,7 @@ impl<'f> Lub<'f> { impl<'f> Combine for Lub<'f> { fn infcx<'a>(&'a self) -> &'a InferCtxt<'a> { self.get_ref().infcx } - fn tag(&self) -> String { "lub".to_strbuf() } + fn tag(&self) -> String { "lub".to_string() } fn a_is_expected(&self) -> bool { self.get_ref().a_is_expected } fn trace(&self) -> TypeTrace { self.get_ref().trace.clone() } diff --git a/src/librustc/middle/typeck/infer/mod.rs b/src/librustc/middle/typeck/infer/mod.rs index 7a0a9610629e5..107c54115b42a 100644 --- a/src/librustc/middle/typeck/infer/mod.rs +++ b/src/librustc/middle/typeck/infer/mod.rs @@ -247,10 +247,10 @@ pub enum fixup_err { pub fn fixup_err_to_str(f: fixup_err) -> String { match f { - unresolved_int_ty(_) => "unconstrained integral type".to_strbuf(), - unresolved_ty(_) => "unconstrained type".to_strbuf(), - cyclic_ty(_) => "cyclic type of infinite size".to_strbuf(), - unresolved_region(_) => "unconstrained region".to_strbuf(), + unresolved_int_ty(_) => "unconstrained integral type".to_string(), + unresolved_ty(_) => "unconstrained type".to_string(), + cyclic_ty(_) => "cyclic type of infinite size".to_string(), + unresolved_region(_) => "unconstrained region".to_string(), region_var_bound_by_region_var(r1, r2) => { format_strbuf!("region var {:?} bound by another region var {:?}; \ this is a bug in rustc", @@ -729,7 +729,7 @@ impl<'a> InferCtxt<'a> { err: Option<&ty::type_err>) { debug!("hi! expected_ty = {:?}, actual_ty = {}", expected_ty, actual_ty); - let error_str = err.map_or("".to_strbuf(), |t_err| { + let error_str = err.map_or("".to_string(), |t_err| { format!(" ({})", ty::type_err_to_str(self.tcx, t_err)) }); let resolved_expected = expected_ty.map(|e_ty| { diff --git a/src/librustc/middle/typeck/infer/sub.rs b/src/librustc/middle/typeck/infer/sub.rs index a99e06d460cff..a543cf18d565a 100644 --- a/src/librustc/middle/typeck/infer/sub.rs +++ b/src/librustc/middle/typeck/infer/sub.rs @@ -35,7 +35,7 @@ impl<'f> Sub<'f> { impl<'f> Combine for Sub<'f> { fn infcx<'a>(&'a self) -> &'a InferCtxt<'a> { self.get_ref().infcx } - fn tag(&self) -> String { "sub".to_strbuf() } + fn tag(&self) -> String { "sub".to_string() } fn a_is_expected(&self) -> bool { self.get_ref().a_is_expected } fn trace(&self) -> TypeTrace { self.get_ref().trace.clone() } diff --git a/src/librustc/middle/typeck/infer/to_str.rs b/src/librustc/middle/typeck/infer/to_str.rs index ab65db8e394b6..eaca07b782f7d 100644 --- a/src/librustc/middle/typeck/infer/to_str.rs +++ b/src/librustc/middle/typeck/infer/to_str.rs @@ -56,7 +56,7 @@ impl InferStr for Bound { fn inf_str(&self, cx: &InferCtxt) -> String { match *self { Some(ref v) => v.inf_str(cx), - None => "none".to_strbuf() + None => "none".to_string() } } } @@ -82,13 +82,13 @@ impl InferStr for VarValue { impl InferStr for IntVarValue { fn inf_str(&self, _cx: &InferCtxt) -> String { - self.to_str().to_strbuf() + self.to_str().to_string() } } impl InferStr for ast::FloatTy { fn inf_str(&self, _cx: &InferCtxt) -> String { - self.to_str().to_strbuf() + self.to_str().to_string() } } diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 649608e82752c..7b8c62fbf88f1 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -99,7 +99,7 @@ pub fn explain_region_and_span(cx: &ctxt, region: ty::Region) format_strbuf!("the anonymous lifetime \\#{} defined on", idx + 1) } - BrFresh(_) => "an anonymous lifetime defined on".to_strbuf(), + BrFresh(_) => "an anonymous lifetime defined on".to_string(), _ => { format_strbuf!("the lifetime {} as defined on", bound_region_ptr_to_str(cx, fr.bound_region)) @@ -123,9 +123,9 @@ pub fn explain_region_and_span(cx: &ctxt, region: ty::Region) } } - ReStatic => { ("the static lifetime".to_strbuf(), None) } + ReStatic => { ("the static lifetime".to_string(), None) } - ReEmpty => { ("the empty lifetime".to_strbuf(), None) } + ReEmpty => { ("the empty lifetime".to_string(), None) } // I believe these cases should not occur (except when debugging, // perhaps) @@ -164,8 +164,8 @@ pub fn bound_region_to_str(cx: &ctxt, token::get_name(name), space_str) } - BrAnon(_) => prefix.to_strbuf(), - BrFresh(_) => prefix.to_strbuf(), + BrAnon(_) => prefix.to_string(), + BrFresh(_) => prefix.to_string(), } } @@ -188,16 +188,16 @@ pub fn region_to_str(cx: &ctxt, prefix: &str, space: bool, region: Region) -> St // to fit that into a short string. Hence the recommendation to use // `explain_region()` or `note_and_explain_region()`. match region { - ty::ReScope(_) => prefix.to_strbuf(), + ty::ReScope(_) => prefix.to_string(), ty::ReEarlyBound(_, _, name) => { - token::get_name(name).get().to_strbuf() + token::get_name(name).get().to_string() } ty::ReLateBound(_, br) => bound_region_to_str(cx, prefix, space, br), ty::ReFree(ref fr) => bound_region_to_str(cx, prefix, space, fr.bound_region), ty::ReInfer(ReSkolemized(_, br)) => { bound_region_to_str(cx, prefix, space, br) } - ty::ReInfer(ReVar(_)) => prefix.to_strbuf(), + ty::ReInfer(ReVar(_)) => prefix.to_string(), ty::ReStatic => format_strbuf!("{}'static{}", prefix, space_str), ty::ReEmpty => format_strbuf!("{}'{}", prefix, space_str), } @@ -205,8 +205,8 @@ pub fn region_to_str(cx: &ctxt, prefix: &str, space: bool, region: Region) -> St pub fn mutability_to_str(m: ast::Mutability) -> String { match m { - ast::MutMutable => "mut ".to_strbuf(), - ast::MutImmutable => "".to_strbuf(), + ast::MutMutable => "mut ".to_string(), + ast::MutImmutable => "".to_string(), } } @@ -216,7 +216,7 @@ pub fn mt_to_str(cx: &ctxt, m: &mt) -> String { pub fn trait_store_to_str(cx: &ctxt, s: ty::TraitStore) -> String { match s { - ty::UniqTraitStore => "Box ".to_strbuf(), + ty::UniqTraitStore => "Box ".to_string(), ty::RegionTraitStore(r, m) => { format_strbuf!("{}{}", region_ptr_to_str(cx, r), @@ -238,12 +238,12 @@ pub fn fn_sig_to_str(cx: &ctxt, typ: &ty::FnSig) -> String { } pub fn trait_ref_to_str(cx: &ctxt, trait_ref: &ty::TraitRef) -> String { - trait_ref.user_string(cx).to_strbuf() + trait_ref.user_string(cx).to_string() } pub fn ty_to_str(cx: &ctxt, typ: t) -> String { fn fn_input_to_str(cx: &ctxt, input: ty::t) -> String { - ty_to_str(cx, input).to_strbuf() + ty_to_str(cx, input).to_string() } fn bare_fn_to_str(cx: &ctxt, fn_style: ast::FnStyle, @@ -351,15 +351,15 @@ pub fn ty_to_str(cx: &ctxt, typ: t) -> String { // pretty print the structural type representation: return match ty::get(typ).sty { - ty_nil => "()".to_strbuf(), - ty_bot => "!".to_strbuf(), - ty_bool => "bool".to_strbuf(), - ty_char => "char".to_strbuf(), + ty_nil => "()".to_string(), + ty_bot => "!".to_string(), + ty_bool => "bool".to_string(), + ty_char => "char".to_string(), ty_int(t) => ast_util::int_ty_to_str(t, None, - ast_util::AutoSuffix).to_strbuf(), + ast_util::AutoSuffix).to_string(), ty_uint(t) => ast_util::uint_ty_to_str(t, None, - ast_util::AutoSuffix).to_strbuf(), - ty_float(t) => ast_util::float_ty_to_str(t).to_strbuf(), + ast_util::AutoSuffix).to_string(), + ty_float(t) => ast_util::float_ty_to_str(t).to_string(), ty_box(typ) => format_strbuf!("@{}", ty_to_str(cx, typ)), ty_uniq(typ) => format_strbuf!("~{}", ty_to_str(cx, typ)), ty_ptr(ref tm) => format_strbuf!("*{}", mt_to_str(cx, tm)), @@ -378,11 +378,11 @@ pub fn ty_to_str(cx: &ctxt, typ: t) -> String { ty_bare_fn(ref f) => { bare_fn_to_str(cx, f.fn_style, f.abi, None, &f.sig) } - ty_infer(infer_ty) => infer_ty.to_str().to_strbuf(), - ty_err => "[type error]".to_strbuf(), + ty_infer(infer_ty) => infer_ty.to_str().to_string(), + ty_err => "[type error]".to_string(), ty_param(param_ty {idx: id, def_id: did}) => { let ident = match cx.ty_param_defs.borrow().find(&did.node) { - Some(def) => token::get_ident(def.ident).get().to_strbuf(), + Some(def) => token::get_ident(def.ident).get().to_string(), // This can only happen when a type mismatch error happens and // the actual type has more type parameters than the expected one. None => format_strbuf!("", id) @@ -393,7 +393,7 @@ pub fn ty_to_str(cx: &ctxt, typ: t) -> String { format_strbuf!("{}:{:?}", ident, did) } } - ty_self(..) => "Self".to_strbuf(), + ty_self(..) => "Self".to_string(), ty_enum(did, ref substs) | ty_struct(did, ref substs) => { let base = ty::item_path_str(cx, did); parameterized(cx, @@ -417,7 +417,7 @@ pub fn ty_to_str(cx: &ctxt, typ: t) -> String { bound_sep, bound_str) } - ty_str => "str".to_strbuf(), + ty_str => "str".to_string(), ty_vec(ref mt, sz) => { match sz { Some(n) => { @@ -483,9 +483,9 @@ pub fn parameterized(cx: &ctxt, } pub fn ty_to_short_str(cx: &ctxt, typ: t) -> String { - let mut s = typ.repr(cx).to_strbuf(); + let mut s = typ.repr(cx).to_string(); if s.len() >= 32u { - s = s.as_slice().slice(0u, 32u).to_strbuf(); + s = s.as_slice().slice(0u, 32u).to_string(); } return s; } @@ -493,7 +493,7 @@ pub fn ty_to_short_str(cx: &ctxt, typ: t) -> String { impl Repr for Option { fn repr(&self, tcx: &ctxt) -> String { match self { - &None => "None".to_strbuf(), + &None => "None".to_string(), &Some(ref t) => t.repr(tcx), } } @@ -510,7 +510,7 @@ impl Repr for Result { impl Repr for () { fn repr(&self, _tcx: &ctxt) -> String { - "()".to_strbuf() + "()".to_string() } } @@ -596,7 +596,7 @@ impl Repr for ty::ItemSubsts { impl Repr for ty::RegionSubsts { fn repr(&self, tcx: &ctxt) -> String { match *self { - ty::ErasedRegions => "erased".to_strbuf(), + ty::ErasedRegions => "erased".to_string(), ty::NonerasedRegions(ref regions) => regions.repr(tcx) } } @@ -607,17 +607,17 @@ impl Repr for ty::ParamBounds { let mut res = Vec::new(); for b in self.builtin_bounds.iter() { res.push(match b { - ty::BoundStatic => "'static".to_strbuf(), - ty::BoundSend => "Send".to_strbuf(), - ty::BoundSized => "Sized".to_strbuf(), - ty::BoundCopy => "Copy".to_strbuf(), - ty::BoundShare => "Share".to_strbuf(), + ty::BoundStatic => "'static".to_string(), + ty::BoundSend => "Send".to_string(), + ty::BoundSized => "Sized".to_string(), + ty::BoundCopy => "Copy".to_string(), + ty::BoundShare => "Share".to_string(), }); } for t in self.trait_bounds.iter() { res.push(t.repr(tcx)); } - res.connect("+").to_strbuf() + res.connect("+").to_string() } } @@ -694,7 +694,7 @@ impl Repr for ty::Region { } ty::ReStatic => { - "ReStatic".to_strbuf() + "ReStatic".to_string() } ty::ReInfer(ReVar(ref vid)) => { @@ -708,7 +708,7 @@ impl Repr for ty::Region { } ty::ReEmpty => { - "ReEmpty".to_strbuf() + "ReEmpty".to_string() } } } @@ -771,7 +771,7 @@ impl Repr for ty::ItemVariances { impl Repr for ty::Variance { fn repr(&self, _: &ctxt) -> String { - self.to_str().to_strbuf() + self.to_str().to_string() } } @@ -790,13 +790,13 @@ impl Repr for ty::Method { impl Repr for ast::Name { fn repr(&self, _tcx: &ctxt) -> String { - token::get_name(*self).get().to_strbuf() + token::get_name(*self).get().to_string() } } impl Repr for ast::Ident { fn repr(&self, _tcx: &ctxt) -> String { - token::get_ident(*self).get().to_strbuf() + token::get_ident(*self).get().to_string() } } @@ -893,11 +893,11 @@ impl Repr for ty::BuiltinBound { impl UserString for ty::BuiltinBound { fn user_string(&self, _tcx: &ctxt) -> String { match *self { - ty::BoundStatic => "'static".to_strbuf(), - ty::BoundSend => "Send".to_strbuf(), - ty::BoundSized => "Sized".to_strbuf(), - ty::BoundCopy => "Copy".to_strbuf(), - ty::BoundShare => "Share".to_strbuf(), + ty::BoundStatic => "'static".to_string(), + ty::BoundSend => "Send".to_string(), + ty::BoundSized => "Sized".to_string(), + ty::BoundCopy => "Copy".to_string(), + ty::BoundShare => "Share".to_string(), } } } @@ -910,7 +910,7 @@ impl Repr for ty::BuiltinBounds { impl Repr for Span { fn repr(&self, tcx: &ctxt) -> String { - tcx.sess.codemap().span_to_str(*self).to_strbuf() + tcx.sess.codemap().span_to_str(*self).to_string() } } @@ -927,7 +927,7 @@ impl UserString for ty::BuiltinBounds { .map(|bb| bb.user_string(tcx)) .collect::>() .connect("+") - .to_strbuf() + .to_string() } } @@ -962,19 +962,19 @@ impl UserString for ty::t { impl UserString for ast::Ident { fn user_string(&self, _tcx: &ctxt) -> String { - token::get_name(self.name).get().to_strbuf() + token::get_name(self.name).get().to_string() } } impl Repr for abi::Abi { fn repr(&self, _tcx: &ctxt) -> String { - self.to_str().to_strbuf() + self.to_str().to_string() } } impl UserString for abi::Abi { fn user_string(&self, _tcx: &ctxt) -> String { - self.to_str().to_strbuf() + self.to_str().to_string() } } diff --git a/src/librustc/util/sha2.rs b/src/librustc/util/sha2.rs index 187e37faf3ae3..f0d691823256d 100644 --- a/src/librustc/util/sha2.rs +++ b/src/librustc/util/sha2.rs @@ -259,7 +259,7 @@ pub trait Digest { /// Convenience function that retrieves the result of a digest as a /// String in hexadecimal format. fn result_str(&mut self) -> String { - self.result_bytes().as_slice().to_hex().to_strbuf() + self.result_bytes().as_slice().to_hex().to_string() } } @@ -578,21 +578,21 @@ mod tests { // Examples from wikipedia let wikipedia_tests = vec!( Test { - input: "".to_strbuf(), + input: "".to_string(), output_str: "e3b0c44298fc1c149afb\ - f4c8996fb92427ae41e4649b934ca495991b7852b855".to_strbuf() + f4c8996fb92427ae41e4649b934ca495991b7852b855".to_string() }, Test { input: "The quick brown fox jumps over the lazy \ - dog".to_strbuf(), + dog".to_string(), output_str: "d7a8fbb307d7809469ca\ - 9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592".to_strbuf() + 9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592".to_string() }, Test { input: "The quick brown fox jumps over the lazy \ - dog.".to_strbuf(), + dog.".to_string(), output_str: "ef537f25c895bfa78252\ - 6529a9b63d97aa631564d5d789c2b765448c8635fb6c".to_strbuf() + 6529a9b63d97aa631564d5d789c2b765448c8635fb6c".to_string() }); let tests = wikipedia_tests; diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index dd5fddca0db8a..c434087dd2b6c 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -87,7 +87,7 @@ fn try_inline_def(cx: &core::DocContext, let fqn = csearch::get_item_path(tcx, did); ret.push(clean::Item { source: clean::Span::empty(), - name: Some(fqn.last().unwrap().to_str().to_strbuf()), + name: Some(fqn.last().unwrap().to_str().to_string()), attrs: load_attrs(tcx, did), inner: inner, visibility: Some(ast::Public), @@ -123,7 +123,7 @@ pub fn record_extern_fqn(cx: &core::DocContext, match cx.maybe_typed { core::Typed(ref tcx) => { let fqn = csearch::get_item_path(tcx, did); - let fqn = fqn.move_iter().map(|i| i.to_str().to_strbuf()).collect(); + let fqn = fqn.move_iter().map(|i| i.to_str().to_string()).collect(); cx.external_paths.borrow_mut().get_mut_ref().insert(did, (fqn, kind)); } core::NotTyped(..) => {} diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index f0f6842642534..33e3e5370e69e 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -101,7 +101,7 @@ impl<'a> Clean for visit_ast::RustdocVisitor<'a> { let id = link::find_crate_id(self.attrs.as_slice(), t_outputs.out_filestem.as_slice()); Crate { - name: id.name.to_strbuf(), + name: id.name.to_string(), module: Some(self.module.clean()), externs: externs, } @@ -117,7 +117,7 @@ pub struct ExternalCrate { impl Clean for cstore::crate_metadata { fn clean(&self) -> ExternalCrate { ExternalCrate { - name: self.name.to_strbuf(), + name: self.name.to_string(), attrs: decoder::get_crate_attributes(self.data()).clean() .move_iter() .collect(), @@ -240,7 +240,7 @@ impl Clean for doctree::Module { let name = if self.name.is_some() { self.name.unwrap().clean() } else { - "".to_strbuf() + "".to_string() }; let mut foreigns = Vec::new(); for subforeigns in self.foreigns.clean().move_iter() { @@ -305,12 +305,12 @@ pub enum Attribute { impl Clean for ast::MetaItem { fn clean(&self) -> Attribute { match self.node { - ast::MetaWord(ref s) => Word(s.get().to_strbuf()), + ast::MetaWord(ref s) => Word(s.get().to_string()), ast::MetaList(ref s, ref l) => { - List(s.get().to_strbuf(), l.clean().move_iter().collect()) + List(s.get().to_string(), l.clean().move_iter().collect()) } ast::MetaNameValue(ref s, ref v) => { - NameValue(s.get().to_strbuf(), lit_to_str(v)) + NameValue(s.get().to_string(), lit_to_str(v)) } } } @@ -404,7 +404,7 @@ fn external_path(name: &str) -> Path { Path { global: false, segments: vec![PathSegment { - name: name.to_strbuf(), + name: name.to_string(), lifetimes: Vec::new(), types: Vec::new(), }] @@ -430,7 +430,7 @@ impl Clean for ty::BuiltinBound { (tcx.lang_items.share_trait().unwrap(), external_path("Share")), }; let fqn = csearch::get_item_path(tcx, did); - let fqn = fqn.move_iter().map(|i| i.to_str().to_strbuf()).collect(); + let fqn = fqn.move_iter().map(|i| i.to_str().to_string()).collect(); cx.external_paths.borrow_mut().get_mut_ref().insert(did, (fqn, TypeTrait)); TraitBound(ResolvedPath { @@ -449,7 +449,7 @@ impl Clean for ty::TraitRef { core::NotTyped(_) => return RegionBound, }; let fqn = csearch::get_item_path(tcx, self.def_id); - let fqn = fqn.move_iter().map(|i| i.to_str().to_strbuf()) + let fqn = fqn.move_iter().map(|i| i.to_str().to_string()) .collect::>(); let path = external_path(fqn.last().unwrap().as_slice()); cx.external_paths.borrow_mut().get_mut_ref().insert(self.def_id, @@ -503,22 +503,22 @@ impl Lifetime { impl Clean for ast::Lifetime { fn clean(&self) -> Lifetime { - Lifetime(token::get_name(self.name).get().to_strbuf()) + Lifetime(token::get_name(self.name).get().to_string()) } } impl Clean for ty::RegionParameterDef { fn clean(&self) -> Lifetime { - Lifetime(token::get_name(self.name).get().to_strbuf()) + Lifetime(token::get_name(self.name).get().to_string()) } } impl Clean> for ty::Region { fn clean(&self) -> Option { match *self { - ty::ReStatic => Some(Lifetime("static".to_strbuf())), + ty::ReStatic => Some(Lifetime("static".to_string())), ty::ReLateBound(_, ty::BrNamed(_, name)) => - Some(Lifetime(token::get_name(name).get().to_strbuf())), + Some(Lifetime(token::get_name(name).get().to_string())), ty::ReLateBound(..) | ty::ReEarlyBound(..) | @@ -749,7 +749,7 @@ impl<'a> Clean for (ast::DefId, &'a ty::FnSig) { Argument { type_: t.clean(), id: 0, - name: names.next().unwrap_or("".to_strbuf()), + name: names.next().unwrap_or("".to_string()), } }).collect(), }, @@ -1013,7 +1013,7 @@ impl Clean for ty::t { lifetimes: Vec::new(), type_params: Vec::new() }, decl: (ast_util::local_def(0), &fty.sig).clean(), - abi: fty.abi.to_str().to_strbuf(), + abi: fty.abi.to_str(), }), ty::ty_closure(ref fty) => { let decl = box ClosureDecl { @@ -1038,7 +1038,7 @@ impl Clean for ty::t { }; let fqn = csearch::get_item_path(tcx, did); let fqn: Vec = fqn.move_iter().map(|i| { - i.to_str().to_strbuf() + i.to_str().to_string() }).collect(); let mut path = external_path(fqn.last() .unwrap() @@ -1302,7 +1302,7 @@ pub struct Span { impl Span { fn empty() -> Span { Span { - filename: "".to_strbuf(), + filename: "".to_string(), loline: 0, locol: 0, hiline: 0, hicol: 0, } @@ -1317,7 +1317,7 @@ impl Clean for syntax::codemap::Span { let lo = cm.lookup_char_pos(self.lo); let hi = cm.lookup_char_pos(self.hi); Span { - filename: filename.to_strbuf(), + filename: filename.to_string(), loline: lo.line, locol: lo.col.to_uint(), hiline: hi.line, @@ -1376,13 +1376,13 @@ fn path_to_str(p: &ast::Path) -> String { impl Clean for ast::Ident { fn clean(&self) -> String { - token::get_ident(*self).get().to_strbuf() + token::get_ident(*self).get().to_string() } } impl Clean for ast::Name { fn clean(&self) -> String { - token::get_name(*self).get().to_strbuf() + token::get_name(*self).get().to_string() } } @@ -1425,7 +1425,7 @@ impl Clean for ast::BareFnTy { type_params: Vec::new(), }, decl: self.decl.clean(), - abi: self.abi.to_str().to_strbuf(), + abi: self.abi.to_str().to_string(), } } } @@ -1582,7 +1582,7 @@ impl Clean for ast::ViewItem_ { &ast::ViewItemExternCrate(ref i, ref p, ref id) => { let string = match *p { None => None, - Some((ref x, _)) => Some(x.get().to_strbuf()), + Some((ref x, _)) => Some(x.get().to_string()), }; ExternCrate(i.clean(), string, *id) } @@ -1659,7 +1659,7 @@ impl Clean for ast::ForeignItem { ForeignStaticItem(Static { type_: ty.clean(), mutability: if mutbl {Mutable} else {Immutable}, - expr: "".to_strbuf(), + expr: "".to_string(), }) } }; @@ -1686,8 +1686,8 @@ impl ToSource for syntax::codemap::Span { let ctxt = super::ctxtkey.get().unwrap(); let cm = ctxt.sess().codemap().clone(); let sn = match cm.span_to_snippet(*self) { - Some(x) => x.to_strbuf(), - None => "".to_strbuf() + Some(x) => x.to_string(), + None => "".to_string() }; debug!("got snippet {}", sn); sn @@ -1696,16 +1696,16 @@ impl ToSource for syntax::codemap::Span { fn lit_to_str(lit: &ast::Lit) -> String { match lit.node { - ast::LitStr(ref st, _) => st.get().to_strbuf(), + ast::LitStr(ref st, _) => st.get().to_string(), ast::LitBinary(ref data) => format_strbuf!("{:?}", data.as_slice()), ast::LitChar(c) => format_strbuf!("'{}'", c), - ast::LitInt(i, _t) => i.to_str().to_strbuf(), - ast::LitUint(u, _t) => u.to_str().to_strbuf(), - ast::LitIntUnsuffixed(i) => i.to_str().to_strbuf(), - ast::LitFloat(ref f, _t) => f.get().to_strbuf(), - ast::LitFloatUnsuffixed(ref f) => f.get().to_strbuf(), - ast::LitBool(b) => b.to_str().to_strbuf(), - ast::LitNil => "".to_strbuf(), + ast::LitInt(i, _t) => i.to_str().to_string(), + ast::LitUint(u, _t) => u.to_str().to_string(), + ast::LitIntUnsuffixed(i) => i.to_str().to_string(), + ast::LitFloat(ref f, _t) => f.get().to_string(), + ast::LitFloatUnsuffixed(ref f) => f.get().to_string(), + ast::LitBool(b) => b.to_str().to_string(), + ast::LitNil => "".to_string(), } } @@ -1714,19 +1714,19 @@ fn name_from_pat(p: &ast::Pat) -> String { debug!("Trying to get a name from pattern: {:?}", p); match p.node { - PatWild => "_".to_strbuf(), - PatWildMulti => "..".to_strbuf(), + PatWild => "_".to_string(), + PatWildMulti => "..".to_string(), PatIdent(_, ref p, _) => path_to_str(p), PatEnum(ref p, _) => path_to_str(p), PatStruct(..) => fail!("tried to get argument name from pat_struct, \ which is not allowed in function arguments"), - PatTup(..) => "(tuple arg NYI)".to_strbuf(), + PatTup(..) => "(tuple arg NYI)".to_string(), PatUniq(p) => name_from_pat(p), PatRegion(p) => name_from_pat(p), PatLit(..) => { warn!("tried to get argument name from PatLit, \ which is silly in function arguments"); - "()".to_strbuf() + "()".to_string() }, PatRange(..) => fail!("tried to get argument name from PatRange, \ which is not allowed in function arguments"), diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 625ee8f418caa..c1b5b8af07af6 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -151,12 +151,12 @@ fn resolved_path(w: &mut fmt::Formatter, did: ast::DefId, p: &clean::Path, path(w, p, print_all, |cache, loc| { if ast_util::is_local(did) || cache.paths.contains_key(&did) { - Some(("../".repeat(loc.len())).to_strbuf()) + Some(("../".repeat(loc.len())).to_string()) } else { match *cache.extern_locations.get(&did.krate) { - render::Remote(ref s) => Some(s.to_strbuf()), + render::Remote(ref s) => Some(s.to_string()), render::Local => { - Some(("../".repeat(loc.len())).to_strbuf()) + Some(("../".repeat(loc.len())).to_string()) } render::Unknown => None, } @@ -323,7 +323,7 @@ impl fmt::Show for clean::Type { {arrow, select, yes{ -> {ret}} other{}}", style = FnStyleSpace(decl.fn_style), lifetimes = if decl.lifetimes.len() == 0 { - "".to_strbuf() + "".to_string() } else { format!("<{:#}>", decl.lifetimes) }, @@ -364,17 +364,17 @@ impl fmt::Show for clean::Type { {arrow, select, yes{ -> {ret}} other{}}", style = FnStyleSpace(decl.fn_style), lifetimes = if decl.lifetimes.len() == 0 { - "".to_strbuf() + "".to_string() } else { format_strbuf!("<{:#}>", decl.lifetimes) }, args = decl.decl.inputs, bounds = if decl.bounds.len() == 0 { - "".to_strbuf() + "".to_string() } else { let mut m = decl.bounds .iter() - .map(|s| s.to_str().to_strbuf()); + .map(|s| s.to_str().to_string()); format_strbuf!( ": {}", m.collect::>().connect(" + ")) @@ -386,8 +386,8 @@ impl fmt::Show for clean::Type { write!(f, "{}{}fn{}{}", FnStyleSpace(decl.fn_style), match decl.abi.as_slice() { - "" => " extern ".to_strbuf(), - "\"Rust\"" => "".to_strbuf(), + "" => " extern ".to_string(), + "\"Rust\"" => "".to_string(), s => format_strbuf!(" extern {} ", s) }, decl.generics, @@ -423,7 +423,7 @@ impl fmt::Show for clean::Type { clean::BorrowedRef{ lifetime: ref l, mutability, type_: ref ty} => { let lt = match *l { Some(ref l) => format!("{} ", *l), - _ => "".to_strbuf(), + _ => "".to_string(), }; write!(f, "&{}{}{}", lt, diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index 65ef404473f18..1f3ed01092858 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -29,15 +29,15 @@ pub fn highlight(src: &str, class: Option<&str>) -> String { debug!("highlighting: ================\n{}\n==============", src); let sess = parse::new_parse_sess(); let fm = parse::string_to_filemap(&sess, - src.to_strbuf(), - "".to_strbuf()); + src.to_string(), + "".to_string()); let mut out = io::MemWriter::new(); doit(&sess, lexer::new_string_reader(&sess.span_diagnostic, fm), class, &mut out).unwrap(); - str::from_utf8_lossy(out.unwrap().as_slice()).to_strbuf() + str::from_utf8_lossy(out.unwrap().as_slice()).to_string() } /// Exhausts the `lexer` writing the output into `out`. diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 80caad8486372..d1153db8d30db 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -207,14 +207,14 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result { // Transform the contents of the header into a hyphenated string let id = (s.as_slice().words().map(|s| { match s.to_ascii_opt() { - Some(s) => s.to_lower().into_str().to_strbuf(), - None => s.to_strbuf() + Some(s) => s.to_lower().into_str().to_string(), + None => s.to_string() } - }).collect::>().connect("-")).to_strbuf(); + }).collect::>().connect("-")).to_string(); // This is a terrible hack working around how hoedown gives us rendered // html for text rather than the raw text. - let id = id.replace("", "").replace("", "").to_strbuf(); + let id = id.replace("", "").replace("", "").to_string(); let opaque = opaque as *mut hoedown_html_renderer_state; let opaque = unsafe { &mut *((*opaque).opaque as *mut MyOpaque) }; @@ -229,7 +229,7 @@ pub fn render(w: &mut fmt::Formatter, s: &str, print_toc: bool) -> fmt::Result { let sec = match opaque.toc_builder { Some(ref mut builder) => { - builder.push(level as u32, s.to_strbuf(), id.clone()) + builder.push(level as u32, s.to_string(), id.clone()) } None => {""} }; @@ -302,7 +302,7 @@ pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector) { stripped_filtered_line(l).unwrap_or(l) }); let text = lines.collect::>().connect("\n"); - tests.add_test(text.to_strbuf(), should_fail, no_run, ignore); + tests.add_test(text.to_string(), should_fail, no_run, ignore); }) } } diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index ecbda89ee6101..a23aefe03e813 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -218,8 +218,8 @@ pub fn run(mut krate: clean::Crate, dst: Path) -> io::IoResult<()> { root_path: String::new(), sidebar: HashMap::new(), layout: layout::Layout { - logo: "".to_strbuf(), - favicon: "".to_strbuf(), + logo: "".to_string(), + favicon: "".to_string(), krate: krate.name.clone(), }, include_sources: true, @@ -232,11 +232,11 @@ pub fn run(mut krate: clean::Crate, dst: Path) -> io::IoResult<()> { match *attr { clean::NameValue(ref x, ref s) if "html_favicon_url" == x.as_slice() => { - cx.layout.favicon = s.to_strbuf(); + cx.layout.favicon = s.to_string(); } clean::NameValue(ref x, ref s) if "html_logo_url" == x.as_slice() => { - cx.layout.logo = s.to_strbuf(); + cx.layout.logo = s.to_string(); } clean::Word(ref x) if "html_no_source" == x.as_slice() => { @@ -307,8 +307,8 @@ pub fn run(mut krate: clean::Crate, dst: Path) -> io::IoResult<()> { ty: shortty(item), name: item.name.clone().unwrap(), path: fqp.slice_to(fqp.len() - 1).connect("::") - .to_strbuf(), - desc: shorter(item.doc_value()).to_strbuf(), + .to_string(), + desc: shorter(item.doc_value()).to_string(), parent: Some(did), }); }, @@ -338,14 +338,14 @@ pub fn run(mut krate: clean::Crate, dst: Path) -> io::IoResult<()> { let mut w = MemWriter::new(); try!(write!(&mut w, r#"searchIndex['{}'] = \{"items":["#, krate.name)); - let mut lastpath = "".to_strbuf(); + let mut lastpath = "".to_string(); for (i, item) in cache.search_index.iter().enumerate() { // Omit the path if it is same to that of the prior item. let path; if lastpath.as_slice() == item.path.as_slice() { path = ""; } else { - lastpath = item.path.to_strbuf(); + lastpath = item.path.to_string(); path = item.path.as_slice(); }; @@ -420,7 +420,7 @@ pub fn run(mut krate: clean::Crate, dst: Path) -> io::IoResult<()> { format!("{}['{}']", key, krate).as_slice()) { continue } - ret.push(line.to_strbuf()); + ret.push(line.to_string()); } } return Ok(ret); @@ -504,14 +504,14 @@ pub fn run(mut krate: clean::Crate, dst: Path) -> io::IoResult<()> { cx: &mut cx, }; // skip all invalid spans - folder.seen.insert("".to_strbuf()); + folder.seen.insert("".to_string()); krate = folder.fold_crate(krate); } for &(n, ref e) in krate.externs.iter() { cache.extern_locations.insert(n, extern_location(e, &cx.dst)); let did = ast::DefId { krate: n, node: ast::CRATE_NODE_ID }; - cache.paths.insert(did, (vec![e.name.to_strbuf()], item_type::Module)); + cache.paths.insert(did, (vec![e.name.to_string()], item_type::Module)); } // And finally render the whole crate's documentation @@ -570,7 +570,7 @@ fn extern_location(e: &clean::ExternalCrate, dst: &Path) -> ExternalLocation { clean::NameValue(ref x, ref s) if "html_root_url" == x.as_slice() => { if s.as_slice().ends_with("/") { - return Remote(s.to_strbuf()); + return Remote(s.to_string()); } return Remote(format_strbuf!("{}/", s)); } @@ -766,9 +766,9 @@ impl DocFolder for Cache { (parent, Some(path)) if !self.privmod => { self.search_index.push(IndexItem { ty: shortty(&item), - name: s.to_strbuf(), - path: path.connect("::").to_strbuf(), - desc: shorter(item.doc_value()).to_strbuf(), + name: s.to_string(), + path: path.connect("::").to_string(), + desc: shorter(item.doc_value()).to_string(), parent: parent, }); } @@ -789,7 +789,7 @@ impl DocFolder for Cache { let pushed = if item.name.is_some() { let n = item.name.get_ref(); if n.len() > 0 { - self.stack.push(n.to_strbuf()); + self.stack.push(n.to_string()); true } else { false } } else { false }; @@ -1001,7 +1001,7 @@ impl Context { // modules are special because they add a namespace. We also need to // recurse into the items of the module as well. clean::ModuleItem(..) => { - let name = item.name.get_ref().to_strbuf(); + let name = item.name.get_ref().to_string(); let mut item = Some(item); self.recurse(name, |this| { let item = item.take_unwrap(); @@ -1908,9 +1908,9 @@ fn build_sidebar(m: &clean::Module) -> HashMap> { let short = shortty(item).to_static_str(); let myname = match item.name { None => continue, - Some(ref s) => s.to_strbuf(), + Some(ref s) => s.to_string(), }; - let v = map.find_or_insert_with(short.to_strbuf(), |_| Vec::new()); + let v = map.find_or_insert_with(short.to_string(), |_| Vec::new()); v.push(myname); } diff --git a/src/librustdoc/html/toc.rs b/src/librustdoc/html/toc.rs index d499ab580ec41..212fe006aa1be 100644 --- a/src/librustdoc/html/toc.rs +++ b/src/librustdoc/html/toc.rs @@ -202,8 +202,8 @@ mod test { macro_rules! push { ($level: expr, $name: expr) => { assert_eq!(builder.push($level, - $name.to_strbuf(), - "".to_strbuf()), + $name.to_string(), + "".to_string()), $name); } } @@ -242,9 +242,9 @@ mod test { $( TocEntry { level: $level, - name: $name.to_strbuf(), - sec_number: $name.to_strbuf(), - id: "".to_strbuf(), + name: $name.to_string(), + sec_number: $name.to_string(), + id: "".to_string(), children: toc!($($sub),*) } ),* diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index abc6d526cd91d..160994f603aa3 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -86,7 +86,7 @@ type Output = (clean::Crate, Vec ); pub fn main() { std::os::set_exit_status(main_args(std::os::args().iter() - .map(|x| x.to_strbuf()) + .map(|x| x.to_string()) .collect::>() .as_slice())); } @@ -166,7 +166,7 @@ pub fn main_args(args: &[String]) -> int { let test_args = matches.opt_strs("test-args"); let test_args: Vec = test_args.iter() .flat_map(|s| s.as_slice().words()) - .map(|s| s.to_strbuf()) + .map(|s| s.to_string()) .collect(); let should_test = matches.opt_present("test"); @@ -184,7 +184,7 @@ pub fn main_args(args: &[String]) -> int { (true, false) => { return test::run(input, cfgs.move_iter() - .map(|x| x.to_strbuf()) + .map(|x| x.to_string()) .collect(), libs, test_args) @@ -194,7 +194,7 @@ pub fn main_args(args: &[String]) -> int { (false, false) => {} } - if matches.opt_strs("passes").as_slice() == &["list".to_strbuf()] { + if matches.opt_strs("passes").as_slice() == &["list".to_string()] { println!("Available passes for running rustdoc:"); for &(name, _, description) in PASSES.iter() { println!("{:>20s} - {}", name, description); @@ -268,7 +268,7 @@ fn rust_input(cratefile: &str, matches: &getopts::Matches) -> Output { let mut passes = matches.opt_strs("passes"); let mut plugins = matches.opt_strs("plugins") .move_iter() - .map(|x| x.to_strbuf()) + .map(|x| x.to_string()) .collect::>(); // First, parse the crate and extract all relevant information. @@ -282,7 +282,7 @@ fn rust_input(cratefile: &str, matches: &getopts::Matches) -> Output { let (krate, analysis) = std::task::try(proc() { let cr = cr; core::run_core(libs.move_iter().map(|x| x.clone()).collect(), - cfgs.move_iter().map(|x| x.to_strbuf()).collect(), + cfgs.move_iter().map(|x| x.to_string()).collect(), &cr) }).map_err(|boxed_any|format!("{:?}", boxed_any)).unwrap(); info!("finished with rustc"); @@ -301,13 +301,13 @@ fn rust_input(cratefile: &str, matches: &getopts::Matches) -> Output { clean::NameValue(ref x, ref value) if "passes" == x.as_slice() => { for pass in value.as_slice().words() { - passes.push(pass.to_strbuf()); + passes.push(pass.to_string()); } } clean::NameValue(ref x, ref value) if "plugins" == x.as_slice() => { for p in value.as_slice().words() { - plugins.push(p.to_strbuf()); + plugins.push(p.to_string()); } } _ => {} @@ -318,13 +318,13 @@ fn rust_input(cratefile: &str, matches: &getopts::Matches) -> Output { } if default_passes { for name in DEFAULT_PASSES.iter().rev() { - passes.unshift(name.to_strbuf()); + passes.unshift(name.to_string()); } } // Load all plugins/passes into a PluginManager let path = matches.opt_str("plugin-path") - .unwrap_or("/tmp/rustdoc/plugins".to_strbuf()); + .unwrap_or("/tmp/rustdoc/plugins".to_string()); let mut pm = plugins::PluginManager::new(Path::new(path)); for pass in passes.iter() { let plugin = match PASSES.iter() @@ -359,11 +359,11 @@ fn json_input(input: &str) -> Result { } }; match json::from_reader(&mut input) { - Err(s) => Err(s.to_str().to_strbuf()), + Err(s) => Err(s.to_str().to_string()), Ok(json::Object(obj)) => { let mut obj = obj; // Make sure the schema is what we expect - match obj.pop(&"schema".to_strbuf()) { + match obj.pop(&"schema".to_string()) { Some(json::String(version)) => { if version.as_slice() != SCHEMA_VERSION { return Err(format_strbuf!( @@ -371,15 +371,15 @@ fn json_input(input: &str) -> Result { SCHEMA_VERSION)) } } - Some(..) => return Err("malformed json".to_strbuf()), - None => return Err("expected a schema version".to_strbuf()), + Some(..) => return Err("malformed json".to_string()), + None => return Err("expected a schema version".to_string()), } - let krate = match obj.pop(&"crate".to_strbuf()) { + let krate = match obj.pop(&"crate".to_string()) { Some(json) => { let mut d = json::Decoder::new(json); Decodable::decode(&mut d).unwrap() } - None => return Err("malformed json".to_strbuf()), + None => return Err("malformed json".to_string()), }; // FIXME: this should read from the "plugins" field, but currently // Json doesn't implement decodable... @@ -388,7 +388,7 @@ fn json_input(input: &str) -> Result { } Ok(..) => { Err("malformed json input: expected an object at the \ - top".to_strbuf()) + top".to_string()) } } } @@ -403,14 +403,14 @@ fn json_output(krate: clean::Crate, res: Vec , // "plugins": { output of plugins ... } // } let mut json = box collections::TreeMap::new(); - json.insert("schema".to_strbuf(), - json::String(SCHEMA_VERSION.to_strbuf())); + json.insert("schema".to_string(), + json::String(SCHEMA_VERSION.to_string())); let plugins_json = box res.move_iter() .filter_map(|opt| { match opt { None => None, Some((string, json)) => { - Some((string.to_strbuf(), json)) + Some((string.to_string(), json)) } } }).collect(); @@ -423,15 +423,15 @@ fn json_output(krate: clean::Crate, res: Vec , let mut encoder = json::Encoder::new(&mut w as &mut io::Writer); krate.encode(&mut encoder).unwrap(); } - str::from_utf8(w.unwrap().as_slice()).unwrap().to_strbuf() + str::from_utf8(w.unwrap().as_slice()).unwrap().to_string() }; let crate_json = match json::from_str(crate_json_str.as_slice()) { Ok(j) => j, Err(e) => fail!("Rust generated JSON is invalid: {:?}", e) }; - json.insert("crate".to_strbuf(), crate_json); - json.insert("plugins".to_strbuf(), json::Object(plugins_json)); + json.insert("crate".to_string(), crate_json); + json.insert("plugins".to_string(), json::Object(plugins_json)); let mut file = try!(File::create(&dst)); try!(json::Object(json).to_writer(&mut file)); diff --git a/src/librustdoc/markdown.rs b/src/librustdoc/markdown.rs index 80e4214f15906..f5cfc840562b4 100644 --- a/src/librustdoc/markdown.rs +++ b/src/librustdoc/markdown.rs @@ -22,7 +22,7 @@ use test::Collector; fn load_string(input: &Path) -> io::IoResult> { let mut f = try!(io::File::open(input)); let d = try!(f.read_to_end()); - Ok(str::from_utf8(d.as_slice()).map(|s| s.to_strbuf())) + Ok(str::from_utf8(d.as_slice()).map(|s| s.to_string())) } macro_rules! load_or_return { ($input: expr, $cant_read: expr, $not_utf8: expr) => { @@ -88,17 +88,17 @@ pub fn render(input: &str, mut output: Path, matches: &getopts::Matches) -> int let (in_header, before_content, after_content) = match (load_external_files(matches.opt_strs("markdown-in-header") .move_iter() - .map(|x| x.to_strbuf()) + .map(|x| x.to_string()) .collect::>() .as_slice()), load_external_files(matches.opt_strs("markdown-before-content") .move_iter() - .map(|x| x.to_strbuf()) + .map(|x| x.to_string()) .collect::>() .as_slice()), load_external_files(matches.opt_strs("markdown-after-content") .move_iter() - .map(|x| x.to_strbuf()) + .map(|x| x.to_string()) .collect::>() .as_slice())) { (Some(a), Some(b), Some(c)) => (a,b,c), @@ -173,9 +173,9 @@ pub fn render(input: &str, mut output: Path, matches: &getopts::Matches) -> int pub fn test(input: &str, libs: HashSet, mut test_args: Vec) -> int { let input_str = load_or_return!(input, 1, 2); - let mut collector = Collector::new(input.to_strbuf(), libs, true, true); + let mut collector = Collector::new(input.to_string(), libs, true, true); find_testable_code(input_str.as_slice(), &mut collector); - test_args.unshift("rustdoctest".to_strbuf()); + test_args.unshift("rustdoctest".to_string()); testing::test_main(test_args.as_slice(), collector.tests); 0 } diff --git a/src/librustdoc/passes.rs b/src/librustdoc/passes.rs index ea58f1f3fc647..efb0689404a5d 100644 --- a/src/librustdoc/passes.rs +++ b/src/librustdoc/passes.rs @@ -233,7 +233,7 @@ pub fn unindent_comments(krate: clean::Crate) -> plugins::PluginResult { match attr { &clean::NameValue(ref x, ref s) if "doc" == x.as_slice() => { - avec.push(clean::NameValue("doc".to_strbuf(), + avec.push(clean::NameValue("doc".to_string(), unindent(s.as_slice()))) } x => avec.push(x.clone()) @@ -269,7 +269,7 @@ pub fn collapse_docs(krate: clean::Crate) -> plugins::PluginResult { _ => true }).map(|x| x.clone()).collect(); if docstr.len() > 0 { - a.push(clean::NameValue("doc".to_strbuf(), docstr)); + a.push(clean::NameValue("doc".to_string(), docstr)); } i.attrs = a; self.fold_item_recur(i) @@ -325,18 +325,18 @@ pub fn unindent(s: &str) -> String { }); if lines.len() >= 1 { - let mut unindented = vec![ lines.get(0).trim().to_strbuf() ]; + let mut unindented = vec![ lines.get(0).trim().to_string() ]; unindented.push_all(lines.tail().iter().map(|&line| { if line.is_whitespace() { - line.to_strbuf() + line.to_string() } else { assert!(line.len() >= min_indent); - line.slice_from(min_indent).to_strbuf() + line.slice_from(min_indent).to_string() } }).collect::>().as_slice()); - unindented.connect("\n").to_strbuf() + unindented.connect("\n").to_string() } else { - s.to_strbuf() + s.to_string() } } diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index b24e1f238b775..4023010537e72 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -87,13 +87,13 @@ pub fn run(input: &str, let (krate, _) = passes::unindent_comments(krate); let (krate, _) = passes::collapse_docs(krate); - let mut collector = Collector::new(krate.name.to_strbuf(), + let mut collector = Collector::new(krate.name.to_string(), libs, false, false); collector.fold_crate(krate); - test_args.unshift("rustdoctest".to_strbuf()); + test_args.unshift("rustdoctest".to_string()); testing::test_main(test_args.as_slice(), collector.tests.move_iter().collect()); @@ -103,7 +103,7 @@ pub fn run(input: &str, fn runtest(test: &str, cratename: &str, libs: HashSet, should_fail: bool, no_run: bool, loose_feature_gating: bool) { let test = maketest(test, cratename, loose_feature_gating); - let input = driver::StrInput(test.to_strbuf()); + let input = driver::StrInput(test.to_string()); let sessopts = config::Options { maybe_sysroot: Some(os::self_exe_path().unwrap().dir_path()), @@ -309,7 +309,7 @@ impl DocFolder for Collector { fn fold_item(&mut self, item: clean::Item) -> Option { let pushed = match item.name { Some(ref name) if name.len() == 0 => false, - Some(ref name) => { self.names.push(name.to_strbuf()); true } + Some(ref name) => { self.names.push(name.to_string()); true } None => false }; match item.doc_value() { diff --git a/src/librustuv/lib.rs b/src/librustuv/lib.rs index 122b8785507d6..4bae9bb797a72 100644 --- a/src/librustuv/lib.rs +++ b/src/librustuv/lib.rs @@ -359,7 +359,7 @@ impl UvError { let inner = match self { &UvError(a) => a }; let name_str = uvll::uv_err_name(inner); assert!(name_str.is_not_null()); - from_c_str(name_str).to_strbuf() + from_c_str(name_str).to_string() } } @@ -368,7 +368,7 @@ impl UvError { let inner = match self { &UvError(a) => a }; let desc_str = uvll::uv_strerror(inner); assert!(desc_str.is_not_null()); - from_c_str(desc_str).to_strbuf() + from_c_str(desc_str).to_string() } } @@ -387,7 +387,7 @@ impl fmt::Show for UvError { #[test] fn error_smoke_test() { let err: UvError = UvError(uvll::EOF); - assert_eq!(err.to_str(), "EOF: end of file".to_strbuf()); + assert_eq!(err.to_str(), "EOF: end of file".to_string()); } pub fn uv_error_to_io_error(uverr: UvError) -> IoError { diff --git a/src/librustuv/net.rs b/src/librustuv/net.rs index 9c77c7eb56be3..e533120b3dd00 100644 --- a/src/librustuv/net.rs +++ b/src/librustuv/net.rs @@ -851,7 +851,7 @@ mod test { fn connect_close_ip4() { match TcpWatcher::connect(local_loop(), next_test_ip4(), None) { Ok(..) => fail!(), - Err(e) => assert_eq!(e.name(), "ECONNREFUSED".to_strbuf()), + Err(e) => assert_eq!(e.name(), "ECONNREFUSED".to_string()), } } @@ -859,7 +859,7 @@ mod test { fn connect_close_ip6() { match TcpWatcher::connect(local_loop(), next_test_ip6(), None) { Ok(..) => fail!(), - Err(e) => assert_eq!(e.name(), "ECONNREFUSED".to_strbuf()), + Err(e) => assert_eq!(e.name(), "ECONNREFUSED".to_string()), } } diff --git a/src/librustuv/pipe.rs b/src/librustuv/pipe.rs index cf3035c742c36..cf3d4f672e618 100644 --- a/src/librustuv/pipe.rs +++ b/src/librustuv/pipe.rs @@ -338,7 +338,7 @@ mod tests { fn bind_err() { match PipeListener::bind(local_loop(), &"path/to/nowhere".to_c_str()) { Ok(..) => fail!(), - Err(e) => assert_eq!(e.name(), "EACCES".to_strbuf()), + Err(e) => assert_eq!(e.name(), "EACCES".to_string()), } } diff --git a/src/libsemver/lib.rs b/src/libsemver/lib.rs index fea473f35b4a1..a119d4832db45 100644 --- a/src/libsemver/lib.rs +++ b/src/libsemver/lib.rs @@ -308,14 +308,14 @@ fn test_parse() { major: 1u, minor: 2u, patch: 3u, - pre: vec!(AlphaNumeric("alpha1".to_strbuf())), + pre: vec!(AlphaNumeric("alpha1".to_string())), build: vec!(), })); assert!(parse(" 1.2.3-alpha1 ") == Some(Version { major: 1u, minor: 2u, patch: 3u, - pre: vec!(AlphaNumeric("alpha1".to_strbuf())), + pre: vec!(AlphaNumeric("alpha1".to_string())), build: vec!() })); assert!(parse("1.2.3+build5") == Some(Version { @@ -323,37 +323,37 @@ fn test_parse() { minor: 2u, patch: 3u, pre: vec!(), - build: vec!(AlphaNumeric("build5".to_strbuf())) + build: vec!(AlphaNumeric("build5".to_string())) })); assert!(parse(" 1.2.3+build5 ") == Some(Version { major: 1u, minor: 2u, patch: 3u, pre: vec!(), - build: vec!(AlphaNumeric("build5".to_strbuf())) + build: vec!(AlphaNumeric("build5".to_string())) })); assert!(parse("1.2.3-alpha1+build5") == Some(Version { major: 1u, minor: 2u, patch: 3u, - pre: vec!(AlphaNumeric("alpha1".to_strbuf())), - build: vec!(AlphaNumeric("build5".to_strbuf())) + pre: vec!(AlphaNumeric("alpha1".to_string())), + build: vec!(AlphaNumeric("build5".to_string())) })); assert!(parse(" 1.2.3-alpha1+build5 ") == Some(Version { major: 1u, minor: 2u, patch: 3u, - pre: vec!(AlphaNumeric("alpha1".to_strbuf())), - build: vec!(AlphaNumeric("build5".to_strbuf())) + pre: vec!(AlphaNumeric("alpha1".to_string())), + build: vec!(AlphaNumeric("build5".to_string())) })); assert!(parse("1.2.3-1.alpha1.9+build5.7.3aedf ") == Some(Version { major: 1u, minor: 2u, patch: 3u, - pre: vec!(Numeric(1),AlphaNumeric("alpha1".to_strbuf()),Numeric(9)), - build: vec!(AlphaNumeric("build5".to_strbuf()), + pre: vec!(Numeric(1),AlphaNumeric("alpha1".to_string()),Numeric(9)), + build: vec!(AlphaNumeric("build5".to_string()), Numeric(7), - AlphaNumeric("3aedf".to_strbuf())) + AlphaNumeric("3aedf".to_string())) })); } @@ -378,13 +378,13 @@ fn test_ne() { #[test] fn test_show() { assert_eq!(format_strbuf!("{}", parse("1.2.3").unwrap()), - "1.2.3".to_strbuf()); + "1.2.3".to_string()); assert_eq!(format_strbuf!("{}", parse("1.2.3-alpha1").unwrap()), - "1.2.3-alpha1".to_strbuf()); + "1.2.3-alpha1".to_string()); assert_eq!(format_strbuf!("{}", parse("1.2.3+build.42").unwrap()), - "1.2.3+build.42".to_strbuf()); + "1.2.3+build.42".to_string()); assert_eq!(format_strbuf!("{}", parse("1.2.3-alpha1+42").unwrap()), - "1.2.3-alpha1+42".to_strbuf()); + "1.2.3-alpha1+42".to_string()); } #[test] diff --git a/src/libserialize/base64.rs b/src/libserialize/base64.rs index 61ba36eeb1f34..5d2f229beb675 100644 --- a/src/libserialize/base64.rs +++ b/src/libserialize/base64.rs @@ -146,7 +146,7 @@ impl<'a> ToBase64 for &'a [u8] { } unsafe { - str::raw::from_utf8(v.as_slice()).to_strbuf() + str::raw::from_utf8(v.as_slice()).to_string() } } } @@ -267,13 +267,13 @@ mod tests { #[test] fn test_to_base64_basic() { - assert_eq!("".as_bytes().to_base64(STANDARD), "".to_strbuf()); - assert_eq!("f".as_bytes().to_base64(STANDARD), "Zg==".to_strbuf()); - assert_eq!("fo".as_bytes().to_base64(STANDARD), "Zm8=".to_strbuf()); - assert_eq!("foo".as_bytes().to_base64(STANDARD), "Zm9v".to_strbuf()); - assert_eq!("foob".as_bytes().to_base64(STANDARD), "Zm9vYg==".to_strbuf()); - assert_eq!("fooba".as_bytes().to_base64(STANDARD), "Zm9vYmE=".to_strbuf()); - assert_eq!("foobar".as_bytes().to_base64(STANDARD), "Zm9vYmFy".to_strbuf()); + assert_eq!("".as_bytes().to_base64(STANDARD), "".to_string()); + assert_eq!("f".as_bytes().to_base64(STANDARD), "Zg==".to_string()); + assert_eq!("fo".as_bytes().to_base64(STANDARD), "Zm8=".to_string()); + assert_eq!("foo".as_bytes().to_base64(STANDARD), "Zm9v".to_string()); + assert_eq!("foob".as_bytes().to_base64(STANDARD), "Zm9vYg==".to_string()); + assert_eq!("fooba".as_bytes().to_base64(STANDARD), "Zm9vYmE=".to_string()); + assert_eq!("foobar".as_bytes().to_base64(STANDARD), "Zm9vYmFy".to_string()); } #[test] @@ -283,19 +283,19 @@ mod tests { .contains("\r\n")); assert_eq!("foobar".as_bytes().to_base64(Config {line_length: Some(4), ..STANDARD}), - "Zm9v\r\nYmFy".to_strbuf()); + "Zm9v\r\nYmFy".to_string()); } #[test] fn test_to_base64_padding() { - assert_eq!("f".as_bytes().to_base64(Config {pad: false, ..STANDARD}), "Zg".to_strbuf()); - assert_eq!("fo".as_bytes().to_base64(Config {pad: false, ..STANDARD}), "Zm8".to_strbuf()); + assert_eq!("f".as_bytes().to_base64(Config {pad: false, ..STANDARD}), "Zg".to_string()); + assert_eq!("fo".as_bytes().to_base64(Config {pad: false, ..STANDARD}), "Zm8".to_string()); } #[test] fn test_to_base64_url_safe() { - assert_eq!([251, 255].to_base64(URL_SAFE), "-_8".to_strbuf()); - assert_eq!([251, 255].to_base64(STANDARD), "+/8=".to_strbuf()); + assert_eq!([251, 255].to_base64(URL_SAFE), "-_8".to_string()); + assert_eq!([251, 255].to_base64(STANDARD), "+/8=".to_string()); } #[test] diff --git a/src/libserialize/ebml.rs b/src/libserialize/ebml.rs index 403705017d5ea..e6fe57006cae6 100644 --- a/src/libserialize/ebml.rs +++ b/src/libserialize/ebml.rs @@ -35,7 +35,7 @@ impl<'doc> Doc<'doc> { } pub fn as_str(&self) -> String { - self.as_str_slice().to_strbuf() + self.as_str_slice().to_string() } } diff --git a/src/libserialize/hex.rs b/src/libserialize/hex.rs index e1cc8f5f2dcb1..e72de88a06b47 100644 --- a/src/libserialize/hex.rs +++ b/src/libserialize/hex.rs @@ -45,7 +45,7 @@ impl<'a> ToHex for &'a [u8] { } unsafe { - str::raw::from_utf8(v.as_slice()).to_strbuf() + str::raw::from_utf8(v.as_slice()).to_string() } } } @@ -143,7 +143,7 @@ mod tests { #[test] pub fn test_to_hex() { - assert_eq!("foobar".as_bytes().to_hex(), "666f6f626172".to_strbuf()); + assert_eq!("foobar".as_bytes().to_hex(), "666f6f626172".to_string()); } #[test] diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index cf05bf5b64148..b8be9afc77f44 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -68,7 +68,7 @@ use serialize::{json, Encodable}; } fn main() { - let to_encode_object = TestStruct{data_str:"example of string to encode".to_strbuf()}; + let to_encode_object = TestStruct{data_str:"example of string to encode".to_string()}; let mut m = io::MemWriter::new(); { let mut encoder = json::Encoder::new(&mut m as &mut std::io::Writer); @@ -85,7 +85,7 @@ into a string (String) or buffer (~[u8]): `str_encode(&m)` and `buffer_encode(&m ```rust use serialize::json; -let to_encode_object = "example of string to encode".to_strbuf(); +let to_encode_object = "example of string to encode".to_string(); let encoded_str: String = json::Encoder::str_encode(&to_encode_object); ``` @@ -114,16 +114,16 @@ pub struct MyStruct { impl ToJson for MyStruct { fn to_json( &self ) -> json::Json { let mut d = box TreeMap::new(); - d.insert("attr1".to_strbuf(), self.attr1.to_json()); - d.insert("attr2".to_strbuf(), self.attr2.to_json()); + d.insert("attr1".to_string(), self.attr1.to_json()); + d.insert("attr2".to_string(), self.attr2.to_json()); json::Object(d) } } fn main() { - let test2: MyStruct = MyStruct {attr1: 1, attr2:"test".to_strbuf()}; + let test2: MyStruct = MyStruct {attr1: 1, attr2:"test".to_string()}; let tjson: json::Json = test2.to_json(); - let json_str: String = tjson.to_str().into_strbuf(); + let json_str: String = tjson.to_str().into_string(); } ``` @@ -141,7 +141,7 @@ pub struct MyStruct { fn main() { let json_str_to_decode: String = - "{\"attr1\":1,\"attr2\":\"toto\"}".to_strbuf(); + "{\"attr1\":1,\"attr2\":\"toto\"}".to_string(); let json_object = json::from_str(json_str_to_decode.as_slice()); let mut decoder = json::Decoder::new(json_object.unwrap()); let decoded_object: MyStruct = match Decodable::decode(&mut decoder) { @@ -173,7 +173,7 @@ use serialize::{json, Encodable, Decodable}; // It calls the generated `Encodable` impl. fn main() { let to_encode_object = TestStruct1 - {data_int: 1, data_str:"toto".to_strbuf(), data_vector:vec![2,3,4,5]}; + {data_int: 1, data_str:"toto".to_string(), data_vector:vec![2,3,4,5]}; let encoded_str: String = json::Encoder::str_encode(&to_encode_object); // To deserialize use the `json::from_str` and `json::Decoder` @@ -207,9 +207,9 @@ pub struct TestStruct1 { impl ToJson for TestStruct1 { fn to_json( &self ) -> json::Json { let mut d = box TreeMap::new(); - d.insert("data_int".to_strbuf(), self.data_int.to_json()); - d.insert("data_str".to_strbuf(), self.data_str.to_json()); - d.insert("data_vector".to_strbuf(), self.data_vector.to_json()); + d.insert("data_int".to_string(), self.data_int.to_json()); + d.insert("data_str".to_string(), self.data_str.to_json()); + d.insert("data_vector".to_string(), self.data_vector.to_json()); json::Object(d) } } @@ -217,10 +217,10 @@ impl ToJson for TestStruct1 { fn main() { // Serialization using our impl of to_json - let test2: TestStruct1 = TestStruct1 {data_int: 1, data_str:"toto".to_strbuf(), + let test2: TestStruct1 = TestStruct1 {data_int: 1, data_str:"toto".to_string(), data_vector:vec![2,3,4,5]}; let tjson: json::Json = test2.to_json(); - let json_str: String = tjson.to_str().into_strbuf(); + let json_str: String = tjson.to_str().into_string(); // Deserialize like before. @@ -393,7 +393,7 @@ impl<'a> Encoder<'a> { to_encode_object: &T) -> String { let buff = Encoder::buffer_encode(to_encode_object); - str::from_utf8(buff.as_slice()).unwrap().to_strbuf() + str::from_utf8(buff.as_slice()).unwrap().to_string() } } @@ -839,7 +839,7 @@ impl Json { pub fn to_pretty_str(&self) -> String { let mut s = MemWriter::new(); self.to_pretty_writer(&mut s as &mut io::Writer).unwrap(); - str::from_utf8(s.unwrap().as_slice()).unwrap().to_strbuf() + str::from_utf8(s.unwrap().as_slice()).unwrap().to_string() } /// If the Json value is an Object, returns the value associated with the provided key. @@ -1790,7 +1790,7 @@ impl> Builder { _ => {} } let key = match self.parser.stack().top() { - Some(Key(k)) => { k.to_strbuf() } + Some(Key(k)) => { k.to_string() } _ => { fail!("invalid state"); } }; match self.build_value() { @@ -1811,7 +1811,7 @@ pub fn from_reader(rdr: &mut io::Reader) -> Result { Err(e) => return Err(io_error_to_error(e)) }; let s = match str::from_utf8(contents.as_slice()) { - Some(s) => s.to_strbuf(), + Some(s) => s.to_string(), None => return Err(SyntaxError(NotUtf8, 0, 0)) }; let mut builder = Builder::new(s.as_slice().chars()); @@ -1848,7 +1848,7 @@ macro_rules! expect( ($e:expr, Null) => ({ match $e { Null => Ok(()), - other => Err(ExpectedError("Null".to_strbuf(), + other => Err(ExpectedError("Null".to_string(), format_strbuf!("{}", other))) } }); @@ -1856,7 +1856,7 @@ macro_rules! expect( match $e { $t(v) => Ok(v), other => { - Err(ExpectedError(stringify!($t).to_strbuf(), + Err(ExpectedError(stringify!($t).to_string(), format_strbuf!("{}", other))) } } @@ -1898,7 +1898,7 @@ impl ::Decoder for Decoder { Ok(FromStr::from_str(s.as_slice()).unwrap()) }, value => { - Err(ExpectedError("Number".to_strbuf(), + Err(ExpectedError("Number".to_string(), format_strbuf!("{}", value))) } } @@ -1916,7 +1916,7 @@ impl ::Decoder for Decoder { _ => () } } - Err(ExpectedError("single character string".to_strbuf(), + Err(ExpectedError("single character string".to_string(), format_strbuf!("{}", s))) } @@ -1940,34 +1940,34 @@ impl ::Decoder for Decoder { let name = match self.pop() { String(s) => s, Object(mut o) => { - let n = match o.pop(&"variant".to_strbuf()) { + let n = match o.pop(&"variant".to_string()) { Some(String(s)) => s, Some(val) => { - return Err(ExpectedError("String".to_strbuf(), + return Err(ExpectedError("String".to_string(), format_strbuf!("{}", val))) } None => { - return Err(MissingFieldError("variant".to_strbuf())) + return Err(MissingFieldError("variant".to_string())) } }; - match o.pop(&"fields".to_strbuf()) { + match o.pop(&"fields".to_string()) { Some(List(l)) => { for field in l.move_iter().rev() { self.stack.push(field.clone()); } }, Some(val) => { - return Err(ExpectedError("List".to_strbuf(), + return Err(ExpectedError("List".to_string(), format_strbuf!("{}", val))) } None => { - return Err(MissingFieldError("fields".to_strbuf())) + return Err(MissingFieldError("fields".to_string())) } } n } json => { - return Err(ExpectedError("String or Object".to_strbuf(), + return Err(ExpectedError("String or Object".to_string(), format_strbuf!("{}", json))) } }; @@ -2024,8 +2024,8 @@ impl ::Decoder for Decoder { debug!("read_struct_field(name={}, idx={})", name, idx); let mut obj = try!(expect!(self.pop(), Object)); - let value = match obj.pop(&name.to_strbuf()) { - None => return Err(MissingFieldError(name.to_strbuf())), + let value = match obj.pop(&name.to_string()) { + None => return Err(MissingFieldError(name.to_string())), Some(json) => { self.stack.push(json); try!(f(self)) @@ -2350,67 +2350,67 @@ mod tests { #[test] fn test_write_null() { - assert_eq!(Null.to_str().into_strbuf(), "null".to_strbuf()); - assert_eq!(Null.to_pretty_str().into_strbuf(), "null".to_strbuf()); + assert_eq!(Null.to_str().into_string(), "null".to_string()); + assert_eq!(Null.to_pretty_str().into_string(), "null".to_string()); } #[test] fn test_write_number() { - assert_eq!(Number(3.0).to_str().into_strbuf(), "3".to_strbuf()); - assert_eq!(Number(3.0).to_pretty_str().into_strbuf(), "3".to_strbuf()); + assert_eq!(Number(3.0).to_str().into_string(), "3".to_string()); + assert_eq!(Number(3.0).to_pretty_str().into_string(), "3".to_string()); - assert_eq!(Number(3.1).to_str().into_strbuf(), "3.1".to_strbuf()); - assert_eq!(Number(3.1).to_pretty_str().into_strbuf(), "3.1".to_strbuf()); + assert_eq!(Number(3.1).to_str().into_string(), "3.1".to_string()); + assert_eq!(Number(3.1).to_pretty_str().into_string(), "3.1".to_string()); - assert_eq!(Number(-1.5).to_str().into_strbuf(), "-1.5".to_strbuf()); - assert_eq!(Number(-1.5).to_pretty_str().into_strbuf(), "-1.5".to_strbuf()); + assert_eq!(Number(-1.5).to_str().into_string(), "-1.5".to_string()); + assert_eq!(Number(-1.5).to_pretty_str().into_string(), "-1.5".to_string()); - assert_eq!(Number(0.5).to_str().into_strbuf(), "0.5".to_strbuf()); - assert_eq!(Number(0.5).to_pretty_str().into_strbuf(), "0.5".to_strbuf()); + assert_eq!(Number(0.5).to_str().into_string(), "0.5".to_string()); + assert_eq!(Number(0.5).to_pretty_str().into_string(), "0.5".to_string()); } #[test] fn test_write_str() { - assert_eq!(String("".to_strbuf()).to_str().into_strbuf(), "\"\"".to_strbuf()); - assert_eq!(String("".to_strbuf()).to_pretty_str().into_strbuf(), "\"\"".to_strbuf()); + assert_eq!(String("".to_string()).to_str().into_string(), "\"\"".to_string()); + assert_eq!(String("".to_string()).to_pretty_str().into_string(), "\"\"".to_string()); - assert_eq!(String("foo".to_strbuf()).to_str().into_strbuf(), "\"foo\"".to_strbuf()); - assert_eq!(String("foo".to_strbuf()).to_pretty_str().into_strbuf(), "\"foo\"".to_strbuf()); + assert_eq!(String("foo".to_string()).to_str().into_string(), "\"foo\"".to_string()); + assert_eq!(String("foo".to_string()).to_pretty_str().into_string(), "\"foo\"".to_string()); } #[test] fn test_write_bool() { - assert_eq!(Boolean(true).to_str().into_strbuf(), "true".to_strbuf()); - assert_eq!(Boolean(true).to_pretty_str().into_strbuf(), "true".to_strbuf()); + assert_eq!(Boolean(true).to_str().into_string(), "true".to_string()); + assert_eq!(Boolean(true).to_pretty_str().into_string(), "true".to_string()); - assert_eq!(Boolean(false).to_str().into_strbuf(), "false".to_strbuf()); - assert_eq!(Boolean(false).to_pretty_str().into_strbuf(), "false".to_strbuf()); + assert_eq!(Boolean(false).to_str().into_string(), "false".to_string()); + assert_eq!(Boolean(false).to_pretty_str().into_string(), "false".to_string()); } #[test] fn test_write_list() { - assert_eq!(List(vec![]).to_str().into_strbuf(), "[]".to_strbuf()); - assert_eq!(List(vec![]).to_pretty_str().into_strbuf(), "[]".to_strbuf()); + assert_eq!(List(vec![]).to_str().into_string(), "[]".to_string()); + assert_eq!(List(vec![]).to_pretty_str().into_string(), "[]".to_string()); - assert_eq!(List(vec![Boolean(true)]).to_str().into_strbuf(), "[true]".to_strbuf()); + assert_eq!(List(vec![Boolean(true)]).to_str().into_string(), "[true]".to_string()); assert_eq!( - List(vec![Boolean(true)]).to_pretty_str().into_strbuf(), + List(vec![Boolean(true)]).to_pretty_str().into_string(), "\ [\n \ true\n\ - ]".to_strbuf() + ]".to_string() ); let long_test_list = List(vec![ Boolean(false), Null, - List(vec![String("foo\nbar".to_strbuf()), Number(3.5)])]); + List(vec![String("foo\nbar".to_string()), Number(3.5)])]); - assert_eq!(long_test_list.to_str().into_strbuf(), - "[false,null,[\"foo\\nbar\",3.5]]".to_strbuf()); + assert_eq!(long_test_list.to_str().into_string(), + "[false,null,[\"foo\\nbar\",3.5]]".to_string()); assert_eq!( - long_test_list.to_pretty_str().into_strbuf(), + long_test_list.to_pretty_str().into_string(), "\ [\n \ false,\n \ @@ -2419,47 +2419,47 @@ mod tests { \"foo\\nbar\",\n \ 3.5\n \ ]\n\ - ]".to_strbuf() + ]".to_string() ); } #[test] fn test_write_object() { - assert_eq!(mk_object([]).to_str().into_strbuf(), "{}".to_strbuf()); - assert_eq!(mk_object([]).to_pretty_str().into_strbuf(), "{}".to_strbuf()); + assert_eq!(mk_object([]).to_str().into_string(), "{}".to_string()); + assert_eq!(mk_object([]).to_pretty_str().into_string(), "{}".to_string()); assert_eq!( mk_object([ - ("a".to_strbuf(), Boolean(true)) - ]).to_str().into_strbuf(), - "{\"a\":true}".to_strbuf() + ("a".to_string(), Boolean(true)) + ]).to_str().into_string(), + "{\"a\":true}".to_string() ); assert_eq!( - mk_object([("a".to_strbuf(), Boolean(true))]).to_pretty_str(), + mk_object([("a".to_string(), Boolean(true))]).to_pretty_str(), "\ {\n \ \"a\": true\n\ - }".to_strbuf() + }".to_string() ); let complex_obj = mk_object([ - ("b".to_strbuf(), List(vec![ - mk_object([("c".to_strbuf(), String("\x0c\r".to_strbuf()))]), - mk_object([("d".to_strbuf(), String("".to_strbuf()))]) + ("b".to_string(), List(vec![ + mk_object([("c".to_string(), String("\x0c\r".to_string()))]), + mk_object([("d".to_string(), String("".to_string()))]) ])) ]); assert_eq!( - complex_obj.to_str().into_strbuf(), + complex_obj.to_str().into_string(), "{\ \"b\":[\ {\"c\":\"\\f\\r\"},\ {\"d\":\"\"}\ ]\ - }".to_strbuf() + }".to_string() ); assert_eq!( - complex_obj.to_pretty_str().into_strbuf(), + complex_obj.to_pretty_str().into_string(), "\ {\n \ \"b\": [\n \ @@ -2470,14 +2470,14 @@ mod tests { \"d\": \"\"\n \ }\n \ ]\n\ - }".to_strbuf() + }".to_string() ); let a = mk_object([ - ("a".to_strbuf(), Boolean(true)), - ("b".to_strbuf(), List(vec![ - mk_object([("c".to_strbuf(), String("\x0c\r".to_strbuf()))]), - mk_object([("d".to_strbuf(), String("".to_strbuf()))]) + ("a".to_string(), Boolean(true)), + ("b".to_string(), List(vec![ + mk_object([("c".to_string(), String("\x0c\r".to_string()))]), + mk_object([("d".to_string(), String("".to_string()))]) ])) ]); @@ -2494,7 +2494,7 @@ mod tests { let mut m = MemWriter::new(); f(&mut m as &mut io::Writer); - str::from_utf8(m.unwrap().as_slice()).unwrap().to_strbuf() + str::from_utf8(m.unwrap().as_slice()).unwrap().to_string() } #[test] @@ -2505,23 +2505,23 @@ mod tests { let mut encoder = Encoder::new(wr); animal.encode(&mut encoder).unwrap(); }), - "\"Dog\"".to_strbuf() + "\"Dog\"".to_string() ); assert_eq!( with_str_writer(|wr| { let mut encoder = PrettyEncoder::new(wr); animal.encode(&mut encoder).unwrap(); }), - "\"Dog\"".to_strbuf() + "\"Dog\"".to_string() ); - let animal = Frog("Henry".to_strbuf(), 349); + let animal = Frog("Henry".to_string(), 349); assert_eq!( with_str_writer(|wr| { let mut encoder = Encoder::new(wr); animal.encode(&mut encoder).unwrap(); }), - "{\"variant\":\"Frog\",\"fields\":[\"Henry\",349]}".to_strbuf() + "{\"variant\":\"Frog\",\"fields\":[\"Henry\",349]}".to_string() ); assert_eq!( with_str_writer(|wr| { @@ -2533,25 +2533,25 @@ mod tests { \"Frog\",\n \ \"Henry\",\n \ 349\n\ - ]".to_strbuf() + ]".to_string() ); } #[test] fn test_write_some() { - let value = Some("jodhpurs".to_strbuf()); + let value = Some("jodhpurs".to_string()); let s = with_str_writer(|wr| { let mut encoder = Encoder::new(wr); value.encode(&mut encoder).unwrap(); }); - assert_eq!(s, "\"jodhpurs\"".to_strbuf()); + assert_eq!(s, "\"jodhpurs\"".to_string()); - let value = Some("jodhpurs".to_strbuf()); + let value = Some("jodhpurs".to_string()); let s = with_str_writer(|wr| { let mut encoder = PrettyEncoder::new(wr); value.encode(&mut encoder).unwrap(); }); - assert_eq!(s, "\"jodhpurs\"".to_strbuf()); + assert_eq!(s, "\"jodhpurs\"".to_string()); } #[test] @@ -2561,13 +2561,13 @@ mod tests { let mut encoder = Encoder::new(wr); value.encode(&mut encoder).unwrap(); }); - assert_eq!(s, "null".to_strbuf()); + assert_eq!(s, "null".to_string()); let s = with_str_writer(|wr| { let mut encoder = Encoder::new(wr); value.encode(&mut encoder).unwrap(); }); - assert_eq!(s, "null".to_strbuf()); + assert_eq!(s, "null".to_string()); } #[test] @@ -2668,16 +2668,16 @@ mod tests { assert_eq!(from_str("\""), Err(SyntaxError(EOFWhileParsingString, 1, 2))); assert_eq!(from_str("\"lol"), Err(SyntaxError(EOFWhileParsingString, 1, 5))); - assert_eq!(from_str("\"\""), Ok(String("".to_strbuf()))); - assert_eq!(from_str("\"foo\""), Ok(String("foo".to_strbuf()))); - assert_eq!(from_str("\"\\\"\""), Ok(String("\"".to_strbuf()))); - assert_eq!(from_str("\"\\b\""), Ok(String("\x08".to_strbuf()))); - assert_eq!(from_str("\"\\n\""), Ok(String("\n".to_strbuf()))); - assert_eq!(from_str("\"\\r\""), Ok(String("\r".to_strbuf()))); - assert_eq!(from_str("\"\\t\""), Ok(String("\t".to_strbuf()))); - assert_eq!(from_str(" \"foo\" "), Ok(String("foo".to_strbuf()))); - assert_eq!(from_str("\"\\u12ab\""), Ok(String("\u12ab".to_strbuf()))); - assert_eq!(from_str("\"\\uAB12\""), Ok(String("\uAB12".to_strbuf()))); + assert_eq!(from_str("\"\""), Ok(String("".to_string()))); + assert_eq!(from_str("\"foo\""), Ok(String("foo".to_string()))); + assert_eq!(from_str("\"\\\"\""), Ok(String("\"".to_string()))); + assert_eq!(from_str("\"\\b\""), Ok(String("\x08".to_string()))); + assert_eq!(from_str("\"\\n\""), Ok(String("\n".to_string()))); + assert_eq!(from_str("\"\\r\""), Ok(String("\r".to_string()))); + assert_eq!(from_str("\"\\t\""), Ok(String("\t".to_string()))); + assert_eq!(from_str(" \"foo\" "), Ok(String("foo".to_string()))); + assert_eq!(from_str("\"\\u12ab\""), Ok(String("\u12ab".to_string()))); + assert_eq!(from_str("\"\\uAB12\""), Ok(String("\uAB12".to_string()))); } #[test] @@ -2699,7 +2699,7 @@ mod tests { let mut decoder = Decoder::new(from_str(i).unwrap()); let v: String = Decodable::decode(&mut decoder).unwrap(); - assert_eq!(v, o.to_strbuf()); + assert_eq!(v, o.to_string()); } } @@ -2768,22 +2768,22 @@ mod tests { assert_eq!(from_str("{}").unwrap(), mk_object([])); assert_eq!(from_str("{\"a\": 3}").unwrap(), - mk_object([("a".to_strbuf(), Number(3.0))])); + mk_object([("a".to_string(), Number(3.0))])); assert_eq!(from_str( "{ \"a\": null, \"b\" : true }").unwrap(), mk_object([ - ("a".to_strbuf(), Null), - ("b".to_strbuf(), Boolean(true))])); + ("a".to_string(), Null), + ("b".to_string(), Boolean(true))])); assert_eq!(from_str("\n{ \"a\": null, \"b\" : true }\n").unwrap(), mk_object([ - ("a".to_strbuf(), Null), - ("b".to_strbuf(), Boolean(true))])); + ("a".to_string(), Null), + ("b".to_string(), Boolean(true))])); assert_eq!(from_str( "{\"a\" : 1.0 ,\"b\": [ true ]}").unwrap(), mk_object([ - ("a".to_strbuf(), Number(1.0)), - ("b".to_strbuf(), List(vec![Boolean(true)])) + ("a".to_string(), Number(1.0)), + ("b".to_string(), List(vec![Boolean(true)])) ])); assert_eq!(from_str( "{\ @@ -2795,12 +2795,12 @@ mod tests { ]\ }").unwrap(), mk_object([ - ("a".to_strbuf(), Number(1.0)), - ("b".to_strbuf(), List(vec![ + ("a".to_string(), Number(1.0)), + ("b".to_string(), List(vec![ Boolean(true), - String("foo\nbar".to_strbuf()), + String("foo\nbar".to_string()), mk_object([ - ("c".to_strbuf(), mk_object([("d".to_strbuf(), Null)])) + ("c".to_string(), mk_object([("d".to_string(), Null)])) ]) ])) ])); @@ -2819,7 +2819,7 @@ mod tests { v, Outer { inner: vec![ - Inner { a: (), b: 2, c: vec!["abc".to_strbuf(), "xyz".to_strbuf()] } + Inner { a: (), b: 2, c: vec!["abc".to_string(), "xyz".to_string()] } ] } ); @@ -2833,7 +2833,7 @@ mod tests { let mut decoder = Decoder::new(from_str("\"jodhpurs\"").unwrap()); let value: Option = Decodable::decode(&mut decoder).unwrap(); - assert_eq!(value, Some("jodhpurs".to_strbuf())); + assert_eq!(value, Some("jodhpurs".to_string())); } #[test] @@ -2845,7 +2845,7 @@ mod tests { let s = "{\"variant\":\"Frog\",\"fields\":[\"Henry\",349]}"; let mut decoder = Decoder::new(from_str(s).unwrap()); let value: Animal = Decodable::decode(&mut decoder).unwrap(); - assert_eq!(value, Frog("Henry".to_strbuf(), 349)); + assert_eq!(value, Frog("Henry".to_string(), 349)); } #[test] @@ -2855,8 +2855,8 @@ mod tests { let mut decoder = Decoder::new(from_str(s).unwrap()); let mut map: TreeMap = Decodable::decode(&mut decoder).unwrap(); - assert_eq!(map.pop(&"a".to_strbuf()), Some(Dog)); - assert_eq!(map.pop(&"b".to_strbuf()), Some(Frog("Henry".to_strbuf(), 349))); + assert_eq!(map.pop(&"a".to_string()), Some(Dog)); + assert_eq!(map.pop(&"b".to_string()), Some(Frog("Henry".to_string(), 349))); } #[test] @@ -2895,51 +2895,51 @@ mod tests { } #[test] fn test_decode_errors_struct() { - check_err::("[]", ExpectedError("Object".to_strbuf(), "[]".to_strbuf())); + check_err::("[]", ExpectedError("Object".to_string(), "[]".to_string())); check_err::("{\"x\": true, \"y\": true, \"z\": \"\", \"w\": []}", - ExpectedError("Number".to_strbuf(), "true".to_strbuf())); + ExpectedError("Number".to_string(), "true".to_string())); check_err::("{\"x\": 1, \"y\": [], \"z\": \"\", \"w\": []}", - ExpectedError("Boolean".to_strbuf(), "[]".to_strbuf())); + ExpectedError("Boolean".to_string(), "[]".to_string())); check_err::("{\"x\": 1, \"y\": true, \"z\": {}, \"w\": []}", - ExpectedError("String".to_strbuf(), "{}".to_strbuf())); + ExpectedError("String".to_string(), "{}".to_string())); check_err::("{\"x\": 1, \"y\": true, \"z\": \"\", \"w\": null}", - ExpectedError("List".to_strbuf(), "null".to_strbuf())); + ExpectedError("List".to_string(), "null".to_string())); check_err::("{\"x\": 1, \"y\": true, \"z\": \"\"}", - MissingFieldError("w".to_strbuf())); + MissingFieldError("w".to_string())); } #[test] fn test_decode_errors_enum() { check_err::("{}", - MissingFieldError("variant".to_strbuf())); + MissingFieldError("variant".to_string())); check_err::("{\"variant\": 1}", - ExpectedError("String".to_strbuf(), "1".to_strbuf())); + ExpectedError("String".to_string(), "1".to_string())); check_err::("{\"variant\": \"A\"}", - MissingFieldError("fields".to_strbuf())); + MissingFieldError("fields".to_string())); check_err::("{\"variant\": \"A\", \"fields\": null}", - ExpectedError("List".to_strbuf(), "null".to_strbuf())); + ExpectedError("List".to_string(), "null".to_string())); check_err::("{\"variant\": \"C\", \"fields\": []}", - UnknownVariantError("C".to_strbuf())); + UnknownVariantError("C".to_string())); } #[test] fn test_find(){ let json_value = from_str("{\"dog\" : \"cat\"}").unwrap(); - let found_str = json_value.find(&"dog".to_strbuf()); + let found_str = json_value.find(&"dog".to_string()); assert!(found_str.is_some() && found_str.unwrap().as_string().unwrap() == "cat"); } #[test] fn test_find_path(){ let json_value = from_str("{\"dog\":{\"cat\": {\"mouse\" : \"cheese\"}}}").unwrap(); - let found_str = json_value.find_path(&[&"dog".to_strbuf(), - &"cat".to_strbuf(), &"mouse".to_strbuf()]); + let found_str = json_value.find_path(&[&"dog".to_string(), + &"cat".to_string(), &"mouse".to_string()]); assert!(found_str.is_some() && found_str.unwrap().as_string().unwrap() == "cheese"); } #[test] fn test_search(){ let json_value = from_str("{\"dog\":{\"cat\": {\"mouse\" : \"cheese\"}}}").unwrap(); - let found_str = json_value.search(&"mouse".to_strbuf()).and_then(|j| j.as_string()); + let found_str = json_value.search(&"mouse".to_string()).and_then(|j| j.as_string()); assert!(found_str.is_some()); assert!(found_str.unwrap() == "cheese"); } @@ -3102,7 +3102,7 @@ mod tests { r#"{ "foo":"bar", "array" : [0, 1, 2,3 ,4,5], "idents":[null,true,false]}"#, ~[ (ObjectStart, ~[]), - (StringValue("bar".to_strbuf()), ~[Key("foo")]), + (StringValue("bar".to_string()), ~[Key("foo")]), (ListStart, ~[Key("array")]), (NumberValue(0.0), ~[Key("array"), Index(0)]), (NumberValue(1.0), ~[Key("array"), Index(1)]), @@ -3191,7 +3191,7 @@ mod tests { (NumberValue(1.0), ~[Key("a")]), (ListStart, ~[Key("b")]), (BooleanValue(true), ~[Key("b"), Index(0)]), - (StringValue("foo\nbar".to_strbuf()), ~[Key("b"), Index(1)]), + (StringValue("foo\nbar".to_string()), ~[Key("b"), Index(1)]), (ObjectStart, ~[Key("b"), Index(2)]), (ObjectStart, ~[Key("b"), Index(2), Key("c")]), (NullValue, ~[Key("b"), Index(2), Key("c"), Key("d")]), @@ -3324,7 +3324,7 @@ mod tests { assert!(stack.last_is_index()); assert!(stack.get(0) == Index(1)); - stack.push_key("foo".to_strbuf()); + stack.push_key("foo".to_string()); assert!(stack.len() == 2); assert!(stack.is_equal_to([Index(1), Key("foo")])); @@ -3336,7 +3336,7 @@ mod tests { assert!(stack.get(0) == Index(1)); assert!(stack.get(1) == Key("foo")); - stack.push_key("bar".to_strbuf()); + stack.push_key("bar".to_string()); assert!(stack.len() == 3); assert!(stack.is_equal_to([Index(1), Key("foo"), Key("bar")])); @@ -3400,7 +3400,7 @@ mod tests { } fn big_json() -> String { - let mut src = "[\n".to_strbuf(); + let mut src = "[\n".to_string(); for _ in range(0, 500) { src.push_str(r#"{ "a": true, "b": null, "c":3.1415, "d": "Hello world", "e": \ [1,2,3]},"#); diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index d3b98b02bd097..55bbf4ddf75ab 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -366,7 +366,7 @@ impl IntoStr for Vec { fn into_str(self) -> String { unsafe { let s: &str = mem::transmute(self.as_slice()); - s.to_strbuf() + s.to_string() } } } @@ -456,16 +456,16 @@ unsafe fn str_map_bytes(string: String, map: &'static [u8]) -> String { *b = map[*b as uint]; } - str::from_utf8(bytes.as_slice()).unwrap().to_strbuf() + str::from_utf8(bytes.as_slice()).unwrap().to_string() } #[inline] unsafe fn str_copy_map_bytes(string: &str, map: &'static [u8]) -> String { - let mut s = string.to_strbuf(); + let mut s = string.to_string(); for b in s.as_mut_bytes().mut_iter() { *b = map[*b as uint]; } - s.into_strbuf() + s.into_string() } static ASCII_LOWER_MAP: &'static [u8] = &[ @@ -594,14 +594,14 @@ mod tests { assert_eq!("( ;".to_ascii(), v2ascii!([40, 32, 59])); let v = box [40u8, 32u8, 59u8]; assert_eq!(v.to_ascii(), v2ascii!([40, 32, 59])); - assert_eq!("( ;".to_strbuf().as_slice().to_ascii(), v2ascii!([40, 32, 59])); + assert_eq!("( ;".to_string().as_slice().to_ascii(), v2ascii!([40, 32, 59])); - assert_eq!("abCDef&?#".to_ascii().to_lower().into_str(), "abcdef&?#".to_strbuf()); - assert_eq!("abCDef&?#".to_ascii().to_upper().into_str(), "ABCDEF&?#".to_strbuf()); + assert_eq!("abCDef&?#".to_ascii().to_lower().into_str(), "abcdef&?#".to_string()); + assert_eq!("abCDef&?#".to_ascii().to_upper().into_str(), "ABCDEF&?#".to_string()); - assert_eq!("".to_ascii().to_lower().into_str(), "".to_strbuf()); - assert_eq!("YMCA".to_ascii().to_lower().into_str(), "ymca".to_strbuf()); - assert_eq!("abcDEFxyz:.;".to_ascii().to_upper().into_str(), "ABCDEFXYZ:.;".to_strbuf()); + assert_eq!("".to_ascii().to_lower().into_str(), "".to_string()); + assert_eq!("YMCA".to_ascii().to_lower().into_str(), "ymca".to_string()); + assert_eq!("abcDEFxyz:.;".to_ascii().to_upper().into_str(), "ABCDEFXYZ:.;".to_string()); assert!("aBcDeF&?#".to_ascii().eq_ignore_case("AbCdEf&?#".to_ascii())); @@ -613,16 +613,16 @@ mod tests { #[test] fn test_ascii_vec_ng() { - assert_eq!("abCDef&?#".to_ascii().to_lower().into_str(), "abcdef&?#".to_strbuf()); - assert_eq!("abCDef&?#".to_ascii().to_upper().into_str(), "ABCDEF&?#".to_strbuf()); - assert_eq!("".to_ascii().to_lower().into_str(), "".to_strbuf()); - assert_eq!("YMCA".to_ascii().to_lower().into_str(), "ymca".to_strbuf()); - assert_eq!("abcDEFxyz:.;".to_ascii().to_upper().into_str(), "ABCDEFXYZ:.;".to_strbuf()); + assert_eq!("abCDef&?#".to_ascii().to_lower().into_str(), "abcdef&?#".to_string()); + assert_eq!("abCDef&?#".to_ascii().to_upper().into_str(), "ABCDEF&?#".to_string()); + assert_eq!("".to_ascii().to_lower().into_str(), "".to_string()); + assert_eq!("YMCA".to_ascii().to_lower().into_str(), "ymca".to_string()); + assert_eq!("abcDEFxyz:.;".to_ascii().to_upper().into_str(), "ABCDEFXYZ:.;".to_string()); } #[test] fn test_owned_ascii_vec() { - assert_eq!(("( ;".to_strbuf()).into_ascii(), vec2ascii![40, 32, 59]); + assert_eq!(("( ;".to_string()).into_ascii(), vec2ascii![40, 32, 59]); assert_eq!((box [40u8, 32u8, 59u8]).into_ascii(), vec2ascii![40, 32, 59]); } @@ -634,8 +634,8 @@ mod tests { #[test] fn test_ascii_into_str() { - assert_eq!(vec2ascii![40, 32, 59].into_str(), "( ;".to_strbuf()); - assert_eq!(vec2ascii!(40, 32, 59).into_str(), "( ;".to_strbuf()); + assert_eq!(vec2ascii![40, 32, 59].into_str(), "( ;".to_string()); + assert_eq!(vec2ascii!(40, 32, 59).into_str(), "( ;".to_string()); } #[test] @@ -682,70 +682,70 @@ mod tests { assert_eq!((vec![40u8, 32u8, 59u8]).into_ascii_opt(), Some(vec2ascii![40, 32, 59])); assert_eq!((vec![127u8, 128u8, 255u8]).into_ascii_opt(), None); - assert_eq!(("( ;".to_strbuf()).into_ascii_opt(), Some(vec2ascii![40, 32, 59])); - assert_eq!(("zoä华".to_strbuf()).into_ascii_opt(), None); + assert_eq!(("( ;".to_string()).into_ascii_opt(), Some(vec2ascii![40, 32, 59])); + assert_eq!(("zoä华".to_string()).into_ascii_opt(), None); } #[test] fn test_to_ascii_upper() { - assert_eq!("url()URL()uRl()ürl".to_ascii_upper(), "URL()URL()URL()üRL".to_strbuf()); - assert_eq!("hıKß".to_ascii_upper(), "HıKß".to_strbuf()); + assert_eq!("url()URL()uRl()ürl".to_ascii_upper(), "URL()URL()URL()üRL".to_string()); + assert_eq!("hıKß".to_ascii_upper(), "HıKß".to_string()); let mut i = 0; while i <= 500 { let upper = if 'a' as u32 <= i && i <= 'z' as u32 { i + 'A' as u32 - 'a' as u32 } else { i }; assert_eq!(from_char(from_u32(i).unwrap()).as_slice().to_ascii_upper(), - from_char(from_u32(upper).unwrap()).to_strbuf()) + from_char(from_u32(upper).unwrap()).to_string()) i += 1; } } #[test] fn test_to_ascii_lower() { - assert_eq!("url()URL()uRl()Ürl".to_ascii_lower(), "url()url()url()Ürl".to_strbuf()); + assert_eq!("url()URL()uRl()Ürl".to_ascii_lower(), "url()url()url()Ürl".to_string()); // Dotted capital I, Kelvin sign, Sharp S. - assert_eq!("HİKß".to_ascii_lower(), "hİKß".to_strbuf()); + assert_eq!("HİKß".to_ascii_lower(), "hİKß".to_string()); let mut i = 0; while i <= 500 { let lower = if 'A' as u32 <= i && i <= 'Z' as u32 { i + 'a' as u32 - 'A' as u32 } else { i }; assert_eq!(from_char(from_u32(i).unwrap()).as_slice().to_ascii_lower(), - from_char(from_u32(lower).unwrap()).to_strbuf()) + from_char(from_u32(lower).unwrap()).to_string()) i += 1; } } #[test] fn test_into_ascii_upper() { - assert_eq!(("url()URL()uRl()ürl".to_strbuf()).into_ascii_upper(), - "URL()URL()URL()üRL".to_strbuf()); - assert_eq!(("hıKß".to_strbuf()).into_ascii_upper(), "HıKß".to_strbuf()); + assert_eq!(("url()URL()uRl()ürl".to_string()).into_ascii_upper(), + "URL()URL()URL()üRL".to_string()); + assert_eq!(("hıKß".to_string()).into_ascii_upper(), "HıKß".to_string()); let mut i = 0; while i <= 500 { let upper = if 'a' as u32 <= i && i <= 'z' as u32 { i + 'A' as u32 - 'a' as u32 } else { i }; - assert_eq!(from_char(from_u32(i).unwrap()).to_strbuf().into_ascii_upper(), - from_char(from_u32(upper).unwrap()).to_strbuf()) + assert_eq!(from_char(from_u32(i).unwrap()).to_string().into_ascii_upper(), + from_char(from_u32(upper).unwrap()).to_string()) i += 1; } } #[test] fn test_into_ascii_lower() { - assert_eq!(("url()URL()uRl()Ürl".to_strbuf()).into_ascii_lower(), - "url()url()url()Ürl".to_strbuf()); + assert_eq!(("url()URL()uRl()Ürl".to_string()).into_ascii_lower(), + "url()url()url()Ürl".to_string()); // Dotted capital I, Kelvin sign, Sharp S. - assert_eq!(("HİKß".to_strbuf()).into_ascii_lower(), "hİKß".to_strbuf()); + assert_eq!(("HİKß".to_string()).into_ascii_lower(), "hİKß".to_string()); let mut i = 0; while i <= 500 { let lower = if 'A' as u32 <= i && i <= 'Z' as u32 { i + 'a' as u32 - 'A' as u32 } else { i }; - assert_eq!(from_char(from_u32(i).unwrap()).to_strbuf().into_ascii_lower(), - from_char(from_u32(lower).unwrap()).to_strbuf()) + assert_eq!(from_char(from_u32(i).unwrap()).to_string().into_ascii_lower(), + from_char(from_u32(lower).unwrap()).to_string()) i += 1; } } @@ -777,12 +777,12 @@ mod tests { #[test] fn test_to_str() { let s = Ascii{ chr: 't' as u8 }.to_str(); - assert_eq!(s, "t".to_strbuf()); + assert_eq!(s, "t".to_string()); } #[test] fn test_show() { let c = Ascii { chr: 't' as u8 }; - assert_eq!(format_strbuf!("{}", c), "t".to_strbuf()); + assert_eq!(format_strbuf!("{}", c), "t".to_string()); } } diff --git a/src/libstd/fmt.rs b/src/libstd/fmt.rs index 174ea00d2862f..ba2bc261bc301 100644 --- a/src/libstd/fmt.rs +++ b/src/libstd/fmt.rs @@ -548,14 +548,14 @@ pub trait Poly { pub fn format(args: &Arguments) -> string::String{ let mut output = io::MemWriter::new(); let _ = write!(&mut output, "{}", args); - str::from_utf8(output.unwrap().as_slice()).unwrap().into_strbuf() + str::from_utf8(output.unwrap().as_slice()).unwrap().into_string() } /// Temporary transition utility pub fn format_strbuf(args: &Arguments) -> string::String { let mut output = io::MemWriter::new(); let _ = write!(&mut output, "{}", args); - str::from_utf8(output.unwrap().as_slice()).unwrap().into_strbuf() + str::from_utf8(output.unwrap().as_slice()).unwrap().into_string() } impl Poly for T { diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index c7b0d66062460..643bc166c2762 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -537,9 +537,9 @@ mod test { fn test_read_line() { let in_buf = MemReader::new(Vec::from_slice(bytes!("a\nb\nc"))); let mut reader = BufferedReader::with_capacity(2, in_buf); - assert_eq!(reader.read_line(), Ok("a\n".to_strbuf())); - assert_eq!(reader.read_line(), Ok("b\n".to_strbuf())); - assert_eq!(reader.read_line(), Ok("c".to_strbuf())); + assert_eq!(reader.read_line(), Ok("a\n".to_string())); + assert_eq!(reader.read_line(), Ok("b\n".to_string())); + assert_eq!(reader.read_line(), Ok("c".to_string())); assert!(reader.read_line().is_err()); } @@ -548,9 +548,9 @@ mod test { let in_buf = MemReader::new(Vec::from_slice(bytes!("a\nb\nc"))); let mut reader = BufferedReader::with_capacity(2, in_buf); let mut it = reader.lines(); - assert_eq!(it.next(), Some(Ok("a\n".to_strbuf()))); - assert_eq!(it.next(), Some(Ok("b\n".to_strbuf()))); - assert_eq!(it.next(), Some(Ok("c".to_strbuf()))); + assert_eq!(it.next(), Some(Ok("a\n".to_string()))); + assert_eq!(it.next(), Some(Ok("b\n".to_string()))); + assert_eq!(it.next(), Some(Ok("c".to_string()))); assert_eq!(it.next(), None); } diff --git a/src/libstd/io/mem.rs b/src/libstd/io/mem.rs index c1e228cd693b5..735966d812b92 100644 --- a/src/libstd/io/mem.rs +++ b/src/libstd/io/mem.rs @@ -497,7 +497,7 @@ mod test { writer.write_line("testing").unwrap(); writer.write_str("testing").unwrap(); let mut r = BufReader::new(writer.get_ref()); - assert_eq!(r.read_to_str().unwrap(), "testingtesting\ntesting".to_strbuf()); + assert_eq!(r.read_to_str().unwrap(), "testingtesting\ntesting".to_string()); } #[test] @@ -507,7 +507,7 @@ mod test { writer.write_char('\n').unwrap(); writer.write_char('ệ').unwrap(); let mut r = BufReader::new(writer.get_ref()); - assert_eq!(r.read_to_str().unwrap(), "a\nệ".to_strbuf()); + assert_eq!(r.read_to_str().unwrap(), "a\nệ".to_string()); } #[test] diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index c16c77373575b..4d02a470f308c 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -496,7 +496,7 @@ pub trait Reader { fn read_at_least(&mut self, min: uint, buf: &mut [u8]) -> IoResult { if min > buf.len() { return Err(IoError { - detail: Some("the buffer is too short".to_strbuf()), + detail: Some("the buffer is too short".to_string()), ..standard_error(InvalidInput) }); } @@ -564,7 +564,7 @@ pub trait Reader { fn push_at_least(&mut self, min: uint, len: uint, buf: &mut Vec) -> IoResult { if min > len { return Err(IoError { - detail: Some("the buffer is too short".to_strbuf()), + detail: Some("the buffer is too short".to_string()), ..standard_error(InvalidInput) }); } @@ -635,7 +635,7 @@ pub trait Reader { fn read_to_str(&mut self) -> IoResult { self.read_to_end().and_then(|s| { match str::from_utf8(s.as_slice()) { - Some(s) => Ok(s.to_strbuf()), + Some(s) => Ok(s.to_string()), None => Err(standard_error(InvalidInput)), } }) @@ -1333,7 +1333,7 @@ pub trait Buffer: Reader { fn read_line(&mut self) -> IoResult { self.read_until('\n' as u8).and_then(|line| match str::from_utf8(line.as_slice()) { - Some(s) => Ok(s.to_strbuf()), + Some(s) => Ok(s.to_string()), None => Err(standard_error(InvalidInput)), } ) diff --git a/src/libstd/io/net/ip.rs b/src/libstd/io/net/ip.rs index 4bf71b5480e2f..5004e8a5a0707 100644 --- a/src/libstd/io/net/ip.rs +++ b/src/libstd/io/net/ip.rs @@ -445,8 +445,8 @@ mod test { #[test] fn ipv6_addr_to_str() { let a1 = Ipv6Addr(0, 0, 0, 0, 0, 0xffff, 0xc000, 0x280); - assert!(a1.to_str() == "::ffff:192.0.2.128".to_strbuf() || - a1.to_str() == "::FFFF:192.0.2.128".to_strbuf()); - assert_eq!(Ipv6Addr(8, 9, 10, 11, 12, 13, 14, 15).to_str(), "8:9:a:b:c:d:e:f".to_strbuf()); + assert!(a1.to_str() == "::ffff:192.0.2.128".to_string() || + a1.to_str() == "::FFFF:192.0.2.128".to_string()); + assert_eq!(Ipv6Addr(8, 9, 10, 11, 12, 13, 14, 15).to_str(), "8:9:a:b:c:d:e:f".to_string()); } } diff --git a/src/libstd/io/process.rs b/src/libstd/io/process.rs index 7eb495a6f68dc..20d20a14f9a18 100644 --- a/src/libstd/io/process.rs +++ b/src/libstd/io/process.rs @@ -601,7 +601,7 @@ mod tests { iotest!(fn stdout_works() { let mut cmd = Command::new("echo"); cmd.arg("foobar").stdout(CreatePipe(false, true)); - assert_eq!(run_output(cmd), "foobar\n".to_strbuf()); + assert_eq!(run_output(cmd), "foobar\n".to_string()); }) #[cfg(unix, not(target_os="android"))] @@ -610,7 +610,7 @@ mod tests { cmd.arg("-c").arg("pwd") .cwd(&Path::new("/")) .stdout(CreatePipe(false, true)); - assert_eq!(run_output(cmd), "/\n".to_strbuf()); + assert_eq!(run_output(cmd), "/\n".to_string()); }) #[cfg(unix, not(target_os="android"))] @@ -624,7 +624,7 @@ mod tests { drop(p.stdin.take()); let out = read_all(p.stdout.get_mut_ref() as &mut Reader); assert!(p.wait().unwrap().success()); - assert_eq!(out, "foobar\n".to_strbuf()); + assert_eq!(out, "foobar\n".to_string()); }) #[cfg(not(target_os="android"))] @@ -682,7 +682,7 @@ mod tests { let output_str = str::from_utf8(output.as_slice()).unwrap(); assert!(status.success()); - assert_eq!(output_str.trim().to_strbuf(), "hello".to_strbuf()); + assert_eq!(output_str.trim().to_string(), "hello".to_string()); // FIXME #7224 if !running_on_valgrind() { assert_eq!(error, Vec::new()); @@ -719,7 +719,7 @@ mod tests { let output_str = str::from_utf8(output.as_slice()).unwrap(); assert!(status.success()); - assert_eq!(output_str.trim().to_strbuf(), "hello".to_strbuf()); + assert_eq!(output_str.trim().to_string(), "hello".to_string()); // FIXME #7224 if !running_on_valgrind() { assert_eq!(error, Vec::new()); @@ -749,7 +749,7 @@ mod tests { let prog = pwd_cmd().spawn().unwrap(); let output = str::from_utf8(prog.wait_with_output().unwrap() - .output.as_slice()).unwrap().to_strbuf(); + .output.as_slice()).unwrap().to_string(); let parent_dir = os::getcwd(); let child_dir = Path::new(output.as_slice().trim()); @@ -768,8 +768,8 @@ mod tests { let prog = pwd_cmd().cwd(&parent_dir).spawn().unwrap(); let output = str::from_utf8(prog.wait_with_output().unwrap() - .output.as_slice()).unwrap().to_strbuf(); - let child_dir = Path::new(output.as_slice().trim().into_strbuf()); + .output.as_slice()).unwrap().to_string(); + let child_dir = Path::new(output.as_slice().trim().into_string()); let parent_stat = parent_dir.stat().unwrap(); let child_stat = child_dir.stat().unwrap(); @@ -803,7 +803,7 @@ mod tests { let prog = env_cmd().spawn().unwrap(); let output = str::from_utf8(prog.wait_with_output().unwrap() - .output.as_slice()).unwrap().to_strbuf(); + .output.as_slice()).unwrap().to_string(); let r = os::env(); for &(ref k, ref v) in r.iter() { @@ -821,12 +821,12 @@ mod tests { let mut prog = env_cmd().spawn().unwrap(); let output = str::from_utf8(prog.wait_with_output() .unwrap().output.as_slice()) - .unwrap().to_strbuf(); + .unwrap().to_string(); let r = os::env(); for &(ref k, ref v) in r.iter() { // don't check android RANDOM variables - if *k != "RANDOM".to_strbuf() { + if *k != "RANDOM".to_string() { assert!(output.as_slice() .contains(format!("{}={}", *k, @@ -843,7 +843,7 @@ mod tests { let new_env = box [("RUN_TEST_NEW_ENV", "123")]; let prog = env_cmd().env(new_env).spawn().unwrap(); let result = prog.wait_with_output().unwrap(); - let output = str::from_utf8_lossy(result.output.as_slice()).into_strbuf(); + let output = str::from_utf8_lossy(result.output.as_slice()).into_string(); assert!(output.as_slice().contains("RUN_TEST_NEW_ENV=123"), "didn't find RUN_TEST_NEW_ENV inside of:\n\n{}", output); diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs index ab7001cbc9a88..6de4c6316d1df 100644 --- a/src/libstd/io/stdio.rs +++ b/src/libstd/io/stdio.rs @@ -409,7 +409,7 @@ mod tests { set_stdout(box w); println!("hello!"); }); - assert_eq!(r.read_to_str().unwrap(), "hello!\n".to_strbuf()); + assert_eq!(r.read_to_str().unwrap(), "hello!\n".to_string()); }) iotest!(fn capture_stderr() { diff --git a/src/libstd/local_data.rs b/src/libstd/local_data.rs index 2412e18bf621a..7bf0b19407fe3 100644 --- a/src/libstd/local_data.rs +++ b/src/libstd/local_data.rs @@ -277,11 +277,11 @@ mod tests { #[test] fn test_tls_multitask() { static my_key: Key = &Key; - my_key.replace(Some("parent data".to_strbuf())); + my_key.replace(Some("parent data".to_string())); task::spawn(proc() { // TLS shouldn't carry over. assert!(my_key.get().is_none()); - my_key.replace(Some("child data".to_strbuf())); + my_key.replace(Some("child data".to_string())); assert!(my_key.get().get_ref().as_slice() == "child data"); // should be cleaned up for us }); @@ -295,16 +295,16 @@ mod tests { #[test] fn test_tls_overwrite() { static my_key: Key = &Key; - my_key.replace(Some("first data".to_strbuf())); - my_key.replace(Some("next data".to_strbuf())); // Shouldn't leak. + my_key.replace(Some("first data".to_string())); + my_key.replace(Some("next data".to_string())); // Shouldn't leak. assert!(my_key.get().unwrap().as_slice() == "next data"); } #[test] fn test_tls_pop() { static my_key: Key = &Key; - my_key.replace(Some("weasel".to_strbuf())); - assert!(my_key.replace(None).unwrap() == "weasel".to_strbuf()); + my_key.replace(Some("weasel".to_string())); + assert!(my_key.replace(None).unwrap() == "weasel".to_string()); // Pop must remove the data from the map. assert!(my_key.replace(None).is_none()); } @@ -319,7 +319,7 @@ mod tests { // a stack smaller than 1 MB. static my_key: Key = &Key; task::spawn(proc() { - my_key.replace(Some("hax".to_strbuf())); + my_key.replace(Some("hax".to_string())); }); } @@ -329,7 +329,7 @@ mod tests { static box_key: Key<@()> = &Key; static int_key: Key = &Key; task::spawn(proc() { - str_key.replace(Some("string data".to_strbuf())); + str_key.replace(Some("string data".to_string())); box_key.replace(Some(@())); int_key.replace(Some(42)); }); @@ -341,8 +341,8 @@ mod tests { static box_key: Key<@()> = &Key; static int_key: Key = &Key; task::spawn(proc() { - str_key.replace(Some("string data".to_strbuf())); - str_key.replace(Some("string data 2".to_strbuf())); + str_key.replace(Some("string data".to_string())); + str_key.replace(Some("string data 2".to_string())); box_key.replace(Some(@())); box_key.replace(Some(@())); int_key.replace(Some(42)); @@ -359,10 +359,10 @@ mod tests { static str_key: Key = &Key; static box_key: Key<@()> = &Key; static int_key: Key = &Key; - str_key.replace(Some("parent data".to_strbuf())); + str_key.replace(Some("parent data".to_string())); box_key.replace(Some(@())); task::spawn(proc() { - str_key.replace(Some("string data".to_strbuf())); + str_key.replace(Some("string data".to_string())); box_key.replace(Some(@())); int_key.replace(Some(42)); fail!(); diff --git a/src/libstd/num/int_macros.rs b/src/libstd/num/int_macros.rs index 4456c8124ba01..7ed00e3dd9d6f 100644 --- a/src/libstd/num/int_macros.rs +++ b/src/libstd/num/int_macros.rs @@ -136,39 +136,39 @@ mod tests { #[test] fn test_to_str() { - assert_eq!((0 as $T).to_str_radix(10u), "0".to_strbuf()); - assert_eq!((1 as $T).to_str_radix(10u), "1".to_strbuf()); - assert_eq!((-1 as $T).to_str_radix(10u), "-1".to_strbuf()); - assert_eq!((127 as $T).to_str_radix(16u), "7f".to_strbuf()); - assert_eq!((100 as $T).to_str_radix(10u), "100".to_strbuf()); + assert_eq!((0 as $T).to_str_radix(10u), "0".to_string()); + assert_eq!((1 as $T).to_str_radix(10u), "1".to_string()); + assert_eq!((-1 as $T).to_str_radix(10u), "-1".to_string()); + assert_eq!((127 as $T).to_str_radix(16u), "7f".to_string()); + assert_eq!((100 as $T).to_str_radix(10u), "100".to_string()); } #[test] fn test_int_to_str_overflow() { let mut i8_val: i8 = 127_i8; - assert_eq!(i8_val.to_str(), "127".to_strbuf()); + assert_eq!(i8_val.to_str(), "127".to_string()); i8_val += 1 as i8; - assert_eq!(i8_val.to_str(), "-128".to_strbuf()); + assert_eq!(i8_val.to_str(), "-128".to_string()); let mut i16_val: i16 = 32_767_i16; - assert_eq!(i16_val.to_str(), "32767".to_strbuf()); + assert_eq!(i16_val.to_str(), "32767".to_string()); i16_val += 1 as i16; - assert_eq!(i16_val.to_str(), "-32768".to_strbuf()); + assert_eq!(i16_val.to_str(), "-32768".to_string()); let mut i32_val: i32 = 2_147_483_647_i32; - assert_eq!(i32_val.to_str(), "2147483647".to_strbuf()); + assert_eq!(i32_val.to_str(), "2147483647".to_string()); i32_val += 1 as i32; - assert_eq!(i32_val.to_str(), "-2147483648".to_strbuf()); + assert_eq!(i32_val.to_str(), "-2147483648".to_string()); let mut i64_val: i64 = 9_223_372_036_854_775_807_i64; - assert_eq!(i64_val.to_str(), "9223372036854775807".to_strbuf()); + assert_eq!(i64_val.to_str(), "9223372036854775807".to_string()); i64_val += 1 as i64; - assert_eq!(i64_val.to_str(), "-9223372036854775808".to_strbuf()); + assert_eq!(i64_val.to_str(), "-9223372036854775808".to_string()); } #[test] diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs index e59e638faa9f5..4304845371746 100644 --- a/src/libstd/num/uint_macros.rs +++ b/src/libstd/num/uint_macros.rs @@ -94,13 +94,13 @@ mod tests { #[test] pub fn test_to_str() { - assert_eq!((0 as $T).to_str_radix(10u), "0".to_strbuf()); - assert_eq!((1 as $T).to_str_radix(10u), "1".to_strbuf()); - assert_eq!((2 as $T).to_str_radix(10u), "2".to_strbuf()); - assert_eq!((11 as $T).to_str_radix(10u), "11".to_strbuf()); - assert_eq!((11 as $T).to_str_radix(16u), "b".to_strbuf()); - assert_eq!((255 as $T).to_str_radix(16u), "ff".to_strbuf()); - assert_eq!((0xff as $T).to_str_radix(10u), "255".to_strbuf()); + assert_eq!((0 as $T).to_str_radix(10u), "0".to_string()); + assert_eq!((1 as $T).to_str_radix(10u), "1".to_string()); + assert_eq!((2 as $T).to_str_radix(10u), "2".to_string()); + assert_eq!((11 as $T).to_str_radix(10u), "11".to_string()); + assert_eq!((11 as $T).to_str_radix(16u), "b".to_string()); + assert_eq!((255 as $T).to_str_radix(16u), "ff".to_string()); + assert_eq!((0xff as $T).to_str_radix(10u), "255".to_string()); } #[test] @@ -133,28 +133,28 @@ mod tests { #[test] fn test_uint_to_str_overflow() { let mut u8_val: u8 = 255_u8; - assert_eq!(u8_val.to_str(), "255".to_strbuf()); + assert_eq!(u8_val.to_str(), "255".to_string()); u8_val += 1 as u8; - assert_eq!(u8_val.to_str(), "0".to_strbuf()); + assert_eq!(u8_val.to_str(), "0".to_string()); let mut u16_val: u16 = 65_535_u16; - assert_eq!(u16_val.to_str(), "65535".to_strbuf()); + assert_eq!(u16_val.to_str(), "65535".to_string()); u16_val += 1 as u16; - assert_eq!(u16_val.to_str(), "0".to_strbuf()); + assert_eq!(u16_val.to_str(), "0".to_string()); let mut u32_val: u32 = 4_294_967_295_u32; - assert_eq!(u32_val.to_str(), "4294967295".to_strbuf()); + assert_eq!(u32_val.to_str(), "4294967295".to_string()); u32_val += 1 as u32; - assert_eq!(u32_val.to_str(), "0".to_strbuf()); + assert_eq!(u32_val.to_str(), "0".to_string()); let mut u64_val: u64 = 18_446_744_073_709_551_615_u64; - assert_eq!(u64_val.to_str(), "18446744073709551615".to_strbuf()); + assert_eq!(u64_val.to_str(), "18446744073709551615".to_string()); u64_val += 1 as u64; - assert_eq!(u64_val.to_str(), "0".to_strbuf()); + assert_eq!(u64_val.to_str(), "0".to_string()); } #[test] diff --git a/src/libstd/os.rs b/src/libstd/os.rs index dbddee8fce286..7d3758d621d32 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -178,8 +178,8 @@ fn with_env_lock(f: || -> T) -> T { /// for details. pub fn env() -> Vec<(String,String)> { env_as_bytes().move_iter().map(|(k,v)| { - let k = str::from_utf8_lossy(k.as_slice()).to_strbuf(); - let v = str::from_utf8_lossy(v.as_slice()).to_strbuf(); + let k = str::from_utf8_lossy(k.as_slice()).to_string(); + let v = str::from_utf8_lossy(v.as_slice()).to_string(); (k,v) }).collect() } @@ -277,7 +277,7 @@ pub fn env_as_bytes() -> Vec<(Vec,Vec)> { /// /// Fails if `n` has any interior NULs. pub fn getenv(n: &str) -> Option { - getenv_as_bytes(n).map(|v| str::from_utf8_lossy(v.as_slice()).to_strbuf()) + getenv_as_bytes(n).map(|v| str::from_utf8_lossy(v.as_slice()).to_string()) } #[cfg(unix)] @@ -503,7 +503,7 @@ pub fn self_exe_name() -> Option { use os::win32::fill_utf16_buf_and_decode; fill_utf16_buf_and_decode(|buf, sz| { libc::GetModuleFileNameW(0u as libc::DWORD, buf, sz) - }).map(|s| s.into_strbuf().into_bytes()) + }).map(|s| s.into_string().into_bytes()) } } @@ -736,7 +736,7 @@ pub fn error_string(errnum: uint) -> String { fail!("strerror_r failure"); } - str::raw::from_c_str(p as *c_char).into_strbuf() + str::raw::from_c_str(p as *c_char).into_string() } } @@ -859,7 +859,7 @@ fn real_args_as_bytes() -> Vec> { fn real_args() -> Vec { real_args_as_bytes().move_iter() .map(|v| { - str::from_utf8_lossy(v.as_slice()).into_strbuf() + str::from_utf8_lossy(v.as_slice()).into_string() }).collect() } @@ -1522,7 +1522,7 @@ mod tests { fn test_setenv() { let n = make_rand_name(); setenv(n.as_slice(), "VALUE"); - assert_eq!(getenv(n.as_slice()), option::Some("VALUE".to_strbuf())); + assert_eq!(getenv(n.as_slice()), option::Some("VALUE".to_string())); } #[test] @@ -1539,9 +1539,9 @@ mod tests { let n = make_rand_name(); setenv(n.as_slice(), "1"); setenv(n.as_slice(), "2"); - assert_eq!(getenv(n.as_slice()), option::Some("2".to_strbuf())); + assert_eq!(getenv(n.as_slice()), option::Some("2".to_string())); setenv(n.as_slice(), ""); - assert_eq!(getenv(n.as_slice()), option::Some("".to_strbuf())); + assert_eq!(getenv(n.as_slice()), option::Some("".to_string())); } // Windows GetEnvironmentVariable requires some extra work to make sure @@ -1549,7 +1549,7 @@ mod tests { #[test] #[ignore] fn test_getenv_big() { - let mut s = "".to_strbuf(); + let mut s = "".to_string(); let mut i = 0; while i < 100 { s.push_str("aaaaaaaaaa"); @@ -1602,7 +1602,7 @@ mod tests { #[test] fn test_env_set_get_huge() { let n = make_rand_name(); - let s = "x".repeat(10000).to_strbuf(); + let s = "x".repeat(10000).to_string(); setenv(n.as_slice(), s.as_slice()); assert_eq!(getenv(n.as_slice()), Some(s)); unsetenv(n.as_slice()); @@ -1615,10 +1615,10 @@ mod tests { let mut e = env(); setenv(n.as_slice(), "VALUE"); - assert!(!e.contains(&(n.clone(), "VALUE".to_strbuf()))); + assert!(!e.contains(&(n.clone(), "VALUE".to_string()))); e = env(); - assert!(e.contains(&(n, "VALUE".to_strbuf()))); + assert!(e.contains(&(n, "VALUE".to_string()))); } #[test] diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index 011ed287215dc..c0c7a042f11c9 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -761,7 +761,7 @@ mod tests { t!(s: "a/b/c", ["d", "e"], "a/b/c/d/e"); t!(s: "a/b/c", ["d", "/e"], "/e"); t!(s: "a/b/c", ["d", "/e", "f"], "/e/f"); - t!(s: "a/b/c", ["d".to_strbuf(), "e".to_strbuf()], "a/b/c/d/e"); + t!(s: "a/b/c", ["d".to_string(), "e".to_string()], "a/b/c/d/e"); t!(v: b!("a/b/c"), [b!("d"), b!("e")], b!("a/b/c/d/e")); t!(v: b!("a/b/c"), [b!("d"), b!("/e"), b!("f")], b!("/e/f")); t!(v: b!("a/b/c"), [Vec::from_slice(b!("d")), Vec::from_slice(b!("e"))], b!("a/b/c/d/e")); @@ -866,7 +866,7 @@ mod tests { t!(s: "a/b/c", ["d", "e"], "a/b/c/d/e"); t!(s: "a/b/c", ["..", "d"], "a/b/d"); t!(s: "a/b/c", ["d", "/e", "f"], "/e/f"); - t!(s: "a/b/c", ["d".to_strbuf(), "e".to_strbuf()], "a/b/c/d/e"); + t!(s: "a/b/c", ["d".to_string(), "e".to_string()], "a/b/c/d/e"); t!(v: b!("a/b/c"), [b!("d"), b!("e")], b!("a/b/c/d/e")); t!(v: b!("a/b/c"), [Vec::from_slice(b!("d")), Vec::from_slice(b!("e"))], b!("a/b/c/d/e")); } diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index 763883a159fd7..1fc2fa1d221dc 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -587,7 +587,7 @@ impl GenericPath for Path { } } } - Some(Path::new(comps.connect("\\").into_strbuf())) + Some(Path::new(comps.connect("\\").into_string())) } } @@ -695,7 +695,7 @@ impl Path { (prefix, path) }; (prefix, match val { - None => s.into_strbuf(), + None => s.into_string(), Some(val) => val }) } @@ -1318,9 +1318,9 @@ mod tests { #[test] fn test_display_str() { let path = Path::new("foo"); - assert_eq!(path.display().to_str(), "foo".to_strbuf()); + assert_eq!(path.display().to_str(), "foo".to_string()); let path = Path::new(b!("\\")); - assert_eq!(path.filename_display().to_str(), "".to_strbuf()); + assert_eq!(path.filename_display().to_str(), "".to_string()); let path = Path::new("foo"); let mo = path.display().as_maybe_owned(); @@ -1581,7 +1581,7 @@ mod tests { t!(s: "a\\b\\c", ["d", "e"], "a\\b\\c\\d\\e"); t!(s: "a\\b\\c", ["d", "\\e"], "\\e"); t!(s: "a\\b\\c", ["d", "\\e", "f"], "\\e\\f"); - t!(s: "a\\b\\c", ["d".to_strbuf(), "e".to_strbuf()], "a\\b\\c\\d\\e"); + t!(s: "a\\b\\c", ["d".to_string(), "e".to_string()], "a\\b\\c\\d\\e"); t!(v: b!("a\\b\\c"), [b!("d"), b!("e")], b!("a\\b\\c\\d\\e")); t!(v: b!("a\\b\\c"), [b!("d"), b!("\\e"), b!("f")], b!("\\e\\f")); t!(v: b!("a\\b\\c"), [Vec::from_slice(b!("d")), Vec::from_slice(b!("e"))], @@ -1722,7 +1722,7 @@ mod tests { t!(s: "a\\b\\c", ["d", "e"], "a\\b\\c\\d\\e"); t!(s: "a\\b\\c", ["..", "d"], "a\\b\\d"); t!(s: "a\\b\\c", ["d", "\\e", "f"], "\\e\\f"); - t!(s: "a\\b\\c", ["d".to_strbuf(), "e".to_strbuf()], "a\\b\\c\\d\\e"); + t!(s: "a\\b\\c", ["d".to_string(), "e".to_string()], "a\\b\\c\\d\\e"); t!(v: b!("a\\b\\c"), [b!("d"), b!("e")], b!("a\\b\\c\\d\\e")); t!(v: b!("a\\b\\c"), [Vec::from_slice(b!("d")), Vec::from_slice(b!("e"))], b!("a\\b\\c\\d\\e")); diff --git a/src/libstd/repr.rs b/src/libstd/repr.rs index d800232d3b873..969c20d8b55de 100644 --- a/src/libstd/repr.rs +++ b/src/libstd/repr.rs @@ -609,7 +609,7 @@ pub fn repr_to_str(t: &T) -> String { let mut result = io::MemWriter::new(); write_repr(&mut result as &mut io::Writer, t).unwrap(); - str::from_utf8(result.unwrap().as_slice()).unwrap().to_strbuf() + str::from_utf8(result.unwrap().as_slice()).unwrap().to_string() } #[cfg(test)] diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs index cd59de8899a10..7f492a00b80db 100644 --- a/src/libstd/rt/task.rs +++ b/src/libstd/rt/task.rs @@ -421,10 +421,10 @@ mod test { #[test] fn tls() { local_data_key!(key: @String) - key.replace(Some(@"data".to_strbuf())); + key.replace(Some(@"data".to_string())); assert_eq!(key.get().unwrap().as_slice(), "data"); local_data_key!(key2: @String) - key2.replace(Some(@"data".to_strbuf())); + key2.replace(Some(@"data".to_string())); assert_eq!(key2.get().unwrap().as_slice(), "data"); } diff --git a/src/libstd/slice.rs b/src/libstd/slice.rs index ca75f33f0fe32..e5c0cc3babd03 100644 --- a/src/libstd/slice.rs +++ b/src/libstd/slice.rs @@ -1839,18 +1839,18 @@ mod tests { }) ) let empty: ~[int] = box []; - test_show_vec!(empty, "[]".to_strbuf()); - test_show_vec!(box [1], "[1]".to_strbuf()); - test_show_vec!(box [1, 2, 3], "[1, 2, 3]".to_strbuf()); + test_show_vec!(empty, "[]".to_string()); + test_show_vec!(box [1], "[1]".to_string()); + test_show_vec!(box [1, 2, 3], "[1, 2, 3]".to_string()); test_show_vec!(box [box [], box [1u], box [1u, 1u]], - "[[], [1], [1, 1]]".to_strbuf()); + "[[], [1], [1, 1]]".to_string()); let empty_mut: &mut [int] = &mut[]; - test_show_vec!(empty_mut, "[]".to_strbuf()); - test_show_vec!(&mut[1], "[1]".to_strbuf()); - test_show_vec!(&mut[1, 2, 3], "[1, 2, 3]".to_strbuf()); + test_show_vec!(empty_mut, "[]".to_string()); + test_show_vec!(&mut[1], "[1]".to_string()); + test_show_vec!(&mut[1, 2, 3], "[1, 2, 3]".to_string()); test_show_vec!(&mut[&mut[], &mut[1u], &mut[1u, 1u]], - "[[], [1], [1, 1]]".to_strbuf()); + "[[], [1], [1, 1]]".to_string()); } #[test] diff --git a/src/libstd/str.rs b/src/libstd/str.rs index 988c029c9b932..bbb89ccd8010a 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -726,13 +726,13 @@ pub trait StrAllocating: Str { /// Convert `self` into a `String`. #[inline] - fn to_strbuf(&self) -> String { + fn to_string(&self) -> String { String::from_str(self.as_slice()) } /// Convert `self` into a `String`, not making a copy if possible. #[inline] - fn into_strbuf(self) -> String { + fn into_string(self) -> String { self.into_owned() } @@ -1009,7 +1009,7 @@ mod tests { assert!(data.slice(2u, 4u).find_str("ab").is_none()); let string = "ประเทศไทย中华Việt Nam"; - let mut data = string.to_strbuf(); + let mut data = string.to_string(); data.push_str(string); assert!(data.as_slice().find_str("ไท华").is_none()); assert_eq!(data.as_slice().slice(0u, 43u).find_str(""), Some(0u)); @@ -1532,10 +1532,10 @@ mod tests { #[test] fn vec_str_conversions() { - let s1: String = "All mimsy were the borogoves".to_strbuf(); + let s1: String = "All mimsy were the borogoves".to_string(); let v: Vec = Vec::from_slice(s1.as_bytes()); - let s2: String = from_utf8(v.as_slice()).unwrap().to_strbuf(); + let s2: String = from_utf8(v.as_slice()).unwrap().to_string(); let mut i: uint = 0u; let n1: uint = s1.len(); let n2: uint = v.len(); @@ -1968,30 +1968,30 @@ mod tests { #[test] fn test_nfd_chars() { - assert_eq!("abc".nfd_chars().collect::(), "abc".to_strbuf()); - assert_eq!("\u1e0b\u01c4".nfd_chars().collect::(), "d\u0307\u01c4".to_strbuf()); - assert_eq!("\u2026".nfd_chars().collect::(), "\u2026".to_strbuf()); - assert_eq!("\u2126".nfd_chars().collect::(), "\u03a9".to_strbuf()); - assert_eq!("\u1e0b\u0323".nfd_chars().collect::(), "d\u0323\u0307".to_strbuf()); - assert_eq!("\u1e0d\u0307".nfd_chars().collect::(), "d\u0323\u0307".to_strbuf()); - assert_eq!("a\u0301".nfd_chars().collect::(), "a\u0301".to_strbuf()); - assert_eq!("\u0301a".nfd_chars().collect::(), "\u0301a".to_strbuf()); - assert_eq!("\ud4db".nfd_chars().collect::(), "\u1111\u1171\u11b6".to_strbuf()); - assert_eq!("\uac1c".nfd_chars().collect::(), "\u1100\u1162".to_strbuf()); + assert_eq!("abc".nfd_chars().collect::(), "abc".to_string()); + assert_eq!("\u1e0b\u01c4".nfd_chars().collect::(), "d\u0307\u01c4".to_string()); + assert_eq!("\u2026".nfd_chars().collect::(), "\u2026".to_string()); + assert_eq!("\u2126".nfd_chars().collect::(), "\u03a9".to_string()); + assert_eq!("\u1e0b\u0323".nfd_chars().collect::(), "d\u0323\u0307".to_string()); + assert_eq!("\u1e0d\u0307".nfd_chars().collect::(), "d\u0323\u0307".to_string()); + assert_eq!("a\u0301".nfd_chars().collect::(), "a\u0301".to_string()); + assert_eq!("\u0301a".nfd_chars().collect::(), "\u0301a".to_string()); + assert_eq!("\ud4db".nfd_chars().collect::(), "\u1111\u1171\u11b6".to_string()); + assert_eq!("\uac1c".nfd_chars().collect::(), "\u1100\u1162".to_string()); } #[test] fn test_nfkd_chars() { - assert_eq!("abc".nfkd_chars().collect::(), "abc".to_strbuf()); - assert_eq!("\u1e0b\u01c4".nfkd_chars().collect::(), "d\u0307DZ\u030c".to_strbuf()); - assert_eq!("\u2026".nfkd_chars().collect::(), "...".to_strbuf()); - assert_eq!("\u2126".nfkd_chars().collect::(), "\u03a9".to_strbuf()); - assert_eq!("\u1e0b\u0323".nfkd_chars().collect::(), "d\u0323\u0307".to_strbuf()); - assert_eq!("\u1e0d\u0307".nfkd_chars().collect::(), "d\u0323\u0307".to_strbuf()); - assert_eq!("a\u0301".nfkd_chars().collect::(), "a\u0301".to_strbuf()); - assert_eq!("\u0301a".nfkd_chars().collect::(), "\u0301a".to_strbuf()); - assert_eq!("\ud4db".nfkd_chars().collect::(), "\u1111\u1171\u11b6".to_strbuf()); - assert_eq!("\uac1c".nfkd_chars().collect::(), "\u1100\u1162".to_strbuf()); + assert_eq!("abc".nfkd_chars().collect::(), "abc".to_string()); + assert_eq!("\u1e0b\u01c4".nfkd_chars().collect::(), "d\u0307DZ\u030c".to_string()); + assert_eq!("\u2026".nfkd_chars().collect::(), "...".to_string()); + assert_eq!("\u2126".nfkd_chars().collect::(), "\u03a9".to_string()); + assert_eq!("\u1e0b\u0323".nfkd_chars().collect::(), "d\u0323\u0307".to_string()); + assert_eq!("\u1e0d\u0307".nfkd_chars().collect::(), "d\u0323\u0307".to_string()); + assert_eq!("a\u0301".nfkd_chars().collect::(), "a\u0301".to_string()); + assert_eq!("\u0301a".nfkd_chars().collect::(), "\u0301a".to_string()); + assert_eq!("\ud4db".nfkd_chars().collect::(), "\u1111\u1171\u11b6".to_string()); + assert_eq!("\uac1c".nfkd_chars().collect::(), "\u1100\u1162".to_string()); } #[test] @@ -2113,7 +2113,7 @@ mod tests { #[test] fn test_from_str() { let owned: Option = from_str("string"); - assert_eq!(owned, Some("string".to_strbuf())); + assert_eq!(owned, Some("string".to_string())); } #[test] @@ -2129,8 +2129,8 @@ mod tests { let o = Owned("abcde".to_string()); assert_eq!(o.len(), 5); assert_eq!(o.as_slice(), "abcde"); - assert_eq!(o.to_str(), "abcde".to_strbuf()); - assert_eq!(format_strbuf!("{}", o), "abcde".to_strbuf()); + assert_eq!(o.to_str(), "abcde".to_string()); + assert_eq!(format_strbuf!("{}", o), "abcde".to_string()); assert!(o.lt(&Slice("bcdef"))); assert_eq!(Owned("".to_string()), Default::default()); diff --git a/src/libstd/string.rs b/src/libstd/string.rs index 8897750df654a..dce96cb2e8f32 100644 --- a/src/libstd/string.rs +++ b/src/libstd/string.rs @@ -328,7 +328,7 @@ impl StrAllocating for String { } #[inline] - fn into_strbuf(self) -> String { + fn into_string(self) -> String { self } } @@ -362,7 +362,7 @@ impl<'a, S: Str> Equiv for String { impl FromStr for String { #[inline] fn from_str(s: &str) -> Option { - Some(s.to_strbuf()) + Some(s.to_string()) } } diff --git a/src/libstd/task.rs b/src/libstd/task.rs index 37244b26ad596..4824a9561078f 100644 --- a/src/libstd/task.rs +++ b/src/libstd/task.rs @@ -497,12 +497,12 @@ fn test_try_fail_message_static_str() { #[test] fn test_try_fail_message_owned_str() { match try(proc() { - fail!("owned string".to_strbuf()); + fail!("owned string".to_string()); }) { Err(e) => { type T = String; assert!(e.is::()); - assert_eq!(*e.move::().unwrap(), "owned string".to_strbuf()); + assert_eq!(*e.move::().unwrap(), "owned string".to_string()); } Ok(()) => fail!() } diff --git a/src/libstd/to_str.rs b/src/libstd/to_str.rs index afc71ab88d928..c2100111e1268 100644 --- a/src/libstd/to_str.rs +++ b/src/libstd/to_str.rs @@ -42,23 +42,23 @@ mod tests { #[test] fn test_simple_types() { - assert_eq!(1i.to_str(), "1".to_strbuf()); - assert_eq!((-1i).to_str(), "-1".to_strbuf()); - assert_eq!(200u.to_str(), "200".to_strbuf()); - assert_eq!(2u8.to_str(), "2".to_strbuf()); - assert_eq!(true.to_str(), "true".to_strbuf()); - assert_eq!(false.to_str(), "false".to_strbuf()); - assert_eq!(().to_str(), "()".to_strbuf()); - assert_eq!(("hi".to_strbuf()).to_str(), "hi".to_strbuf()); + assert_eq!(1i.to_str(), "1".to_string()); + assert_eq!((-1i).to_str(), "-1".to_string()); + assert_eq!(200u.to_str(), "200".to_string()); + assert_eq!(2u8.to_str(), "2".to_string()); + assert_eq!(true.to_str(), "true".to_string()); + assert_eq!(false.to_str(), "false".to_string()); + assert_eq!(().to_str(), "()".to_string()); + assert_eq!(("hi".to_string()).to_str(), "hi".to_string()); } #[test] fn test_vectors() { let x: ~[int] = box []; - assert_eq!(x.to_str(), "[]".to_strbuf()); - assert_eq!((box [1]).to_str(), "[1]".to_strbuf()); - assert_eq!((box [1, 2, 3]).to_str(), "[1, 2, 3]".to_strbuf()); + assert_eq!(x.to_str(), "[]".to_string()); + assert_eq!((box [1]).to_str(), "[1]".to_string()); + assert_eq!((box [1, 2, 3]).to_str(), "[1, 2, 3]".to_string()); assert!((box [box [], box [1], box [1, 1]]).to_str() == - "[[], [1], [1, 1]]".to_strbuf()); + "[[], [1], [1, 1]]".to_string()); } } diff --git a/src/libstd/unstable/dynamic_lib.rs b/src/libstd/unstable/dynamic_lib.rs index 6302ab39dd87c..81eb51107ba06 100644 --- a/src/libstd/unstable/dynamic_lib.rs +++ b/src/libstd/unstable/dynamic_lib.rs @@ -240,7 +240,7 @@ pub mod dl { } else { Err(CString::new(last_error, false).as_str() .unwrap() - .to_strbuf()) + .to_string()) }; ret diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index 24330584714fa..81f6c7c7c9b7d 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -1850,9 +1850,9 @@ mod tests { let b: ~[u8] = FromVec::from_vec(a); assert_eq!(b.as_slice(), &[]); - let a = vec!["one".to_strbuf(), "two".to_strbuf()]; + let a = vec!["one".to_string(), "two".to_string()]; let b: ~[String] = FromVec::from_vec(a); - assert_eq!(b.as_slice(), &["one".to_strbuf(), "two".to_strbuf()]); + assert_eq!(b.as_slice(), &["one".to_string(), "two".to_string()]); struct Foo { x: uint, diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index a6cc12fef7c52..6b81f8ee2e108 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -89,7 +89,7 @@ pub fn path_to_str>(mut path: PI) -> String { } s.push_str(e.as_slice()); s - }).to_strbuf() + }).to_string() } #[deriving(Clone)] @@ -679,61 +679,61 @@ fn node_id_to_str(map: &Map, id: NodeId) -> String { ItemImpl(..) => "impl", ItemMac(..) => "macro" }; - (format!("{} {} (id={})", item_str, path_str, id)).to_strbuf() + (format!("{} {} (id={})", item_str, path_str, id)).to_string() } Some(NodeForeignItem(item)) => { let path_str = map.path_to_str_with_ident(id, item.ident); - (format!("foreign item {} (id={})", path_str, id)).to_strbuf() + (format!("foreign item {} (id={})", path_str, id)).to_string() } Some(NodeMethod(m)) => { (format!("method {} in {} (id={})", token::get_ident(m.ident), - map.path_to_str(id), id)).to_strbuf() + map.path_to_str(id), id)).to_string() } Some(NodeTraitMethod(ref tm)) => { let m = ast_util::trait_method_to_ty_method(&**tm); (format!("method {} in {} (id={})", token::get_ident(m.ident), - map.path_to_str(id), id)).to_strbuf() + map.path_to_str(id), id)).to_string() } Some(NodeVariant(ref variant)) => { (format!("variant {} in {} (id={})", token::get_ident(variant.node.name), - map.path_to_str(id), id)).to_strbuf() + map.path_to_str(id), id)).to_string() } Some(NodeExpr(expr)) => { (format!("expr {} (id={})", - pprust::expr_to_str(expr), id)).to_strbuf() + pprust::expr_to_str(expr), id)).to_string() } Some(NodeStmt(stmt)) => { (format!("stmt {} (id={})", - pprust::stmt_to_str(stmt), id)).to_strbuf() + pprust::stmt_to_str(stmt), id)).to_string() } Some(NodeArg(pat)) => { (format!("arg {} (id={})", - pprust::pat_to_str(pat), id)).to_strbuf() + pprust::pat_to_str(pat), id)).to_string() } Some(NodeLocal(pat)) => { (format!("local {} (id={})", - pprust::pat_to_str(pat), id)).to_strbuf() + pprust::pat_to_str(pat), id)).to_string() } Some(NodePat(pat)) => { - (format!("pat {} (id={})", pprust::pat_to_str(pat), id)).to_strbuf() + (format!("pat {} (id={})", pprust::pat_to_str(pat), id)).to_string() } Some(NodeBlock(block)) => { (format!("block {} (id={})", - pprust::block_to_str(block), id)).to_strbuf() + pprust::block_to_str(block), id)).to_string() } Some(NodeStructCtor(_)) => { (format!("struct_ctor {} (id={})", - map.path_to_str(id), id)).to_strbuf() + map.path_to_str(id), id)).to_string() } Some(NodeLifetime(ref l)) => { (format!("lifetime {} (id={})", - pprust::lifetime_to_str(*l), id)).to_strbuf() + pprust::lifetime_to_str(*l), id)).to_string() } None => { - (format!("unknown node (id={})", id)).to_strbuf() + (format!("unknown node (id={})", id)).to_string() } } } diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 876e537fc8c66..3e41e58fbe218 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -27,8 +27,8 @@ use std::u32; pub fn path_name_i(idents: &[Ident]) -> String { // FIXME: Bad copies (#2543 -- same for everything else that says "bad") idents.iter().map(|i| { - token::get_ident(*i).get().to_strbuf() - }).collect::>().connect("::").to_strbuf() + token::get_ident(*i).get().to_string() + }).collect::>().connect("::").to_string() } // totally scary function: ignores all but the last element, should have @@ -156,8 +156,8 @@ pub fn int_ty_to_str(t: IntTy, val: Option, mode: SuffixMode) -> String { // cast to a u64 so we can correctly print INT64_MIN. All integral types // are parsed as u64, so we wouldn't want to print an extra negative // sign. - Some(n) => format!("{}{}", n as u64, s).to_strbuf(), - None => s.to_strbuf() + Some(n) => format!("{}{}", n as u64, s).to_string(), + None => s.to_string() } } @@ -186,8 +186,8 @@ pub fn uint_ty_to_str(t: UintTy, val: Option, mode: SuffixMode) -> String { }; match val { - Some(n) => format!("{}{}", n, s).to_strbuf(), - None => s.to_strbuf() + Some(n) => format!("{}{}", n, s).to_string(), + None => s.to_string() } } @@ -202,9 +202,9 @@ pub fn uint_ty_max(t: UintTy) -> u64 { pub fn float_ty_to_str(t: FloatTy) -> String { match t { - TyF32 => "f32".to_strbuf(), - TyF64 => "f64".to_strbuf(), - TyF128 => "f128".to_strbuf(), + TyF32 => "f32".to_string(), + TyF64 => "f64".to_string(), + TyF128 => "f128".to_string(), } } diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 563bf15486d67..1ef7576335ba5 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -276,8 +276,8 @@ impl FileMap { let begin = begin.to_uint(); let slice = self.src.as_slice().slice_from(begin); match slice.find('\n') { - Some(e) => slice.slice_to(e).to_strbuf(), - None => slice.to_strbuf() + Some(e) => slice.slice_to(e).to_string(), + None => slice.to_string() } } @@ -333,7 +333,7 @@ impl CodeMap { let filemap = Rc::new(FileMap { name: filename, - src: src.to_strbuf(), + src: src.to_string(), start_pos: Pos::from_uint(start_pos), lines: RefCell::new(Vec::new()), multibyte_chars: RefCell::new(Vec::new()), @@ -349,7 +349,7 @@ impl CodeMap { (format!("<{}:{}:{}>", pos.file.name, pos.line, - pos.col.to_uint() + 1)).to_strbuf() + pos.col.to_uint() + 1)).to_string() } /// Lookup source information about a BytePos @@ -360,7 +360,7 @@ impl CodeMap { pub fn lookup_char_pos_adj(&self, pos: BytePos) -> LocWithOpt { let loc = self.lookup_char_pos(pos); LocWithOpt { - filename: loc.file.name.to_strbuf(), + filename: loc.file.name.to_string(), line: loc.line, col: loc.col, file: Some(loc.file) @@ -369,7 +369,7 @@ impl CodeMap { pub fn span_to_str(&self, sp: Span) -> String { if self.files.borrow().len() == 0 && sp == DUMMY_SP { - return "no-location".to_strbuf(); + return "no-location".to_string(); } let lo = self.lookup_char_pos_adj(sp.lo); @@ -379,11 +379,11 @@ impl CodeMap { lo.line, lo.col.to_uint() + 1, hi.line, - hi.col.to_uint() + 1)).to_strbuf() + hi.col.to_uint() + 1)).to_string() } pub fn span_to_filename(&self, sp: Span) -> FileName { - self.lookup_char_pos(sp.lo).file.name.to_strbuf() + self.lookup_char_pos(sp.lo).file.name.to_string() } pub fn span_to_lines(&self, sp: Span) -> FileLines { @@ -408,7 +408,7 @@ impl CodeMap { None } else { Some(begin.fm.src.as_slice().slice(begin.pos.to_uint(), - end.pos.to_uint()).to_strbuf()) + end.pos.to_uint()).to_string()) } } @@ -535,21 +535,21 @@ mod test { #[test] fn t1 () { let cm = CodeMap::new(); - let fm = cm.new_filemap("blork.rs".to_strbuf(), - "first line.\nsecond line".to_strbuf()); + let fm = cm.new_filemap("blork.rs".to_string(), + "first line.\nsecond line".to_string()); fm.next_line(BytePos(0)); - assert_eq!(&fm.get_line(0),&"first line.".to_strbuf()); + assert_eq!(&fm.get_line(0),&"first line.".to_string()); // TESTING BROKEN BEHAVIOR: fm.next_line(BytePos(10)); - assert_eq!(&fm.get_line(1), &".".to_strbuf()); + assert_eq!(&fm.get_line(1), &".".to_string()); } #[test] #[should_fail] fn t2 () { let cm = CodeMap::new(); - let fm = cm.new_filemap("blork.rs".to_strbuf(), - "first line.\nsecond line".to_strbuf()); + let fm = cm.new_filemap("blork.rs".to_string(), + "first line.\nsecond line".to_string()); // TESTING *REALLY* BROKEN BEHAVIOR: fm.next_line(BytePos(0)); fm.next_line(BytePos(10)); @@ -558,12 +558,12 @@ mod test { fn init_code_map() -> CodeMap { let cm = CodeMap::new(); - let fm1 = cm.new_filemap("blork.rs".to_strbuf(), - "first line.\nsecond line".to_strbuf()); - let fm2 = cm.new_filemap("empty.rs".to_strbuf(), - "".to_strbuf()); - let fm3 = cm.new_filemap("blork2.rs".to_strbuf(), - "first line.\nsecond line".to_strbuf()); + let fm1 = cm.new_filemap("blork.rs".to_string(), + "first line.\nsecond line".to_string()); + let fm2 = cm.new_filemap("empty.rs".to_string(), + "".to_string()); + let fm3 = cm.new_filemap("blork2.rs".to_string(), + "first line.\nsecond line".to_string()); fm1.next_line(BytePos(0)); fm1.next_line(BytePos(12)); @@ -580,11 +580,11 @@ mod test { let cm = init_code_map(); let fmabp1 = cm.lookup_byte_offset(BytePos(22)); - assert_eq!(fmabp1.fm.name, "blork.rs".to_strbuf()); + assert_eq!(fmabp1.fm.name, "blork.rs".to_string()); assert_eq!(fmabp1.pos, BytePos(22)); let fmabp2 = cm.lookup_byte_offset(BytePos(24)); - assert_eq!(fmabp2.fm.name, "blork2.rs".to_strbuf()); + assert_eq!(fmabp2.fm.name, "blork2.rs".to_string()); assert_eq!(fmabp2.pos, BytePos(0)); } @@ -606,12 +606,12 @@ mod test { let cm = init_code_map(); let loc1 = cm.lookup_char_pos(BytePos(22)); - assert_eq!(loc1.file.name, "blork.rs".to_strbuf()); + assert_eq!(loc1.file.name, "blork.rs".to_string()); assert_eq!(loc1.line, 2); assert_eq!(loc1.col, CharPos(10)); let loc2 = cm.lookup_char_pos(BytePos(24)); - assert_eq!(loc2.file.name, "blork2.rs".to_strbuf()); + assert_eq!(loc2.file.name, "blork2.rs".to_string()); assert_eq!(loc2.line, 1); assert_eq!(loc2.col, CharPos(0)); } @@ -620,10 +620,10 @@ mod test { let cm = CodeMap::new(); // € is a three byte utf8 char. let fm1 = - cm.new_filemap("blork.rs".to_strbuf(), - "fir€st €€€€ line.\nsecond line".to_strbuf()); - let fm2 = cm.new_filemap("blork2.rs".to_strbuf(), - "first line€€.\n€ second line".to_strbuf()); + cm.new_filemap("blork.rs".to_string(), + "fir€st €€€€ line.\nsecond line".to_string()); + let fm2 = cm.new_filemap("blork2.rs".to_string(), + "first line€€.\n€ second line".to_string()); fm1.next_line(BytePos(0)); fm1.next_line(BytePos(22)); @@ -667,7 +667,7 @@ mod test { let span = Span {lo: BytePos(12), hi: BytePos(23), expn_info: None}; let file_lines = cm.span_to_lines(span); - assert_eq!(file_lines.file.name, "blork.rs".to_strbuf()); + assert_eq!(file_lines.file.name, "blork.rs".to_string()); assert_eq!(file_lines.lines.len(), 1); assert_eq!(*file_lines.lines.get(0), 1u); } @@ -679,7 +679,7 @@ mod test { let span = Span {lo: BytePos(12), hi: BytePos(23), expn_info: None}; let snippet = cm.span_to_snippet(span); - assert_eq!(snippet, Some("second line".to_strbuf())); + assert_eq!(snippet, Some("second line".to_string())); } #[test] @@ -689,6 +689,6 @@ mod test { let span = Span {lo: BytePos(12), hi: BytePos(23), expn_info: None}; let sstr = cm.span_to_str(span); - assert_eq!(sstr, "blork.rs:2:1: 2:12".to_strbuf()); + assert_eq!(sstr, "blork.rs:2:1: 2:12".to_string()); } } diff --git a/src/libsyntax/crateid.rs b/src/libsyntax/crateid.rs index fea165eb2ceb2..329ddcad461e2 100644 --- a/src/libsyntax/crateid.rs +++ b/src/libsyntax/crateid.rs @@ -65,7 +65,7 @@ impl FromStr for CrateId { let inferred_name = *path_pieces.get(0); let (name, version) = if pieces.len() == 1 { - (inferred_name.to_strbuf(), None) + (inferred_name.to_string(), None) } else { let hash_pieces: Vec<&str> = pieces.get(1) .splitn(':', 1) @@ -77,16 +77,16 @@ impl FromStr for CrateId { }; let name = if !hash_name.is_empty() { - hash_name.to_strbuf() + hash_name.to_string() } else { - inferred_name.to_strbuf() + inferred_name.to_string() }; let version = if !hash_version.is_empty() { if hash_version == "0.0" { None } else { - Some(hash_version.to_strbuf()) + Some(hash_version.to_string()) } } else { None @@ -96,7 +96,7 @@ impl FromStr for CrateId { }; Some(CrateId { - path: path.to_strbuf(), + path: path.to_string(), name: name, version: version, }) @@ -112,7 +112,7 @@ impl CrateId { } pub fn short_name_with_version(&self) -> String { - (format!("{}-{}", self.name, self.version_or_default())).to_strbuf() + (format!("{}-{}", self.name, self.version_or_default())).to_string() } pub fn matches(&self, other: &CrateId) -> bool { @@ -128,17 +128,17 @@ impl CrateId { #[test] fn bare_name() { let crateid: CrateId = from_str("foo").expect("valid crateid"); - assert_eq!(crateid.name, "foo".to_strbuf()); + assert_eq!(crateid.name, "foo".to_string()); assert_eq!(crateid.version, None); - assert_eq!(crateid.path, "foo".to_strbuf()); + assert_eq!(crateid.path, "foo".to_string()); } #[test] fn bare_name_single_char() { let crateid: CrateId = from_str("f").expect("valid crateid"); - assert_eq!(crateid.name, "f".to_strbuf()); + assert_eq!(crateid.name, "f".to_string()); assert_eq!(crateid.version, None); - assert_eq!(crateid.path, "f".to_strbuf()); + assert_eq!(crateid.path, "f".to_string()); } #[test] @@ -150,17 +150,17 @@ fn empty_crateid() { #[test] fn simple_path() { let crateid: CrateId = from_str("example.com/foo/bar").expect("valid crateid"); - assert_eq!(crateid.name, "bar".to_strbuf()); + assert_eq!(crateid.name, "bar".to_string()); assert_eq!(crateid.version, None); - assert_eq!(crateid.path, "example.com/foo/bar".to_strbuf()); + assert_eq!(crateid.path, "example.com/foo/bar".to_string()); } #[test] fn simple_version() { let crateid: CrateId = from_str("foo#1.0").expect("valid crateid"); - assert_eq!(crateid.name, "foo".to_strbuf()); - assert_eq!(crateid.version, Some("1.0".to_strbuf())); - assert_eq!(crateid.path, "foo".to_strbuf()); + assert_eq!(crateid.name, "foo".to_string()); + assert_eq!(crateid.version, Some("1.0".to_string())); + assert_eq!(crateid.path, "foo".to_string()); } #[test] @@ -178,39 +178,39 @@ fn path_ends_with_slash() { #[test] fn path_and_version() { let crateid: CrateId = from_str("example.com/foo/bar#1.0").expect("valid crateid"); - assert_eq!(crateid.name, "bar".to_strbuf()); - assert_eq!(crateid.version, Some("1.0".to_strbuf())); - assert_eq!(crateid.path, "example.com/foo/bar".to_strbuf()); + assert_eq!(crateid.name, "bar".to_string()); + assert_eq!(crateid.version, Some("1.0".to_string())); + assert_eq!(crateid.path, "example.com/foo/bar".to_string()); } #[test] fn single_chars() { let crateid: CrateId = from_str("a/b#1").expect("valid crateid"); - assert_eq!(crateid.name, "b".to_strbuf()); - assert_eq!(crateid.version, Some("1".to_strbuf())); - assert_eq!(crateid.path, "a/b".to_strbuf()); + assert_eq!(crateid.name, "b".to_string()); + assert_eq!(crateid.version, Some("1".to_string())); + assert_eq!(crateid.path, "a/b".to_string()); } #[test] fn missing_version() { let crateid: CrateId = from_str("foo#").expect("valid crateid"); - assert_eq!(crateid.name, "foo".to_strbuf()); + assert_eq!(crateid.name, "foo".to_string()); assert_eq!(crateid.version, None); - assert_eq!(crateid.path, "foo".to_strbuf()); + assert_eq!(crateid.path, "foo".to_string()); } #[test] fn path_and_name() { let crateid: CrateId = from_str("foo/rust-bar#bar:1.0").expect("valid crateid"); - assert_eq!(crateid.name, "bar".to_strbuf()); - assert_eq!(crateid.version, Some("1.0".to_strbuf())); - assert_eq!(crateid.path, "foo/rust-bar".to_strbuf()); + assert_eq!(crateid.name, "bar".to_string()); + assert_eq!(crateid.version, Some("1.0".to_string())); + assert_eq!(crateid.path, "foo/rust-bar".to_string()); } #[test] fn empty_name() { let crateid: CrateId = from_str("foo/bar#:1.0").expect("valid crateid"); - assert_eq!(crateid.name, "bar".to_strbuf()); - assert_eq!(crateid.version, Some("1.0".to_strbuf())); - assert_eq!(crateid.path, "foo/bar".to_strbuf()); + assert_eq!(crateid.name, "bar".to_string()); + assert_eq!(crateid.version, Some("1.0".to_string())); + assert_eq!(crateid.path, "foo/bar".to_string()); } diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index c6a25bc6129b3..49da91e10533d 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -143,7 +143,7 @@ impl Handler { let s; match self.err_count.get() { 0u => return, - 1u => s = "aborting due to previous error".to_strbuf(), + 1u => s = "aborting due to previous error".to_string(), _ => { s = format!("aborting due to {} previous errors", self.err_count.get()); @@ -492,7 +492,7 @@ fn print_macro_backtrace(w: &mut EmitterWriter, let ss = ei.callee .span .as_ref() - .map_or("".to_strbuf(), |span| cm.span_to_str(*span)); + .map_or("".to_string(), |span| cm.span_to_str(*span)); let (pre, post) = match ei.callee.format { codemap::MacroAttribute => ("#[", "]"), codemap::MacroBang => ("", "!") diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 0808533cb4395..26c1945db885e 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -550,7 +550,7 @@ pub fn get_single_str_from_tts(cx: &ExtCtxt, match tts[0] { ast::TTTok(_, token::LIT_STR(ident)) | ast::TTTok(_, token::LIT_STR_RAW(ident, _)) => { - return Some(token::get_ident(ident).get().to_strbuf()) + return Some(token::get_ident(ident).get().to_string()) } _ => { cx.span_err(sp, diff --git a/src/libsyntax/ext/deriving/generic/mod.rs b/src/libsyntax/ext/deriving/generic/mod.rs index 5f18193437e9a..0f4af144eadea 100644 --- a/src/libsyntax/ext/deriving/generic/mod.rs +++ b/src/libsyntax/ext/deriving/generic/mod.rs @@ -882,7 +882,7 @@ impl<'a> MethodDef<'a> { } else { // there are still matches to create let current_match_str = if match_count == 0 { - "__self".to_strbuf() + "__self".to_string() } else { format!("__arg_{}", match_count) }; @@ -1011,7 +1011,7 @@ impl<'a> TraitDef<'a> { to_set.expn_info = Some(@codemap::ExpnInfo { call_site: to_set, callee: codemap::NameAndSpan { - name: format!("deriving({})", trait_name).to_strbuf(), + name: format!("deriving({})", trait_name).to_string(), format: codemap::MacroAttribute, span: Some(self.span) } diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 6c6bf52010406..984a3dc7efb7c 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -70,7 +70,7 @@ pub fn expand_expr(e: @ast::Expr, fld: &mut MacroExpander) -> @ast::Expr { fld.cx.bt_push(ExpnInfo { call_site: e.span, callee: NameAndSpan { - name: extnamestr.get().to_strbuf(), + name: extnamestr.get().to_string(), format: MacroBang, span: exp_span, }, @@ -270,7 +270,7 @@ pub fn expand_item(it: @ast::Item, fld: &mut MacroExpander) fld.cx.bt_push(ExpnInfo { call_site: attr.span, callee: NameAndSpan { - name: mname.get().to_strbuf(), + name: mname.get().to_string(), format: MacroAttribute, span: None } @@ -342,7 +342,7 @@ fn expand_item_modifiers(mut it: @ast::Item, fld: &mut MacroExpander) fld.cx.bt_push(ExpnInfo { call_site: attr.span, callee: NameAndSpan { - name: mname.get().to_strbuf(), + name: mname.get().to_string(), format: MacroAttribute, span: None, } @@ -402,7 +402,7 @@ pub fn expand_item_mac(it: @ast::Item, fld: &mut MacroExpander) fld.cx.bt_push(ExpnInfo { call_site: it.span, callee: NameAndSpan { - name: extnamestr.get().to_strbuf(), + name: extnamestr.get().to_string(), format: MacroBang, span: span } @@ -421,7 +421,7 @@ pub fn expand_item_mac(it: @ast::Item, fld: &mut MacroExpander) fld.cx.bt_push(ExpnInfo { call_site: it.span, callee: NameAndSpan { - name: extnamestr.get().to_strbuf(), + name: extnamestr.get().to_string(), format: MacroBang, span: span } @@ -502,7 +502,7 @@ fn load_extern_macros(krate: &ast::ViewItem, fld: &mut MacroExpander) { _ => unreachable!() }; let name = format!("<{} macros>", token::get_ident(crate_name)); - let name = name.to_strbuf(); + let name = name.to_string(); for source in macros.iter() { let item = parse::parse_item_from_source_str(name.clone(), @@ -592,7 +592,7 @@ pub fn expand_stmt(s: &Stmt, fld: &mut MacroExpander) -> SmallVector<@Stmt> { fld.cx.bt_push(ExpnInfo { call_site: s.span, callee: NameAndSpan { - name: extnamestr.get().to_strbuf(), + name: extnamestr.get().to_string(), format: MacroBang, span: exp_span, } @@ -1037,10 +1037,10 @@ mod test { #[should_fail] #[test] fn macros_cant_escape_fns_test () { let src = "fn bogus() {macro_rules! z (() => (3+4))}\ - fn inty() -> int { z!() }".to_strbuf(); + fn inty() -> int { z!() }".to_string(); let sess = parse::new_parse_sess(); let crate_ast = parse::parse_crate_from_source_str( - "".to_strbuf(), + "".to_string(), src, Vec::new(), &sess); // should fail: @@ -1057,10 +1057,10 @@ mod test { #[should_fail] #[test] fn macros_cant_escape_mods_test () { let src = "mod foo {macro_rules! z (() => (3+4))}\ - fn inty() -> int { z!() }".to_strbuf(); + fn inty() -> int { z!() }".to_string(); let sess = parse::new_parse_sess(); let crate_ast = parse::parse_crate_from_source_str( - "".to_strbuf(), + "".to_string(), src, Vec::new(), &sess); // should fail: @@ -1076,10 +1076,10 @@ mod test { // macro_escape modules shouldn't cause macros to leave scope #[test] fn macros_can_escape_flattened_mods_test () { let src = "#[macro_escape] mod foo {macro_rules! z (() => (3+4))}\ - fn inty() -> int { z!() }".to_strbuf(); + fn inty() -> int { z!() }".to_string(); let sess = parse::new_parse_sess(); let crate_ast = parse::parse_crate_from_source_str( - "".to_strbuf(), + "".to_string(), src, Vec::new(), &sess); // should fail: @@ -1143,7 +1143,7 @@ mod test { #[test] fn macro_tokens_should_match(){ expand_crate_str( - "macro_rules! m((a)=>(13)) fn main(){m!(a);}".to_strbuf()); + "macro_rules! m((a)=>(13)) fn main(){m!(a);}".to_string()); } // renaming tests expand a crate and then check that the bindings match @@ -1201,7 +1201,7 @@ mod test { let (teststr, bound_connections, bound_ident_check) = match *t { (ref str,ref conns, bic) => (str.to_owned(), conns.clone(), bic) }; - let cr = expand_crate_str(teststr.to_strbuf()); + let cr = expand_crate_str(teststr.to_string()); // find the bindings: let mut name_finder = new_name_finder(Vec::new()); visit::walk_crate(&mut name_finder,&cr,()); @@ -1276,7 +1276,7 @@ mod test { let crate_str = "macro_rules! fmt_wrap(($b:expr)=>($b.to_str())) macro_rules! foo_module (() => (mod generated { fn a() { let xx = 147; fmt_wrap!(xx);}})) foo_module!() -".to_strbuf(); +".to_string(); let cr = expand_crate_str(crate_str); // find the xx binding let mut name_finder = new_name_finder(Vec::new()); @@ -1323,7 +1323,7 @@ foo_module!() #[test] fn pat_idents(){ let pat = string_to_pat( - "(a,Foo{x:c @ (b,9),y:Bar(4,d)})".to_strbuf()); + "(a,Foo{x:c @ (b,9),y:Bar(4,d)})".to_string()); let mut pat_idents = new_name_finder(Vec::new()); pat_idents.visit_pat(pat, ()); assert_eq!(pat_idents.ident_accumulator, diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs index 9a0b91be14689..86652cd50b0dc 100644 --- a/src/libsyntax/ext/format.rs +++ b/src/libsyntax/ext/format.rs @@ -148,8 +148,8 @@ fn parse_args(ecx: &mut ExtCtxt, sp: Span, allow_method: bool, continue } } - order.push(name.to_strbuf()); - names.insert(name.to_strbuf(), e); + order.push(name.to_string()); + names.insert(name.to_string(), e); } else { args.push(p.parse_expr()); } @@ -188,13 +188,13 @@ impl<'a, 'b> Context<'a, 'b> { Exact(i) } parse::ArgumentIs(i) => Exact(i), - parse::ArgumentNamed(s) => Named(s.to_strbuf()), + parse::ArgumentNamed(s) => Named(s.to_string()), }; // and finally the method being applied match arg.method { None => { - let ty = Known(arg.format.ty.to_strbuf()); + let ty = Known(arg.format.ty.to_string()); self.verify_arg_type(pos, ty); } Some(ref method) => { self.verify_method(pos, *method); } @@ -216,7 +216,7 @@ impl<'a, 'b> Context<'a, 'b> { self.verify_arg_type(Exact(i), Unsigned); } parse::CountIsName(s) => { - self.verify_arg_type(Named(s.to_strbuf()), Unsigned); + self.verify_arg_type(Named(s.to_string()), Unsigned); } parse::CountIsNextParam => { if self.check_positional_ok() { diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index ce8ada7071b3b..62e052b0bb91c 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -72,7 +72,7 @@ pub mod rt { impl ToSource for ast::Ident { fn to_source(&self) -> String { - get_ident(*self).get().to_strbuf() + get_ident(*self).get().to_string() } } @@ -88,7 +88,7 @@ pub mod rt { .map(|i| i.to_source()) .collect::>() .connect("\n\n") - .to_strbuf() + .to_string() } } @@ -104,7 +104,7 @@ pub mod rt { .map(|i| i.to_source()) .collect::>() .connect(", ") - .to_strbuf() + .to_string() } } @@ -136,7 +136,7 @@ pub mod rt { impl ToSource for () { fn to_source(&self) -> String { - "()".to_strbuf() + "()".to_string() } } @@ -281,7 +281,7 @@ pub mod rt { fn parse_item(&self, s: String) -> @ast::Item { let res = parse::parse_item_from_source_str( - "".to_strbuf(), + "".to_string(), s, self.cfg(), self.parse_sess()); @@ -295,7 +295,7 @@ pub mod rt { } fn parse_stmt(&self, s: String) -> @ast::Stmt { - parse::parse_stmt_from_source_str("".to_strbuf(), + parse::parse_stmt_from_source_str("".to_string(), s, self.cfg(), Vec::new(), @@ -303,14 +303,14 @@ pub mod rt { } fn parse_expr(&self, s: String) -> @ast::Expr { - parse::parse_expr_from_source_str("".to_strbuf(), + parse::parse_expr_from_source_str("".to_string(), s, self.cfg(), self.parse_sess()) } fn parse_tts(&self, s: String) -> Vec { - parse::parse_tts_from_source_str("".to_strbuf(), + parse::parse_tts_from_source_str("".to_string(), s, self.cfg(), self.parse_sess()) @@ -686,10 +686,10 @@ fn expand_wrapper(cx: &ExtCtxt, cx_expr: @ast::Expr, expr: @ast::Expr) -> @ast::Expr { let uses = vec![ cx.view_use_glob(sp, ast::Inherited, - ids_ext(vec!["syntax".to_strbuf(), - "ext".to_strbuf(), - "quote".to_strbuf(), - "rt".to_strbuf()])) ]; + ids_ext(vec!["syntax".to_string(), + "ext".to_string(), + "quote".to_string(), + "rt".to_string()])) ]; let stmt_let_ext_cx = cx.stmt_let(sp, false, id_ext("ext_cx"), cx_expr); diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index 04ce607e9f5c1..d2e689b5934f0 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -73,7 +73,7 @@ pub fn expand_mod(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) base::check_zero_tts(cx, sp, tts, "module_path!"); let string = cx.mod_path() .iter() - .map(|x| token::get_ident(*x).get().to_strbuf()) + .map(|x| token::get_ident(*x).get().to_string()) .collect::>() .connect("::"); base::MacExpr::new(cx.expr_str( @@ -125,9 +125,9 @@ pub fn expand_include_str(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) Some(src) => { // Add this input file to the code map to make it available as // dependency information - let filename = file.display().to_str().to_strbuf(); + let filename = file.display().to_str().to_string(); let interned = token::intern_and_get_ident(src); - cx.codemap().new_filemap(filename, src.to_strbuf()); + cx.codemap().new_filemap(filename, src.to_string()); base::MacExpr::new(cx.expr_str(sp, interned)) } diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 8780620ced54c..a92802aa3389e 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -372,9 +372,9 @@ pub fn parse(sess: &ParseSess, } return Success(nameize(sess, ms, v.as_slice())); } else if eof_eis.len() > 1u { - return Error(sp, "ambiguity: multiple successful parses".to_strbuf()); + return Error(sp, "ambiguity: multiple successful parses".to_string()); } else { - return Failure(sp, "unexpected end of macro invocation".to_strbuf()); + return Failure(sp, "unexpected end of macro invocation".to_string()); } } else { if (bb_eis.len() > 0u && next_eis.len() > 0u) @@ -384,17 +384,17 @@ pub fn parse(sess: &ParseSess, MatchNonterminal(bind, name, _) => { (format!("{} ('{}')", token::get_ident(name), - token::get_ident(bind))).to_strbuf() + token::get_ident(bind))).to_string() } _ => fail!() } }).collect::>().connect(" or "); return Error(sp, format!( "local ambiguity: multiple parsing options: \ built-in NTs {} or {} other options.", - nts, next_eis.len()).to_strbuf()); + nts, next_eis.len()).to_string()); } else if bb_eis.len() == 0u && next_eis.len() == 0u { return Failure(sp, format!("no rules expected the token `{}`", - token::to_str(&tok)).to_strbuf()); + token::to_str(&tok)).to_string()); } else if next_eis.len() > 0u { /* Now process the next token */ while next_eis.len() > 0u { diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index f234b0c234d16..1bc0c7f7959d0 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -132,7 +132,7 @@ fn generic_extension(cx: &ExtCtxt, // Which arm's failure should we report? (the one furthest along) let mut best_fail_spot = DUMMY_SP; - let mut best_fail_msg = "internal error: ran no matchers".to_strbuf(); + let mut best_fail_msg = "internal error: ran no matchers".to_string(); for (i, lhs) in lhses.iter().enumerate() { // try each arm's matchers match **lhs { @@ -247,7 +247,7 @@ pub fn add_new_extension(cx: &mut ExtCtxt, box MacroRulesDefiner { def: RefCell::new(Some(MacroDef { - name: token::get_ident(name).to_str().to_strbuf(), + name: token::get_ident(name).to_str().to_string(), ext: NormalTT(exp, Some(sp)) })) } as Box diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index 055821c40fe55..4b0e2171062f6 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -117,7 +117,7 @@ fn lis_merge(lhs: LockstepIterSize, rhs: LockstepIterSize) -> LockstepIterSize { let r_n = token::get_ident(r_id); LisContradiction(format!("inconsistent lockstep iteration: \ '{}' has {} items, but '{}' has {}", - l_n, l_len, r_n, r_len).to_strbuf()) + l_n, l_len, r_n, r_len).to_string()) } } } diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index ae5cf550bb9bc..9cccde1b7ea0a 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -963,13 +963,13 @@ mod test { #[test] fn ident_transformation () { let mut zz_fold = ToZzIdentFolder; let ast = string_to_crate( - "#[a] mod b {fn c (d : e, f : g) {h!(i,j,k);l;m}}".to_strbuf()); + "#[a] mod b {fn c (d : e, f : g) {h!(i,j,k);l;m}}".to_string()); let folded_crate = zz_fold.fold_crate(ast); assert_pred!( matches_codepattern, "matches_codepattern", pprust::to_str(|s| fake_print_crate(s, &folded_crate)), - "#[a]mod zz{fn zz(zz:zz,zz:zz){zz!(zz,zz,zz);zz;zz}}".to_strbuf()); + "#[a]mod zz{fn zz(zz:zz,zz:zz){zz!(zz,zz,zz);zz;zz}}".to_string()); } // even inside macro defs.... @@ -977,12 +977,12 @@ mod test { let mut zz_fold = ToZzIdentFolder; let ast = string_to_crate( "macro_rules! a {(b $c:expr $(d $e:token)f+ => \ - (g $(d $d $e)+))} ".to_strbuf()); + (g $(d $d $e)+))} ".to_string()); let folded_crate = zz_fold.fold_crate(ast); assert_pred!( matches_codepattern, "matches_codepattern", pprust::to_str(|s| fake_print_crate(s, &folded_crate)), - "zz!zz((zz$zz:zz$(zz $zz:zz)zz+=>(zz$(zz$zz$zz)+)))".to_strbuf()); + "zz!zz((zz$zz:zz$(zz $zz:zz)zz+=>(zz$(zz$zz$zz)+)))".to_string()); } } diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs index 907e89622d08b..cc08cb429f55f 100644 --- a/src/libsyntax/parse/comments.rs +++ b/src/libsyntax/parse/comments.rs @@ -111,7 +111,7 @@ pub fn strip_doc_comment_decoration(comment: &str) -> String { if can_trim { lines.iter().map(|line| { - line.as_slice().slice(i + 1, line.len()).to_strbuf() + line.as_slice().slice(i + 1, line.len()).to_string() }).collect() } else { lines @@ -122,20 +122,20 @@ pub fn strip_doc_comment_decoration(comment: &str) -> String { static ONLINERS: &'static [&'static str] = &["///!", "///", "//!", "//"]; for prefix in ONLINERS.iter() { if comment.starts_with(*prefix) { - return comment.slice_from(prefix.len()).to_strbuf(); + return comment.slice_from(prefix.len()).to_string(); } } if comment.starts_with("/*") { let lines = comment.slice(3u, comment.len() - 2u) .lines_any() - .map(|s| s.to_strbuf()) + .map(|s| s.to_string()) .collect:: >(); let lines = vertical_trim(lines); let lines = horizontal_trim(lines); - return lines.connect("\n").to_strbuf(); + return lines.connect("\n").to_string(); } fail!("not a doc-comment: {}", comment); @@ -247,9 +247,9 @@ fn trim_whitespace_prefix_and_push_line(lines: &mut Vec , let s1 = match all_whitespace(s.as_slice(), col) { Some(col) => { if col < len { - s.as_slice().slice(col, len).to_strbuf() + s.as_slice().slice(col, len).to_string() } else { - "".to_strbuf() + "".to_string() } } None => s, @@ -368,7 +368,7 @@ pub fn gather_comments_and_literals(span_diagnostic: srdr: &mut io::Reader) -> (Vec, Vec) { let src = srdr.read_to_end().unwrap(); - let src = str::from_utf8(src.as_slice()).unwrap().to_strbuf(); + let src = str::from_utf8(src.as_slice()).unwrap().to_string(); let cm = CodeMap::new(); let filemap = cm.new_filemap(path, src); let mut rdr = lexer::new_low_level_string_reader(span_diagnostic, filemap); @@ -399,7 +399,7 @@ pub fn gather_comments_and_literals(span_diagnostic: if token::is_lit(&tok) { with_str_from(&rdr, bstart, |s| { debug!("tok lit: {}", s); - literals.push(Literal {lit: s.to_strbuf(), pos: sp.lo}); + literals.push(Literal {lit: s.to_string(), pos: sp.lo}); }) } else { debug!("tok: {}", token::to_str(&tok)); @@ -417,41 +417,41 @@ mod test { #[test] fn test_block_doc_comment_1() { let comment = "/**\n * Test \n ** Test\n * Test\n*/"; let stripped = strip_doc_comment_decoration(comment); - assert_eq!(stripped, " Test \n* Test\n Test".to_strbuf()); + assert_eq!(stripped, " Test \n* Test\n Test".to_string()); } #[test] fn test_block_doc_comment_2() { let comment = "/**\n * Test\n * Test\n*/"; let stripped = strip_doc_comment_decoration(comment); - assert_eq!(stripped, " Test\n Test".to_strbuf()); + assert_eq!(stripped, " Test\n Test".to_string()); } #[test] fn test_block_doc_comment_3() { let comment = "/**\n let a: *int;\n *a = 5;\n*/"; let stripped = strip_doc_comment_decoration(comment); - assert_eq!(stripped, " let a: *int;\n *a = 5;".to_strbuf()); + assert_eq!(stripped, " let a: *int;\n *a = 5;".to_string()); } #[test] fn test_block_doc_comment_4() { let comment = "/*******************\n test\n *********************/"; let stripped = strip_doc_comment_decoration(comment); - assert_eq!(stripped, " test".to_strbuf()); + assert_eq!(stripped, " test".to_string()); } #[test] fn test_line_doc_comment() { let stripped = strip_doc_comment_decoration("/// test"); - assert_eq!(stripped, " test".to_strbuf()); + assert_eq!(stripped, " test".to_string()); let stripped = strip_doc_comment_decoration("///! test"); - assert_eq!(stripped, " test".to_strbuf()); + assert_eq!(stripped, " test".to_string()); let stripped = strip_doc_comment_decoration("// test"); - assert_eq!(stripped, " test".to_strbuf()); + assert_eq!(stripped, " test".to_string()); let stripped = strip_doc_comment_decoration("// test"); - assert_eq!(stripped, " test".to_strbuf()); + assert_eq!(stripped, " test".to_string()); let stripped = strip_doc_comment_decoration("///test"); - assert_eq!(stripped, "test".to_strbuf()); + assert_eq!(stripped, "test".to_string()); let stripped = strip_doc_comment_decoration("///!test"); - assert_eq!(stripped, "test".to_strbuf()); + assert_eq!(stripped, "test".to_string()); let stripped = strip_doc_comment_decoration("//test"); - assert_eq!(stripped, "test".to_strbuf()); + assert_eq!(stripped, "test".to_string()); } } diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index e045116c9e2e6..fb67a76b85b4c 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -156,14 +156,14 @@ fn err_span(rdr: &mut StringReader, from_pos: BytePos, to_pos: BytePos, m: &str) fn fatal_span_char(rdr: &mut StringReader, from_pos: BytePos, to_pos: BytePos, m: &str, c: char) -> ! { - let mut m = m.to_strbuf(); + let mut m = m.to_string(); m.push_str(": "); char::escape_default(c, |c| m.push_char(c)); fatal_span(rdr, from_pos, to_pos, m.as_slice()); } fn err_span_char(rdr: &mut StringReader, from_pos: BytePos, to_pos: BytePos, m: &str, c: char) { - let mut m = m.to_strbuf(); + let mut m = m.to_string(); m.push_str(": "); char::escape_default(c, |c| m.push_char(c)); err_span(rdr, from_pos, to_pos, m.as_slice()); @@ -172,7 +172,7 @@ fn err_span_char(rdr: &mut StringReader, from_pos: BytePos, to_pos: BytePos, m: // report a lexical error spanning [`from_pos`, `to_pos`), appending the // offending string to the error message fn fatal_span_verbose(rdr: &mut StringReader, from_pos: BytePos, to_pos: BytePos, m: &str) -> ! { - let mut m = m.to_strbuf(); + let mut m = m.to_string(); m.push_str(": "); let from = byte_offset(rdr, from_pos).to_uint(); let to = byte_offset(rdr, to_pos).to_uint(); @@ -528,7 +528,7 @@ fn scan_number(c: char, rdr: &mut StringReader) -> token::Token { } if num_str.len() == 0u { err_span(rdr, start_bpos, rdr.last_pos, "no valid digits found for number"); - num_str = "1".to_strbuf(); + num_str = "1".to_string(); } let parsed = match from_str_radix::(num_str.as_slice(), base as uint) { @@ -594,7 +594,7 @@ fn scan_number(c: char, rdr: &mut StringReader) -> token::Token { } else { if num_str.len() == 0u { err_span(rdr, start_bpos, rdr.last_pos, "no valid digits found for number"); - num_str = "1".to_strbuf(); + num_str = "1".to_string(); } let parsed = match from_str_radix::(num_str.as_slice(), base as uint) { @@ -1003,7 +1003,7 @@ mod test { // open a string reader for the given string fn setup<'a>(span_handler: &'a diagnostic::SpanHandler, teststr: String) -> StringReader<'a> { - let fm = span_handler.cm.new_filemap("zebra.rs".to_strbuf(), teststr); + let fm = span_handler.cm.new_filemap("zebra.rs".to_string(), teststr); new_string_reader(span_handler, fm) } @@ -1011,7 +1011,7 @@ mod test { let span_handler = mk_sh(); let mut string_reader = setup(&span_handler, "/* my source file */ \ - fn main() { println!(\"zebra\"); }\n".to_strbuf()); + fn main() { println!(\"zebra\"); }\n".to_string()); let id = str_to_ident("fn"); let tok1 = string_reader.next_token(); let tok2 = TokenAndSpan{ @@ -1044,55 +1044,55 @@ mod test { } #[test] fn doublecolonparsing () { - check_tokenization(setup(&mk_sh(), "a b".to_strbuf()), + check_tokenization(setup(&mk_sh(), "a b".to_string()), vec!(mk_ident("a",false), mk_ident("b",false))); } #[test] fn dcparsing_2 () { - check_tokenization(setup(&mk_sh(), "a::b".to_strbuf()), + check_tokenization(setup(&mk_sh(), "a::b".to_string()), vec!(mk_ident("a",true), token::MOD_SEP, mk_ident("b",false))); } #[test] fn dcparsing_3 () { - check_tokenization(setup(&mk_sh(), "a ::b".to_strbuf()), + check_tokenization(setup(&mk_sh(), "a ::b".to_string()), vec!(mk_ident("a",false), token::MOD_SEP, mk_ident("b",false))); } #[test] fn dcparsing_4 () { - check_tokenization(setup(&mk_sh(), "a:: b".to_strbuf()), + check_tokenization(setup(&mk_sh(), "a:: b".to_string()), vec!(mk_ident("a",true), token::MOD_SEP, mk_ident("b",false))); } #[test] fn character_a() { - assert_eq!(setup(&mk_sh(), "'a'".to_strbuf()).next_token().tok, + assert_eq!(setup(&mk_sh(), "'a'".to_string()).next_token().tok, token::LIT_CHAR('a')); } #[test] fn character_space() { - assert_eq!(setup(&mk_sh(), "' '".to_strbuf()).next_token().tok, + assert_eq!(setup(&mk_sh(), "' '".to_string()).next_token().tok, token::LIT_CHAR(' ')); } #[test] fn character_escaped() { - assert_eq!(setup(&mk_sh(), "'\\n'".to_strbuf()).next_token().tok, + assert_eq!(setup(&mk_sh(), "'\\n'".to_string()).next_token().tok, token::LIT_CHAR('\n')); } #[test] fn lifetime_name() { - assert_eq!(setup(&mk_sh(), "'abc".to_strbuf()).next_token().tok, + assert_eq!(setup(&mk_sh(), "'abc".to_string()).next_token().tok, token::LIFETIME(token::str_to_ident("abc"))); } #[test] fn raw_string() { assert_eq!(setup(&mk_sh(), - "r###\"\"#a\\b\x00c\"\"###".to_strbuf()).next_token() + "r###\"\"#a\\b\x00c\"\"###".to_string()).next_token() .tok, token::LIT_STR_RAW(token::str_to_ident("\"#a\\b\x00c\""), 3)); } @@ -1105,7 +1105,7 @@ mod test { #[test] fn nested_block_comments() { assert_eq!(setup(&mk_sh(), - "/* /* */ */'a'".to_strbuf()).next_token().tok, + "/* /* */ */'a'".to_string()).next_token().tok, token::LIT_CHAR('a')); } diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index c4947b528f12e..ce89a7dec39e7 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -232,8 +232,8 @@ pub fn file_to_filemap(sess: &ParseSess, path: &Path, spanopt: Option) }; match str::from_utf8(bytes.as_slice()) { Some(s) => { - return string_to_filemap(sess, s.to_strbuf(), - path.as_str().unwrap().to_strbuf()) + return string_to_filemap(sess, s.to_string(), + path.as_str().unwrap().to_string()) } None => { err(format!("{} is not UTF-8 encoded", path.display()).as_slice()) @@ -297,7 +297,7 @@ mod test { let mut writer = MemWriter::new(); let mut encoder = json::Encoder::new(&mut writer as &mut io::Writer); let _ = val.encode(&mut encoder); - str::from_utf8(writer.unwrap().as_slice()).unwrap().to_strbuf() + str::from_utf8(writer.unwrap().as_slice()).unwrap().to_string() } // produce a codemap::span @@ -306,7 +306,7 @@ mod test { } #[test] fn path_exprs_1() { - assert!(string_to_expr("a".to_strbuf()) == + assert!(string_to_expr("a".to_string()) == @ast::Expr{ id: ast::DUMMY_NODE_ID, node: ast::ExprPath(ast::Path { @@ -325,7 +325,7 @@ mod test { } #[test] fn path_exprs_2 () { - assert!(string_to_expr("::a::b".to_strbuf()) == + assert!(string_to_expr("::a::b".to_string()) == @ast::Expr { id: ast::DUMMY_NODE_ID, node: ast::ExprPath(ast::Path { @@ -350,12 +350,12 @@ mod test { #[should_fail] #[test] fn bad_path_expr_1() { - string_to_expr("::abc::def::return".to_strbuf()); + string_to_expr("::abc::def::return".to_string()); } // check the token-tree-ization of macros #[test] fn string_to_tts_macro () { - let tts = string_to_tts("macro_rules! zip (($a)=>($a))".to_strbuf()); + let tts = string_to_tts("macro_rules! zip (($a)=>($a))".to_string()); let tts: &[ast::TokenTree] = tts.as_slice(); match tts { [ast::TTTok(_,_), @@ -408,7 +408,7 @@ mod test { } #[test] fn string_to_tts_1 () { - let tts = string_to_tts("fn a (b : int) { b; }".to_strbuf()); + let tts = string_to_tts("fn a (b : int) { b; }".to_string()); assert_eq!(to_json_str(&tts), "[\ {\ @@ -532,12 +532,12 @@ mod test { ]\ ]\ }\ -]".to_strbuf() +]".to_string() ); } #[test] fn ret_expr() { - assert!(string_to_expr("return d".to_strbuf()) == + assert!(string_to_expr("return d".to_string()) == @ast::Expr{ id: ast::DUMMY_NODE_ID, node:ast::ExprRet(Some(@ast::Expr{ @@ -560,7 +560,7 @@ mod test { } #[test] fn parse_stmt_1 () { - assert!(string_to_stmt("b;".to_strbuf()) == + assert!(string_to_stmt("b;".to_string()) == @Spanned{ node: ast::StmtExpr(@ast::Expr { id: ast::DUMMY_NODE_ID, @@ -587,7 +587,7 @@ mod test { #[test] fn parse_ident_pat () { let sess = new_parse_sess(); - let mut parser = string_to_parser(&sess, "b".to_strbuf()); + let mut parser = string_to_parser(&sess, "b".to_string()); assert!(parser.parse_pat() == @ast::Pat{id: ast::DUMMY_NODE_ID, node: ast::PatIdent( @@ -611,7 +611,7 @@ mod test { // check the contents of the tt manually: #[test] fn parse_fundecl () { // this test depends on the intern order of "fn" and "int" - assert!(string_to_item("fn a (b : int) { b; }".to_strbuf()) == + assert!(string_to_item("fn a (b : int) { b; }".to_string()) == Some( @ast::Item{ident:str_to_ident("a"), attrs:Vec::new(), @@ -703,8 +703,8 @@ mod test { #[test] fn parse_exprs () { // just make sure that they parse.... - string_to_expr("3 + 4".to_strbuf()); - string_to_expr("a::z.froob(b,@(987+3))".to_strbuf()); + string_to_expr("3 + 4".to_string()); + string_to_expr("a::z.froob(b,@(987+3))".to_string()); } #[test] fn attrs_fix_bug () { @@ -719,7 +719,7 @@ mod test { fn wb() -> c_int { O_WRONLY as c_int } let mut fflags: c_int = wb(); -}".to_strbuf()); +}".to_string()); } } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index b5ddd6cd20f74..a8736b5b2c0b0 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -407,7 +407,7 @@ impl<'a> Parser<'a> { let mut i = tokens.iter(); // This might be a sign we need a connect method on Iterator. let b = i.next() - .map_or("".to_strbuf(), |t| Parser::token_to_str(t)); + .map_or("".to_string(), |t| Parser::token_to_str(t)); i.fold(b, |b,a| { let mut b = b; b.push_str("`, `"); @@ -4171,7 +4171,7 @@ impl<'a> Parser<'a> { self.span_err(id_sp, "cannot declare a new module at this location"); let this_module = match self.mod_path_stack.last() { - Some(name) => name.get().to_strbuf(), + Some(name) => name.get().to_string(), None => self.root_module_name.get_ref().clone(), }; self.span_note(id_sp, @@ -4212,7 +4212,7 @@ impl<'a> Parser<'a> { }; self.eval_src_mod_from_path(file_path, owns_directory, - mod_string.get().to_strbuf(), id_sp) + mod_string.get().to_string(), id_sp) } fn eval_src_mod_from_path(&mut self, diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index e3788801293f3..2c090d053a3d2 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -138,32 +138,32 @@ impl fmt::Show for Nonterminal { pub fn binop_to_str(o: BinOp) -> String { match o { - PLUS => "+".to_strbuf(), - MINUS => "-".to_strbuf(), - STAR => "*".to_strbuf(), - SLASH => "/".to_strbuf(), - PERCENT => "%".to_strbuf(), - CARET => "^".to_strbuf(), - AND => "&".to_strbuf(), - OR => "|".to_strbuf(), - SHL => "<<".to_strbuf(), - SHR => ">>".to_strbuf() + PLUS => "+".to_string(), + MINUS => "-".to_string(), + STAR => "*".to_string(), + SLASH => "/".to_string(), + PERCENT => "%".to_string(), + CARET => "^".to_string(), + AND => "&".to_string(), + OR => "|".to_string(), + SHL => "<<".to_string(), + SHR => ">>".to_string() } } pub fn to_str(t: &Token) -> String { match *t { - EQ => "=".to_strbuf(), - LT => "<".to_strbuf(), - LE => "<=".to_strbuf(), - EQEQ => "==".to_strbuf(), - NE => "!=".to_strbuf(), - GE => ">=".to_strbuf(), - GT => ">".to_strbuf(), - NOT => "!".to_strbuf(), - TILDE => "~".to_strbuf(), - OROR => "||".to_strbuf(), - ANDAND => "&&".to_strbuf(), + EQ => "=".to_string(), + LT => "<".to_string(), + LE => "<=".to_string(), + EQEQ => "==".to_string(), + NE => "!=".to_string(), + GE => ">=".to_string(), + GT => ">".to_string(), + NOT => "!".to_string(), + TILDE => "~".to_string(), + OROR => "||".to_string(), + ANDAND => "&&".to_string(), BINOP(op) => binop_to_str(op), BINOPEQ(op) => { let mut s = binop_to_str(op); @@ -172,25 +172,25 @@ pub fn to_str(t: &Token) -> String { } /* Structural symbols */ - AT => "@".to_strbuf(), - DOT => ".".to_strbuf(), - DOTDOT => "..".to_strbuf(), - DOTDOTDOT => "...".to_strbuf(), - COMMA => ",".to_strbuf(), - SEMI => ";".to_strbuf(), - COLON => ":".to_strbuf(), - MOD_SEP => "::".to_strbuf(), - RARROW => "->".to_strbuf(), - LARROW => "<-".to_strbuf(), - FAT_ARROW => "=>".to_strbuf(), - LPAREN => "(".to_strbuf(), - RPAREN => ")".to_strbuf(), - LBRACKET => "[".to_strbuf(), - RBRACKET => "]".to_strbuf(), - LBRACE => "{".to_strbuf(), - RBRACE => "}".to_strbuf(), - POUND => "#".to_strbuf(), - DOLLAR => "$".to_strbuf(), + AT => "@".to_string(), + DOT => ".".to_string(), + DOTDOT => "..".to_string(), + DOTDOTDOT => "...".to_string(), + COMMA => ",".to_string(), + SEMI => ";".to_string(), + COLON => ":".to_string(), + MOD_SEP => "::".to_string(), + RARROW => "->".to_string(), + LARROW => "<-".to_string(), + FAT_ARROW => "=>".to_string(), + LPAREN => "(".to_string(), + RPAREN => ")".to_string(), + LBRACKET => "[".to_string(), + RBRACKET => "]".to_string(), + LBRACE => "{".to_string(), + RBRACE => "}".to_string(), + POUND => "#".to_string(), + DOLLAR => "$".to_string(), /* Literals */ LIT_CHAR(c) => { @@ -205,7 +205,7 @@ pub fn to_str(t: &Token) -> String { ast_util::ForceSuffix), LIT_UINT(u, t) => ast_util::uint_ty_to_str(t, Some(u), ast_util::ForceSuffix), - LIT_INT_UNSUFFIXED(i) => { (i as u64).to_str().to_strbuf() } + LIT_INT_UNSUFFIXED(i) => { (i as u64).to_str().to_string() } LIT_FLOAT(s, t) => { let mut body = String::from_str(get_ident(s).get()); if body.as_slice().ends_with(".") { @@ -222,29 +222,29 @@ pub fn to_str(t: &Token) -> String { body } LIT_STR(s) => { - (format!("\"{}\"", get_ident(s).get().escape_default())).to_strbuf() + (format!("\"{}\"", get_ident(s).get().escape_default())).to_string() } LIT_STR_RAW(s, n) => { (format!("r{delim}\"{string}\"{delim}", - delim="#".repeat(n), string=get_ident(s))).to_strbuf() + delim="#".repeat(n), string=get_ident(s))).to_string() } /* Name components */ - IDENT(s, _) => get_ident(s).get().to_strbuf(), + IDENT(s, _) => get_ident(s).get().to_string(), LIFETIME(s) => { - (format!("'{}", get_ident(s))).to_strbuf() + (format!("'{}", get_ident(s))).to_string() } - UNDERSCORE => "_".to_strbuf(), + UNDERSCORE => "_".to_string(), /* Other */ - DOC_COMMENT(s) => get_ident(s).get().to_strbuf(), - EOF => "".to_strbuf(), + DOC_COMMENT(s) => get_ident(s).get().to_string(), + EOF => "".to_string(), INTERPOLATED(ref nt) => { match nt { &NtExpr(e) => ::print::pprust::expr_to_str(e), &NtMeta(e) => ::print::pprust::meta_item_to_str(e), _ => { - let mut s = "an interpolated ".to_strbuf(); + let mut s = "an interpolated ".to_string(); match *nt { NtItem(..) => s.push_str("item"), NtBlock(..) => s.push_str("block"), diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index f45462da42371..669378b313ad1 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -111,11 +111,11 @@ impl Token { pub fn tok_str(t: Token) -> String { match t { - String(s, len) => return format!("STR({},{})", s, len).to_strbuf(), - Break(_) => return "BREAK".to_strbuf(), - Begin(_) => return "BEGIN".to_strbuf(), - End => return "END".to_strbuf(), - Eof => return "EOF".to_strbuf() + String(s, len) => return format!("STR({},{})", s, len).to_string(), + Break(_) => return "BREAK".to_string(), + Begin(_) => return "BEGIN".to_string(), + End => return "END".to_string(), + Eof => return "EOF".to_string() } } @@ -142,7 +142,7 @@ pub fn buf_str(toks: Vec, i %= n; } s.push_char(']'); - return s.into_strbuf(); + return s.into_string(); } pub enum PrintStackBreak { @@ -627,15 +627,15 @@ pub fn end(p: &mut Printer) -> io::IoResult<()> { p.pretty_print(End) } pub fn eof(p: &mut Printer) -> io::IoResult<()> { p.pretty_print(Eof) } pub fn word(p: &mut Printer, wrd: &str) -> io::IoResult<()> { - p.pretty_print(String(/* bad */ wrd.to_strbuf(), wrd.len() as int)) + p.pretty_print(String(/* bad */ wrd.to_string(), wrd.len() as int)) } pub fn huge_word(p: &mut Printer, wrd: &str) -> io::IoResult<()> { - p.pretty_print(String(/* bad */ wrd.to_strbuf(), SIZE_INFINITY)) + p.pretty_print(String(/* bad */ wrd.to_string(), SIZE_INFINITY)) } pub fn zero_word(p: &mut Printer, wrd: &str) -> io::IoResult<()> { - p.pretty_print(String(/* bad */ wrd.to_strbuf(), 0)) + p.pretty_print(String(/* bad */ wrd.to_string(), 0)) } pub fn spaces(p: &mut Printer, n: uint) -> io::IoResult<()> { diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index c5fa6351630f2..3cb2d0b421c2f 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -144,7 +144,7 @@ pub fn to_str(f: |&mut State| -> IoResult<()>) -> String { let result = str::from_utf8_owned(Vec::from_slice(wr.get_ref())).unwrap(); mem::forget(wr); - result.to_strbuf() + result.to_string() } } @@ -243,8 +243,8 @@ pub fn variant_to_str(var: &ast::Variant) -> String { pub fn visibility_qualified(vis: ast::Visibility, s: &str) -> String { match vis { - ast::Public => format!("pub {}", s).to_strbuf(), - ast::Inherited => s.to_strbuf() + ast::Public => format!("pub {}", s).to_string(), + ast::Inherited => s.to_string() } } @@ -2475,7 +2475,7 @@ mod test { let generics = ast_util::empty_generics(); assert_eq!(&fun_to_str(&decl, ast::NormalFn, abba_ident, None, &generics), - &"fn abba()".to_strbuf()); + &"fn abba()".to_string()); } #[test] @@ -2493,6 +2493,6 @@ mod test { }); let varstr = variant_to_str(&var); - assert_eq!(&varstr,&"pub principal_skinner".to_strbuf()); + assert_eq!(&varstr,&"pub principal_skinner".to_string()); } } diff --git a/src/libsyntax/util/interner.rs b/src/libsyntax/util/interner.rs index 9c88ab14143f5..72600921ba9c7 100644 --- a/src/libsyntax/util/interner.rs +++ b/src/libsyntax/util/interner.rs @@ -121,7 +121,7 @@ impl fmt::Show for RcStr { impl RcStr { pub fn new(string: &str) -> RcStr { RcStr { - string: Rc::new(string.to_strbuf()), + string: Rc::new(string.to_string()), } } } diff --git a/src/libsyntax/util/parser_testing.rs b/src/libsyntax/util/parser_testing.rs index 33a038a1dcacd..1417cb5e8576f 100644 --- a/src/libsyntax/util/parser_testing.rs +++ b/src/libsyntax/util/parser_testing.rs @@ -19,14 +19,14 @@ use parse::token; pub fn string_to_tts(source_str: String) -> Vec { let ps = new_parse_sess(); filemap_to_tts(&ps, - string_to_filemap(&ps, source_str, "bogofile".to_strbuf())) + string_to_filemap(&ps, source_str, "bogofile".to_string())) } // map string to parser (via tts) pub fn string_to_parser<'a>(ps: &'a ParseSess, source_str: String) -> Parser<'a> { new_parser_from_source_str(ps, Vec::new(), - "bogofile".to_strbuf(), + "bogofile".to_string(), source_str) } diff --git a/src/libterm/terminfo/mod.rs b/src/libterm/terminfo/mod.rs index 716f96b187208..7fe9ea33c2505 100644 --- a/src/libterm/terminfo/mod.rs +++ b/src/libterm/terminfo/mod.rs @@ -186,7 +186,7 @@ impl Terminal for TerminfoTerminal { cap = self.ti.strings.find_equiv(&("op")); } } - let s = cap.map_or(Err("can't find terminfo capability `sgr0`".to_strbuf()), |op| { + let s = cap.map_or(Err("can't find terminfo capability `sgr0`".to_string()), |op| { expand(op.as_slice(), [], &mut Variables::new()) }); if s.is_ok() { diff --git a/src/libterm/terminfo/parm.rs b/src/libterm/terminfo/parm.rs index 6b96a78b24df0..db9509a9dd211 100644 --- a/src/libterm/terminfo/parm.rs +++ b/src/libterm/terminfo/parm.rs @@ -124,9 +124,9 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) match stack.pop().unwrap() { // if c is 0, use 0200 (128) for ncurses compatibility Number(c) => output.push(if c == 0 { 128 } else { c } as u8), - _ => return Err("a non-char was used with %c".to_strbuf()) + _ => return Err("a non-char was used with %c".to_string()) } - } else { return Err("stack is empty".to_strbuf()) }, + } else { return Err("stack is empty".to_string()) }, 'p' => state = PushParam, 'P' => state = SetVar, 'g' => state = GetVar, @@ -135,112 +135,112 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) 'l' => if stack.len() > 0 { match stack.pop().unwrap() { String(s) => stack.push(Number(s.len() as int)), - _ => return Err("a non-str was used with %l".to_strbuf()) + _ => return Err("a non-str was used with %l".to_string()) } - } else { return Err("stack is empty".to_strbuf()) }, + } else { return Err("stack is empty".to_string()) }, '+' => if stack.len() > 1 { match (stack.pop().unwrap(), stack.pop().unwrap()) { (Number(y), Number(x)) => stack.push(Number(x + y)), - _ => return Err("non-numbers on stack with +".to_strbuf()) + _ => return Err("non-numbers on stack with +".to_string()) } - } else { return Err("stack is empty".to_strbuf()) }, + } else { return Err("stack is empty".to_string()) }, '-' => if stack.len() > 1 { match (stack.pop().unwrap(), stack.pop().unwrap()) { (Number(y), Number(x)) => stack.push(Number(x - y)), - _ => return Err("non-numbers on stack with -".to_strbuf()) + _ => return Err("non-numbers on stack with -".to_string()) } - } else { return Err("stack is empty".to_strbuf()) }, + } else { return Err("stack is empty".to_string()) }, '*' => if stack.len() > 1 { match (stack.pop().unwrap(), stack.pop().unwrap()) { (Number(y), Number(x)) => stack.push(Number(x * y)), - _ => return Err("non-numbers on stack with *".to_strbuf()) + _ => return Err("non-numbers on stack with *".to_string()) } - } else { return Err("stack is empty".to_strbuf()) }, + } else { return Err("stack is empty".to_string()) }, '/' => if stack.len() > 1 { match (stack.pop().unwrap(), stack.pop().unwrap()) { (Number(y), Number(x)) => stack.push(Number(x / y)), - _ => return Err("non-numbers on stack with /".to_strbuf()) + _ => return Err("non-numbers on stack with /".to_string()) } - } else { return Err("stack is empty".to_strbuf()) }, + } else { return Err("stack is empty".to_string()) }, 'm' => if stack.len() > 1 { match (stack.pop().unwrap(), stack.pop().unwrap()) { (Number(y), Number(x)) => stack.push(Number(x % y)), - _ => return Err("non-numbers on stack with %".to_strbuf()) + _ => return Err("non-numbers on stack with %".to_string()) } - } else { return Err("stack is empty".to_strbuf()) }, + } else { return Err("stack is empty".to_string()) }, '&' => if stack.len() > 1 { match (stack.pop().unwrap(), stack.pop().unwrap()) { (Number(y), Number(x)) => stack.push(Number(x & y)), - _ => return Err("non-numbers on stack with &".to_strbuf()) + _ => return Err("non-numbers on stack with &".to_string()) } - } else { return Err("stack is empty".to_strbuf()) }, + } else { return Err("stack is empty".to_string()) }, '|' => if stack.len() > 1 { match (stack.pop().unwrap(), stack.pop().unwrap()) { (Number(y), Number(x)) => stack.push(Number(x | y)), - _ => return Err("non-numbers on stack with |".to_strbuf()) + _ => return Err("non-numbers on stack with |".to_string()) } - } else { return Err("stack is empty".to_strbuf()) }, + } else { return Err("stack is empty".to_string()) }, '^' => if stack.len() > 1 { match (stack.pop().unwrap(), stack.pop().unwrap()) { (Number(y), Number(x)) => stack.push(Number(x ^ y)), - _ => return Err("non-numbers on stack with ^".to_strbuf()) + _ => return Err("non-numbers on stack with ^".to_string()) } - } else { return Err("stack is empty".to_strbuf()) }, + } else { return Err("stack is empty".to_string()) }, '=' => if stack.len() > 1 { match (stack.pop().unwrap(), stack.pop().unwrap()) { (Number(y), Number(x)) => stack.push(Number(if x == y { 1 } else { 0 })), - _ => return Err("non-numbers on stack with =".to_strbuf()) + _ => return Err("non-numbers on stack with =".to_string()) } - } else { return Err("stack is empty".to_strbuf()) }, + } else { return Err("stack is empty".to_string()) }, '>' => if stack.len() > 1 { match (stack.pop().unwrap(), stack.pop().unwrap()) { (Number(y), Number(x)) => stack.push(Number(if x > y { 1 } else { 0 })), - _ => return Err("non-numbers on stack with >".to_strbuf()) + _ => return Err("non-numbers on stack with >".to_string()) } - } else { return Err("stack is empty".to_strbuf()) }, + } else { return Err("stack is empty".to_string()) }, '<' => if stack.len() > 1 { match (stack.pop().unwrap(), stack.pop().unwrap()) { (Number(y), Number(x)) => stack.push(Number(if x < y { 1 } else { 0 })), - _ => return Err("non-numbers on stack with <".to_strbuf()) + _ => return Err("non-numbers on stack with <".to_string()) } - } else { return Err("stack is empty".to_strbuf()) }, + } else { return Err("stack is empty".to_string()) }, 'A' => if stack.len() > 1 { match (stack.pop().unwrap(), stack.pop().unwrap()) { (Number(0), Number(_)) => stack.push(Number(0)), (Number(_), Number(0)) => stack.push(Number(0)), (Number(_), Number(_)) => stack.push(Number(1)), - _ => return Err("non-numbers on stack with logical and".to_strbuf()) + _ => return Err("non-numbers on stack with logical and".to_string()) } - } else { return Err("stack is empty".to_strbuf()) }, + } else { return Err("stack is empty".to_string()) }, 'O' => if stack.len() > 1 { match (stack.pop().unwrap(), stack.pop().unwrap()) { (Number(0), Number(0)) => stack.push(Number(0)), (Number(_), Number(_)) => stack.push(Number(1)), - _ => return Err("non-numbers on stack with logical or".to_strbuf()) + _ => return Err("non-numbers on stack with logical or".to_string()) } - } else { return Err("stack is empty".to_strbuf()) }, + } else { return Err("stack is empty".to_string()) }, '!' => if stack.len() > 0 { match stack.pop().unwrap() { Number(0) => stack.push(Number(1)), Number(_) => stack.push(Number(0)), - _ => return Err("non-number on stack with logical not".to_strbuf()) + _ => return Err("non-number on stack with logical not".to_string()) } - } else { return Err("stack is empty".to_strbuf()) }, + } else { return Err("stack is empty".to_string()) }, '~' => if stack.len() > 0 { match stack.pop().unwrap() { Number(x) => stack.push(Number(!x)), - _ => return Err("non-number on stack with %~".to_strbuf()) + _ => return Err("non-number on stack with %~".to_string()) } - } else { return Err("stack is empty".to_strbuf()) }, + } else { return Err("stack is empty".to_string()) }, 'i' => match (mparams[0].clone(), mparams[1].clone()) { (Number(x), Number(y)) => { mparams[0] = Number(x+1); mparams[1] = Number(y+1); }, - (_, _) => return Err("first two params not numbers with %i".to_strbuf()) + (_, _) => return Err("first two params not numbers with %i".to_string()) }, // printf-style support for %doxXs @@ -249,7 +249,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) let res = format(stack.pop().unwrap(), FormatOp::from_char(cur), flags); if res.is_err() { return res } output.push_all(res.unwrap().as_slice()) - } else { return Err("stack is empty".to_strbuf()) }, + } else { return Err("stack is empty".to_string()) }, ':'|'#'|' '|'.'|'0'..'9' => { let mut flags = Flags::new(); let mut fstate = FormatStateFlags; @@ -274,9 +274,9 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) Number(0) => state = SeekIfElse(0), Number(_) => (), _ => return Err("non-number on stack \ - with conditional".to_strbuf()) + with conditional".to_string()) } - } else { return Err("stack is empty".to_strbuf()) }, + } else { return Err("stack is empty".to_string()) }, 'e' => state = SeekIfEnd(0), ';' => (), @@ -291,7 +291,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) // params are 1-indexed stack.push(mparams[match char::to_digit(cur, 10) { Some(d) => d - 1, - None => return Err("bad param number".to_strbuf()) + None => return Err("bad param number".to_string()) }].clone()); }, SetVar => { @@ -299,14 +299,14 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) if stack.len() > 0 { let idx = (cur as u8) - ('A' as u8); vars.sta[idx as uint] = stack.pop().unwrap(); - } else { return Err("stack is empty".to_strbuf()) } + } else { return Err("stack is empty".to_string()) } } else if cur >= 'a' && cur <= 'z' { if stack.len() > 0 { let idx = (cur as u8) - ('a' as u8); vars.dyn[idx as uint] = stack.pop().unwrap(); - } else { return Err("stack is empty".to_strbuf()) } + } else { return Err("stack is empty".to_string()) } } else { - return Err("bad variable name in %P".to_strbuf()); + return Err("bad variable name in %P".to_string()); } }, GetVar => { @@ -317,7 +317,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) let idx = (cur as u8) - ('a' as u8); stack.push(vars.dyn[idx as uint].clone()); } else { - return Err("bad variable name in %g".to_strbuf()); + return Err("bad variable name in %g".to_string()); } }, CharConstant => { @@ -326,7 +326,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) }, CharClose => { if cur != '\'' { - return Err("malformed character constant".to_strbuf()); + return Err("malformed character constant".to_string()); } }, IntConstant(i) => { @@ -339,7 +339,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) state = IntConstant(i*10 + (cur as int - '0' as int)); old_state = Nothing; } - _ => return Err("bad int constant".to_strbuf()) + _ => return Err("bad int constant".to_string()) } } FormatPattern(ref mut flags, ref mut fstate) => { @@ -350,7 +350,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) if res.is_err() { return res } output.push_all(res.unwrap().as_slice()); old_state = state; // will cause state to go to Nothing - } else { return Err("stack is empty".to_strbuf()) }, + } else { return Err("stack is empty".to_string()) }, (FormatStateFlags,'#') => { flags.alternate = true; } @@ -373,7 +373,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) (FormatStateWidth,'0'..'9') => { let old = flags.width; flags.width = flags.width * 10 + (cur as uint - '0' as uint); - if flags.width < old { return Err("format width overflow".to_strbuf()) } + if flags.width < old { return Err("format width overflow".to_string()) } } (FormatStateWidth,'.') => { *fstate = FormatStatePrecision; @@ -382,10 +382,10 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables) let old = flags.precision; flags.precision = flags.precision * 10 + (cur as uint - '0' as uint); if flags.precision < old { - return Err("format precision overflow".to_strbuf()) + return Err("format precision overflow".to_string()) } } - _ => return Err("invalid format specifier".to_strbuf()) + _ => return Err("invalid format specifier".to_string()) } } SeekIfElse(level) => { @@ -493,7 +493,7 @@ fn format(val: Param, op: FormatOp, flags: Flags) -> Result ,String> { (FormatHex, _) => format!("{:x}", d).into_bytes(), (FormatHEX, _) => format!("{:X}", d).into_bytes(), (FormatString, _) => { - return Err("non-number on stack with %s".to_strbuf()) + return Err("non-number on stack with %s".to_string()) } }; let mut s: Vec = s.move_iter().collect(); @@ -607,7 +607,7 @@ mod test { assert!(res.is_err(), "Op {} succeeded incorrectly with 0 stack entries", *cap); let p = if *cap == "%s" || *cap == "%l" { - String("foo".to_strbuf()) + String("foo".to_string()) } else { Number(97) }; @@ -685,12 +685,12 @@ mod test { let mut varstruct = Variables::new(); let vars = &mut varstruct; assert_eq!(expand(bytes!("%p1%s%p2%2s%p3%2s%p4%.2s"), - [String("foo".to_strbuf()), - String("foo".to_strbuf()), - String("f".to_strbuf()), - String("foo".to_strbuf())], vars), + [String("foo".to_string()), + String("foo".to_string()), + String("f".to_string()), + String("foo".to_string())], vars), Ok(bytes!("foofoo ffo").iter().map(|x| *x).collect())); - assert_eq!(expand(bytes!("%p1%:-4.2s"), [String("foo".to_strbuf())], vars), + assert_eq!(expand(bytes!("%p1%:-4.2s"), [String("foo".to_string())], vars), Ok(bytes!("fo ").iter().map(|x| *x).collect())); assert_eq!(expand(bytes!("%p1%d%p1%.3d%p1%5d%p1%:+d"), [Number(1)], vars), diff --git a/src/libterm/terminfo/parser/compiled.rs b/src/libterm/terminfo/parser/compiled.rs index 33589f29624f0..1a42addb4bd13 100644 --- a/src/libterm/terminfo/parser/compiled.rs +++ b/src/libterm/terminfo/parser/compiled.rs @@ -201,29 +201,29 @@ pub fn parse(file: &mut io::Reader, longnames: bool) if (bools_bytes as uint) > boolnames.len() { return Err("incompatible file: more booleans than \ - expected".to_strbuf()); + expected".to_string()); } if (numbers_count as uint) > numnames.len() { return Err("incompatible file: more numbers than \ - expected".to_strbuf()); + expected".to_string()); } if (string_offsets_count as uint) > stringnames.len() { return Err("incompatible file: more string offsets than \ - expected".to_strbuf()); + expected".to_string()); } // don't read NUL let bytes = try!(file.read_exact(names_bytes as uint - 1)); let names_str = match str::from_utf8(bytes.as_slice()) { Some(s) => s.to_string(), - None => return Err("input not utf-8".to_strbuf()), + None => return Err("input not utf-8".to_string()), }; let term_names: Vec = names_str.as_slice() .split('|') - .map(|s| s.to_strbuf()) + .map(|s| s.to_string()) .collect(); try!(file.read_byte()); // consume NUL @@ -233,7 +233,7 @@ pub fn parse(file: &mut io::Reader, longnames: bool) for i in range(0, bools_bytes) { let b = try!(file.read_byte()); if b == 1 { - bools_map.insert(bnames[i as uint].to_strbuf(), true); + bools_map.insert(bnames[i as uint].to_string(), true); } } } @@ -247,7 +247,7 @@ pub fn parse(file: &mut io::Reader, longnames: bool) for i in range(0, numbers_count) { let n = try!(file.read_le_u16()); if n != 0xFFFF { - numbers_map.insert(nnames[i as uint].to_strbuf(), n); + numbers_map.insert(nnames[i as uint].to_string(), n); } } } @@ -264,7 +264,7 @@ pub fn parse(file: &mut io::Reader, longnames: bool) if string_table.len() != string_table_bytes as uint { return Err("error: hit EOF before end of string \ - table".to_strbuf()); + table".to_string()); } for (i, v) in string_offsets.iter().enumerate() { @@ -282,7 +282,7 @@ pub fn parse(file: &mut io::Reader, longnames: bool) if offset == 0xFFFE { // undocumented: FFFE indicates cap@, which means the capability is not present // unsure if the handling for this is correct - string_map.insert(name.to_strbuf(), Vec::new()); + string_map.insert(name.to_string(), Vec::new()); continue; } @@ -292,14 +292,14 @@ pub fn parse(file: &mut io::Reader, longnames: bool) .iter().position(|&b| b == 0); match nulpos { Some(len) => { - string_map.insert(name.to_strbuf(), + string_map.insert(name.to_string(), Vec::from_slice( string_table.slice(offset as uint, offset as uint + len))) }, None => { return Err("invalid file: missing NUL in \ - string_table".to_strbuf()); + string_table".to_string()); } }; } @@ -317,12 +317,12 @@ pub fn parse(file: &mut io::Reader, longnames: bool) /// Create a dummy TermInfo struct for msys terminals pub fn msys_terminfo() -> Box { let mut strings = HashMap::new(); - strings.insert("sgr0".to_strbuf(), Vec::from_slice(bytes!("\x1b[0m"))); - strings.insert("bold".to_strbuf(), Vec::from_slice(bytes!("\x1b[1m"))); - strings.insert("setaf".to_strbuf(), Vec::from_slice(bytes!("\x1b[3%p1%dm"))); - strings.insert("setab".to_strbuf(), Vec::from_slice(bytes!("\x1b[4%p1%dm"))); + strings.insert("sgr0".to_string(), Vec::from_slice(bytes!("\x1b[0m"))); + strings.insert("bold".to_string(), Vec::from_slice(bytes!("\x1b[1m"))); + strings.insert("setaf".to_string(), Vec::from_slice(bytes!("\x1b[3%p1%dm"))); + strings.insert("setab".to_string(), Vec::from_slice(bytes!("\x1b[4%p1%dm"))); box TermInfo { - names: vec!("cygwin".to_strbuf()), // msys is a fork of an older cygwin version + names: vec!("cygwin".to_string()), // msys is a fork of an older cygwin version bools: HashMap::new(), numbers: HashMap::new(), strings: strings diff --git a/src/libterm/terminfo/searcher.rs b/src/libterm/terminfo/searcher.rs index 5c800c75432e4..84f0a4e3565f2 100644 --- a/src/libterm/terminfo/searcher.rs +++ b/src/libterm/terminfo/searcher.rs @@ -40,7 +40,7 @@ pub fn get_dbpath_for_term(term: &str) -> Option> { if i == "" { dirs_to_search.push(Path::new("/usr/share/terminfo")); } else { - dirs_to_search.push(Path::new(i.to_strbuf())); + dirs_to_search.push(Path::new(i.to_string())); } }, // Found nothing in TERMINFO_DIRS, use the default paths: @@ -99,12 +99,12 @@ fn test_get_dbpath_for_term() { // FIXME (#9639): This needs to handle non-utf8 paths fn x(t: &str) -> String { let p = get_dbpath_for_term(t).expect("no terminfo entry found"); - p.as_str().unwrap().to_strbuf() + p.as_str().unwrap().to_string() }; - assert!(x("screen") == "/usr/share/terminfo/s/screen".to_strbuf()); + assert!(x("screen") == "/usr/share/terminfo/s/screen".to_string()); assert!(get_dbpath_for_term("") == None); setenv("TERMINFO_DIRS", ":"); - assert!(x("screen") == "/usr/share/terminfo/s/screen".to_strbuf()); + assert!(x("screen") == "/usr/share/terminfo/s/screen".to_string()); unsetenv("TERMINFO_DIRS"); } diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 0398738ee0aec..f02bc144d153c 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -266,7 +266,7 @@ pub fn test_main_static(args: &[String], tests: &[TestDescAndFn]) { pub fn test_main_static_x(args: &[~str], tests: &[TestDescAndFn]) { test_main_static(args.iter() - .map(|x| x.to_strbuf()) + .map(|x| x.to_string()) .collect::>() .as_slice(), tests) @@ -365,7 +365,7 @@ pub fn parse_opts(args: &[String]) -> Option { let matches = match getopts::getopts(args_.as_slice(), optgroups().as_slice()) { Ok(m) => m, - Err(f) => return Some(Err(f.to_err_msg().to_strbuf())) + Err(f) => return Some(Err(f.to_err_msg().to_string())) }; if matches.opt_present("h") { usage(args[0].as_slice()); return None; } @@ -400,7 +400,7 @@ pub fn parse_opts(args: &[String]) -> Option { let save_metrics = save_metrics.map(|s| Path::new(s)); let test_shard = matches.opt_str("test-shard"); - let test_shard = opt_shard(test_shard.map(|x| x.to_strbuf())); + let test_shard = opt_shard(test_shard.map(|x| x.to_string())); let mut nocapture = matches.opt_present("nocapture"); if !nocapture { @@ -602,9 +602,9 @@ impl ConsoleTestState { None => Ok(()), Some(ref mut o) => { let s = format!("{} {}\n", match *result { - TrOk => "ok".to_strbuf(), - TrFailed => "failed".to_strbuf(), - TrIgnored => "ignored".to_strbuf(), + TrOk => "ok".to_string(), + TrFailed => "failed".to_string(), + TrIgnored => "ignored".to_string(), TrMetrics(ref mm) => fmt_metrics(mm), TrBench(ref bs) => fmt_bench_samples(bs) }, test.name.as_slice()); @@ -744,7 +744,7 @@ pub fn fmt_metrics(mm: &MetricMap) -> String { v.value as f64, v.noise as f64)) .collect(); - v.connect(", ").to_strbuf() + v.connect(", ").to_string() } pub fn fmt_bench_samples(bs: &BenchSamples) -> String { @@ -1088,8 +1088,8 @@ fn calc_result(desc: &TestDesc, task_succeeded: bool) -> TestResult { impl ToJson for Metric { fn to_json(&self) -> json::Json { let mut map = box TreeMap::new(); - map.insert("value".to_strbuf(), json::Number(self.value)); - map.insert("noise".to_strbuf(), json::Number(self.noise)); + map.insert("value".to_string(), json::Number(self.value)); + map.insert("noise".to_string(), json::Number(self.noise)); json::Object(map) } } @@ -1126,7 +1126,7 @@ impl MetricMap { // FIXME(pcwalton): Yuck. let mut new_map = TreeMap::new(); for (ref key, ref value) in map.iter() { - new_map.insert(key.to_strbuf(), (*value).clone()); + new_map.insert(key.to_string(), (*value).clone()); } new_map.to_json().to_pretty_writer(&mut file) @@ -1208,7 +1208,7 @@ impl MetricMap { noise: noise }; let MetricMap(ref mut map) = *self; - map.insert(name.to_strbuf(), m); + map.insert(name.to_string(), m); } /// Attempt to "ratchet" an external metric file. This involves loading @@ -1454,7 +1454,7 @@ mod tests { #[test] fn first_free_arg_should_be_a_filter() { - let args = vec!("progname".to_strbuf(), "some_regex_filter".to_strbuf()); + let args = vec!("progname".to_string(), "some_regex_filter".to_string()); let opts = match parse_opts(args.as_slice()) { Some(Ok(o)) => o, _ => fail!("Malformed arg in first_free_arg_should_be_a_filter") @@ -1464,9 +1464,9 @@ mod tests { #[test] fn parse_ignored_flag() { - let args = vec!("progname".to_strbuf(), - "filter".to_strbuf(), - "--ignored".to_strbuf()); + let args = vec!("progname".to_string(), + "filter".to_string(), + "--ignored".to_string()); let opts = match parse_opts(args.as_slice()) { Some(Ok(o)) => o, _ => fail!("Malformed arg in parse_ignored_flag") @@ -1503,8 +1503,8 @@ mod tests { let filtered = filter_tests(&opts, tests); assert_eq!(filtered.len(), 1); - assert_eq!(filtered.get(0).desc.name.to_str().to_strbuf(), - "1".to_strbuf()); + assert_eq!(filtered.get(0).desc.name.to_str().to_string(), + "1".to_string()); assert!(filtered.get(0).desc.ignore == false); } @@ -1514,15 +1514,15 @@ mod tests { opts.run_tests = true; let names = - vec!("sha1::test".to_strbuf(), - "int::test_to_str".to_strbuf(), - "int::test_pow".to_strbuf(), - "test::do_not_run_ignored_tests".to_strbuf(), - "test::ignored_tests_result_in_ignored".to_strbuf(), - "test::first_free_arg_should_be_a_filter".to_strbuf(), - "test::parse_ignored_flag".to_strbuf(), - "test::filter_for_ignored_option".to_strbuf(), - "test::sort_tests".to_strbuf()); + vec!("sha1::test".to_string(), + "int::test_to_str".to_string(), + "int::test_pow".to_string(), + "test::do_not_run_ignored_tests".to_string(), + "test::ignored_tests_result_in_ignored".to_string(), + "test::first_free_arg_should_be_a_filter".to_string(), + "test::parse_ignored_flag".to_string(), + "test::filter_for_ignored_option".to_string(), + "test::sort_tests".to_string()); let tests = { fn testfn() { } @@ -1543,18 +1543,18 @@ mod tests { let filtered = filter_tests(&opts, tests); let expected = - vec!("int::test_pow".to_strbuf(), - "int::test_to_str".to_strbuf(), - "sha1::test".to_strbuf(), - "test::do_not_run_ignored_tests".to_strbuf(), - "test::filter_for_ignored_option".to_strbuf(), - "test::first_free_arg_should_be_a_filter".to_strbuf(), - "test::ignored_tests_result_in_ignored".to_strbuf(), - "test::parse_ignored_flag".to_strbuf(), - "test::sort_tests".to_strbuf()); + vec!("int::test_pow".to_string(), + "int::test_to_str".to_string(), + "sha1::test".to_string(), + "test::do_not_run_ignored_tests".to_string(), + "test::filter_for_ignored_option".to_string(), + "test::first_free_arg_should_be_a_filter".to_string(), + "test::ignored_tests_result_in_ignored".to_string(), + "test::parse_ignored_flag".to_string(), + "test::sort_tests".to_string()); for (a, b) in expected.iter().zip(filtered.iter()) { - assert!(*a == b.desc.name.to_str().to_strbuf()); + assert!(*a == b.desc.name.to_str().to_string()); } } @@ -1571,7 +1571,7 @@ mod tests { let tests = names.iter().map(|name| { TestDescAndFn { desc: TestDesc { - name: DynTestName(name.to_strbuf()), + name: DynTestName(name.to_string()), ignore: false, should_fail: false }, @@ -1613,31 +1613,31 @@ mod tests { let diff1 = m2.compare_to_old(&m1, None); - assert_eq!(*(diff1.find(&"in-both-noise".to_strbuf()).unwrap()), LikelyNoise); - assert_eq!(*(diff1.find(&"in-first-noise".to_strbuf()).unwrap()), MetricRemoved); - assert_eq!(*(diff1.find(&"in-second-noise".to_strbuf()).unwrap()), MetricAdded); - assert_eq!(*(diff1.find(&"in-both-want-downwards-but-regressed".to_strbuf()).unwrap()), + assert_eq!(*(diff1.find(&"in-both-noise".to_string()).unwrap()), LikelyNoise); + assert_eq!(*(diff1.find(&"in-first-noise".to_string()).unwrap()), MetricRemoved); + assert_eq!(*(diff1.find(&"in-second-noise".to_string()).unwrap()), MetricAdded); + assert_eq!(*(diff1.find(&"in-both-want-downwards-but-regressed".to_string()).unwrap()), Regression(100.0)); - assert_eq!(*(diff1.find(&"in-both-want-downwards-and-improved".to_strbuf()).unwrap()), + assert_eq!(*(diff1.find(&"in-both-want-downwards-and-improved".to_string()).unwrap()), Improvement(50.0)); - assert_eq!(*(diff1.find(&"in-both-want-upwards-but-regressed".to_strbuf()).unwrap()), + assert_eq!(*(diff1.find(&"in-both-want-upwards-but-regressed".to_string()).unwrap()), Regression(50.0)); - assert_eq!(*(diff1.find(&"in-both-want-upwards-and-improved".to_strbuf()).unwrap()), + assert_eq!(*(diff1.find(&"in-both-want-upwards-and-improved".to_string()).unwrap()), Improvement(100.0)); assert_eq!(diff1.len(), 7); let diff2 = m2.compare_to_old(&m1, Some(200.0)); - assert_eq!(*(diff2.find(&"in-both-noise".to_strbuf()).unwrap()), LikelyNoise); - assert_eq!(*(diff2.find(&"in-first-noise".to_strbuf()).unwrap()), MetricRemoved); - assert_eq!(*(diff2.find(&"in-second-noise".to_strbuf()).unwrap()), MetricAdded); - assert_eq!(*(diff2.find(&"in-both-want-downwards-but-regressed".to_strbuf()).unwrap()), + assert_eq!(*(diff2.find(&"in-both-noise".to_string()).unwrap()), LikelyNoise); + assert_eq!(*(diff2.find(&"in-first-noise".to_string()).unwrap()), MetricRemoved); + assert_eq!(*(diff2.find(&"in-second-noise".to_string()).unwrap()), MetricAdded); + assert_eq!(*(diff2.find(&"in-both-want-downwards-but-regressed".to_string()).unwrap()), LikelyNoise); - assert_eq!(*(diff2.find(&"in-both-want-downwards-and-improved".to_strbuf()).unwrap()), + assert_eq!(*(diff2.find(&"in-both-want-downwards-and-improved".to_string()).unwrap()), LikelyNoise); - assert_eq!(*(diff2.find(&"in-both-want-upwards-but-regressed".to_strbuf()).unwrap()), + assert_eq!(*(diff2.find(&"in-both-want-upwards-but-regressed".to_string()).unwrap()), LikelyNoise); - assert_eq!(*(diff2.find(&"in-both-want-upwards-and-improved".to_strbuf()).unwrap()), + assert_eq!(*(diff2.find(&"in-both-want-upwards-and-improved".to_string()).unwrap()), LikelyNoise); assert_eq!(diff2.len(), 7); } @@ -1662,29 +1662,29 @@ mod tests { let (diff1, ok1) = m2.ratchet(&pth, None); assert_eq!(ok1, false); assert_eq!(diff1.len(), 2); - assert_eq!(*(diff1.find(&"runtime".to_strbuf()).unwrap()), Regression(10.0)); - assert_eq!(*(diff1.find(&"throughput".to_strbuf()).unwrap()), LikelyNoise); + assert_eq!(*(diff1.find(&"runtime".to_string()).unwrap()), Regression(10.0)); + assert_eq!(*(diff1.find(&"throughput".to_string()).unwrap()), LikelyNoise); // Check that it was not rewritten. let m3 = MetricMap::load(&pth); let MetricMap(m3) = m3; assert_eq!(m3.len(), 2); - assert_eq!(*(m3.find(&"runtime".to_strbuf()).unwrap()), Metric::new(1000.0, 2.0)); - assert_eq!(*(m3.find(&"throughput".to_strbuf()).unwrap()), Metric::new(50.0, 2.0)); + assert_eq!(*(m3.find(&"runtime".to_string()).unwrap()), Metric::new(1000.0, 2.0)); + assert_eq!(*(m3.find(&"throughput".to_string()).unwrap()), Metric::new(50.0, 2.0)); // Ask for a ratchet with an explicit noise-percentage override, // that should advance. let (diff2, ok2) = m2.ratchet(&pth, Some(10.0)); assert_eq!(ok2, true); assert_eq!(diff2.len(), 2); - assert_eq!(*(diff2.find(&"runtime".to_strbuf()).unwrap()), LikelyNoise); - assert_eq!(*(diff2.find(&"throughput".to_strbuf()).unwrap()), LikelyNoise); + assert_eq!(*(diff2.find(&"runtime".to_string()).unwrap()), LikelyNoise); + assert_eq!(*(diff2.find(&"throughput".to_string()).unwrap()), LikelyNoise); // Check that it was rewritten. let m4 = MetricMap::load(&pth); let MetricMap(m4) = m4; assert_eq!(m4.len(), 2); - assert_eq!(*(m4.find(&"runtime".to_strbuf()).unwrap()), Metric::new(1100.0, 2.0)); - assert_eq!(*(m4.find(&"throughput".to_strbuf()).unwrap()), Metric::new(50.0, 2.0)); + assert_eq!(*(m4.find(&"runtime".to_string()).unwrap()), Metric::new(1100.0, 2.0)); + assert_eq!(*(m4.find(&"throughput".to_string()).unwrap()), Metric::new(50.0, 2.0)); } } diff --git a/src/libtest/stats.rs b/src/libtest/stats.rs index 3ce87971099b6..77b1eae0a56c6 100644 --- a/src/libtest/stats.rs +++ b/src/libtest/stats.rs @@ -1032,16 +1032,16 @@ mod tests { use std::io::MemWriter; let mut m = MemWriter::new(); write_boxplot(&mut m as &mut io::Writer, s, 30).unwrap(); - let out = str::from_utf8(m.unwrap().as_slice()).unwrap().to_strbuf(); + let out = str::from_utf8(m.unwrap().as_slice()).unwrap().to_string(); assert_eq!(out, expected); } t(&Summary::new([-2.0, -1.0]), - "-2 |[------******#*****---]| -1".to_strbuf()); + "-2 |[------******#*****---]| -1".to_string()); t(&Summary::new([0.0, 2.0]), - "0 |[-------*****#*******---]| 2".to_strbuf()); + "0 |[-------*****#*******---]| 2".to_string()); t(&Summary::new([-2.0, 0.0]), - "-2 |[------******#******---]| 0".to_strbuf()); + "-2 |[------******#******---]| 0".to_string()); } #[test] diff --git a/src/libtime/lib.rs b/src/libtime/lib.rs index 4823eff2a7c97..743ad823eb367 100644 --- a/src/libtime/lib.rs +++ b/src/libtime/lib.rs @@ -477,62 +477,62 @@ pub fn strptime(s: &str, format: &str) -> Result { -> Result { match ch { 'A' => match match_strs(s, pos, [ - ("Sunday".to_strbuf(), 0_i32), - ("Monday".to_strbuf(), 1_i32), - ("Tuesday".to_strbuf(), 2_i32), - ("Wednesday".to_strbuf(), 3_i32), - ("Thursday".to_strbuf(), 4_i32), - ("Friday".to_strbuf(), 5_i32), - ("Saturday".to_strbuf(), 6_i32) + ("Sunday".to_string(), 0_i32), + ("Monday".to_string(), 1_i32), + ("Tuesday".to_string(), 2_i32), + ("Wednesday".to_string(), 3_i32), + ("Thursday".to_string(), 4_i32), + ("Friday".to_string(), 5_i32), + ("Saturday".to_string(), 6_i32) ]) { Some(item) => { let (v, pos) = item; tm.tm_wday = v; Ok(pos) } - None => Err("Invalid day".to_strbuf()) + None => Err("Invalid day".to_string()) }, 'a' => match match_strs(s, pos, [ - ("Sun".to_strbuf(), 0_i32), - ("Mon".to_strbuf(), 1_i32), - ("Tue".to_strbuf(), 2_i32), - ("Wed".to_strbuf(), 3_i32), - ("Thu".to_strbuf(), 4_i32), - ("Fri".to_strbuf(), 5_i32), - ("Sat".to_strbuf(), 6_i32) + ("Sun".to_string(), 0_i32), + ("Mon".to_string(), 1_i32), + ("Tue".to_string(), 2_i32), + ("Wed".to_string(), 3_i32), + ("Thu".to_string(), 4_i32), + ("Fri".to_string(), 5_i32), + ("Sat".to_string(), 6_i32) ]) { Some(item) => { let (v, pos) = item; tm.tm_wday = v; Ok(pos) } - None => Err("Invalid day".to_strbuf()) + None => Err("Invalid day".to_string()) }, 'B' => match match_strs(s, pos, [ - ("January".to_strbuf(), 0_i32), - ("February".to_strbuf(), 1_i32), - ("March".to_strbuf(), 2_i32), - ("April".to_strbuf(), 3_i32), - ("May".to_strbuf(), 4_i32), - ("June".to_strbuf(), 5_i32), - ("July".to_strbuf(), 6_i32), - ("August".to_strbuf(), 7_i32), - ("September".to_strbuf(), 8_i32), - ("October".to_strbuf(), 9_i32), - ("November".to_strbuf(), 10_i32), - ("December".to_strbuf(), 11_i32) + ("January".to_string(), 0_i32), + ("February".to_string(), 1_i32), + ("March".to_string(), 2_i32), + ("April".to_string(), 3_i32), + ("May".to_string(), 4_i32), + ("June".to_string(), 5_i32), + ("July".to_string(), 6_i32), + ("August".to_string(), 7_i32), + ("September".to_string(), 8_i32), + ("October".to_string(), 9_i32), + ("November".to_string(), 10_i32), + ("December".to_string(), 11_i32) ]) { Some(item) => { let (v, pos) = item; tm.tm_mon = v; Ok(pos) } - None => Err("Invalid month".to_strbuf()) + None => Err("Invalid month".to_string()) }, 'b' | 'h' => match match_strs(s, pos, [ - ("Jan".to_strbuf(), 0_i32), - ("Feb".to_strbuf(), 1_i32), - ("Mar".to_strbuf(), 2_i32), - ("Apr".to_strbuf(), 3_i32), - ("May".to_strbuf(), 4_i32), - ("Jun".to_strbuf(), 5_i32), - ("Jul".to_strbuf(), 6_i32), - ("Aug".to_strbuf(), 7_i32), - ("Sep".to_strbuf(), 8_i32), - ("Oct".to_strbuf(), 9_i32), - ("Nov".to_strbuf(), 10_i32), - ("Dec".to_strbuf(), 11_i32) + ("Jan".to_string(), 0_i32), + ("Feb".to_string(), 1_i32), + ("Mar".to_string(), 2_i32), + ("Apr".to_string(), 3_i32), + ("May".to_string(), 4_i32), + ("Jun".to_string(), 5_i32), + ("Jul".to_string(), 6_i32), + ("Aug".to_string(), 7_i32), + ("Sep".to_string(), 8_i32), + ("Oct".to_string(), 9_i32), + ("Nov".to_string(), 10_i32), + ("Dec".to_string(), 11_i32) ]) { Some(item) => { let (v, pos) = item; tm.tm_mon = v; Ok(pos) } - None => Err("Invalid month".to_strbuf()) + None => Err("Invalid month".to_string()) }, 'C' => match match_digits_in_range(s, pos, 2u, false, 0_i32, 99_i32) { @@ -541,7 +541,7 @@ pub fn strptime(s: &str, format: &str) -> Result { tm.tm_year += (v * 100_i32) - 1900_i32; Ok(pos) } - None => Err("Invalid year".to_strbuf()) + None => Err("Invalid year".to_string()) }, 'c' => { parse_type(s, pos, 'a', &mut *tm) @@ -564,12 +564,12 @@ pub fn strptime(s: &str, format: &str) -> Result { 'd' => match match_digits_in_range(s, pos, 2u, false, 1_i32, 31_i32) { Some(item) => { let (v, pos) = item; tm.tm_mday = v; Ok(pos) } - None => Err("Invalid day of the month".to_strbuf()) + None => Err("Invalid day of the month".to_string()) }, 'e' => match match_digits_in_range(s, pos, 2u, true, 1_i32, 31_i32) { Some(item) => { let (v, pos) = item; tm.tm_mday = v; Ok(pos) } - None => Err("Invalid day of the month".to_strbuf()) + None => Err("Invalid day of the month".to_string()) }, 'f' => { let (val, pos) = match_fractional_seconds(s, pos); @@ -586,7 +586,7 @@ pub fn strptime(s: &str, format: &str) -> Result { 'H' => { match match_digits_in_range(s, pos, 2u, false, 0_i32, 23_i32) { Some(item) => { let (v, pos) = item; tm.tm_hour = v; Ok(pos) } - None => Err("Invalid hour".to_strbuf()) + None => Err("Invalid hour".to_string()) } } 'I' => { @@ -596,7 +596,7 @@ pub fn strptime(s: &str, format: &str) -> Result { tm.tm_hour = if v == 12_i32 { 0_i32 } else { v }; Ok(pos) } - None => Err("Invalid hour".to_strbuf()) + None => Err("Invalid hour".to_string()) } } 'j' => { @@ -606,13 +606,13 @@ pub fn strptime(s: &str, format: &str) -> Result { tm.tm_yday = v - 1_i32; Ok(pos) } - None => Err("Invalid day of year".to_strbuf()) + None => Err("Invalid day of year".to_string()) } } 'k' => { match match_digits_in_range(s, pos, 2u, true, 0_i32, 23_i32) { Some(item) => { let (v, pos) = item; tm.tm_hour = v; Ok(pos) } - None => Err("Invalid hour".to_strbuf()) + None => Err("Invalid hour".to_string()) } } 'l' => { @@ -622,13 +622,13 @@ pub fn strptime(s: &str, format: &str) -> Result { tm.tm_hour = if v == 12_i32 { 0_i32 } else { v }; Ok(pos) } - None => Err("Invalid hour".to_strbuf()) + None => Err("Invalid hour".to_string()) } } 'M' => { match match_digits_in_range(s, pos, 2u, false, 0_i32, 59_i32) { Some(item) => { let (v, pos) = item; tm.tm_min = v; Ok(pos) } - None => Err("Invalid minute".to_strbuf()) + None => Err("Invalid minute".to_string()) } } 'm' => { @@ -638,21 +638,21 @@ pub fn strptime(s: &str, format: &str) -> Result { tm.tm_mon = v - 1_i32; Ok(pos) } - None => Err("Invalid month".to_strbuf()) + None => Err("Invalid month".to_string()) } } 'n' => parse_char(s, pos, '\n'), 'P' => match match_strs(s, pos, - [("am".to_strbuf(), 0_i32), ("pm".to_strbuf(), 12_i32)]) { + [("am".to_string(), 0_i32), ("pm".to_string(), 12_i32)]) { Some(item) => { let (v, pos) = item; tm.tm_hour += v; Ok(pos) } - None => Err("Invalid hour".to_strbuf()) + None => Err("Invalid hour".to_string()) }, 'p' => match match_strs(s, pos, - [("AM".to_strbuf(), 0_i32), ("PM".to_strbuf(), 12_i32)]) { + [("AM".to_string(), 0_i32), ("PM".to_string(), 12_i32)]) { Some(item) => { let (v, pos) = item; tm.tm_hour += v; Ok(pos) } - None => Err("Invalid hour".to_strbuf()) + None => Err("Invalid hour".to_string()) }, 'R' => { parse_type(s, pos, 'H', &mut *tm) @@ -675,7 +675,7 @@ pub fn strptime(s: &str, format: &str) -> Result { tm.tm_sec = v; Ok(pos) } - None => Err("Invalid second".to_strbuf()) + None => Err("Invalid second".to_string()) } } //'s' {} @@ -694,7 +694,7 @@ pub fn strptime(s: &str, format: &str) -> Result { tm.tm_wday = if v == 7 { 0 } else { v }; Ok(pos) } - None => Err("Invalid day of week".to_strbuf()) + None => Err("Invalid day of week".to_string()) } } 'v' => { @@ -708,7 +708,7 @@ pub fn strptime(s: &str, format: &str) -> Result { 'w' => { match match_digits_in_range(s, pos, 1u, false, 0_i32, 6_i32) { Some(item) => { let (v, pos) = item; tm.tm_wday = v; Ok(pos) } - None => Err("Invalid day of week".to_strbuf()) + None => Err("Invalid day of week".to_string()) } } 'Y' => { @@ -718,7 +718,7 @@ pub fn strptime(s: &str, format: &str) -> Result { tm.tm_year = v - 1900_i32; Ok(pos) } - None => Err("Invalid year".to_strbuf()) + None => Err("Invalid year".to_string()) } } 'y' => { @@ -728,7 +728,7 @@ pub fn strptime(s: &str, format: &str) -> Result { tm.tm_year = v; Ok(pos) } - None => Err("Invalid year".to_strbuf()) + None => Err("Invalid year".to_string()) } } 'Z' => { @@ -762,10 +762,10 @@ pub fn strptime(s: &str, format: &str) -> Result { Ok(pos) } - None => Err("Invalid zone offset".to_strbuf()) + None => Err("Invalid zone offset".to_string()) } } else { - Err("Invalid zone offset".to_strbuf()) + Err("Invalid zone offset".to_string()) } } '%' => parse_char(s, pos, '%'), @@ -792,7 +792,7 @@ pub fn strptime(s: &str, format: &str) -> Result { }; let mut pos = 0u; let len = s.len(); - let mut result = Err("Invalid time".to_strbuf()); + let mut result = Err("Invalid time".to_string()); while pos < len { let range = s.char_range_at(pos); @@ -890,7 +890,7 @@ pub fn strftime(format: &str, tm: &Tm) -> String { 'G' => format_strbuf!("{}", year), 'g' => format_strbuf!("{:02d}", (year % 100 + 100) % 100), 'V' => format_strbuf!("{:02d}", days / 7 + 1), - _ => "".to_strbuf() + _ => "".to_string() } } @@ -900,53 +900,53 @@ pub fn strftime(format: &str, tm: &Tm) -> String { }; match ch { 'A' => match tm.tm_wday as int { - 0 => "Sunday".to_strbuf(), - 1 => "Monday".to_strbuf(), - 2 => "Tuesday".to_strbuf(), - 3 => "Wednesday".to_strbuf(), - 4 => "Thursday".to_strbuf(), - 5 => "Friday".to_strbuf(), - 6 => "Saturday".to_strbuf(), + 0 => "Sunday".to_string(), + 1 => "Monday".to_string(), + 2 => "Tuesday".to_string(), + 3 => "Wednesday".to_string(), + 4 => "Thursday".to_string(), + 5 => "Friday".to_string(), + 6 => "Saturday".to_string(), _ => die() }, 'a' => match tm.tm_wday as int { - 0 => "Sun".to_strbuf(), - 1 => "Mon".to_strbuf(), - 2 => "Tue".to_strbuf(), - 3 => "Wed".to_strbuf(), - 4 => "Thu".to_strbuf(), - 5 => "Fri".to_strbuf(), - 6 => "Sat".to_strbuf(), + 0 => "Sun".to_string(), + 1 => "Mon".to_string(), + 2 => "Tue".to_string(), + 3 => "Wed".to_string(), + 4 => "Thu".to_string(), + 5 => "Fri".to_string(), + 6 => "Sat".to_string(), _ => die() }, 'B' => match tm.tm_mon as int { - 0 => "January".to_strbuf(), - 1 => "February".to_strbuf(), - 2 => "March".to_strbuf(), - 3 => "April".to_strbuf(), - 4 => "May".to_strbuf(), - 5 => "June".to_strbuf(), - 6 => "July".to_strbuf(), - 7 => "August".to_strbuf(), - 8 => "September".to_strbuf(), - 9 => "October".to_strbuf(), - 10 => "November".to_strbuf(), - 11 => "December".to_strbuf(), + 0 => "January".to_string(), + 1 => "February".to_string(), + 2 => "March".to_string(), + 3 => "April".to_string(), + 4 => "May".to_string(), + 5 => "June".to_string(), + 6 => "July".to_string(), + 7 => "August".to_string(), + 8 => "September".to_string(), + 9 => "October".to_string(), + 10 => "November".to_string(), + 11 => "December".to_string(), _ => die() }, 'b' | 'h' => match tm.tm_mon as int { - 0 => "Jan".to_strbuf(), - 1 => "Feb".to_strbuf(), - 2 => "Mar".to_strbuf(), - 3 => "Apr".to_strbuf(), - 4 => "May".to_strbuf(), - 5 => "Jun".to_strbuf(), - 6 => "Jul".to_strbuf(), - 7 => "Aug".to_strbuf(), - 8 => "Sep".to_strbuf(), - 9 => "Oct".to_strbuf(), - 10 => "Nov".to_strbuf(), - 11 => "Dec".to_strbuf(), + 0 => "Jan".to_string(), + 1 => "Feb".to_string(), + 2 => "Mar".to_string(), + 3 => "Apr".to_string(), + 4 => "May".to_string(), + 5 => "Jun".to_string(), + 6 => "Jul".to_string(), + 7 => "Aug".to_string(), + 8 => "Sep".to_string(), + 9 => "Oct".to_string(), + 10 => "Nov".to_string(), + 11 => "Dec".to_string(), _ => die() }, 'C' => format_strbuf!("{:02d}", (tm.tm_year as int + 1900) / 100), @@ -992,9 +992,9 @@ pub fn strftime(format: &str, tm: &Tm) -> String { } 'M' => format_strbuf!("{:02d}", tm.tm_min), 'm' => format_strbuf!("{:02d}", tm.tm_mon + 1), - 'n' => "\n".to_strbuf(), - 'P' => if (tm.tm_hour as int) < 12 { "am".to_strbuf() } else { "pm".to_strbuf() }, - 'p' => if (tm.tm_hour as int) < 12 { "AM".to_strbuf() } else { "PM".to_strbuf() }, + 'n' => "\n".to_string(), + 'P' => if (tm.tm_hour as int) < 12 { "am".to_string() } else { "pm".to_string() }, + 'p' => if (tm.tm_hour as int) < 12 { "AM".to_string() } else { "PM".to_string() }, 'R' => { format_strbuf!("{}:{}", parse_type('H', tm), @@ -1015,11 +1015,11 @@ pub fn strftime(format: &str, tm: &Tm) -> String { parse_type('M', tm), parse_type('S', tm)) } - 't' => "\t".to_strbuf(), + 't' => "\t".to_string(), 'U' => format_strbuf!("{:02d}", (tm.tm_yday - tm.tm_wday + 7) / 7), 'u' => { let i = tm.tm_wday as int; - (if i == 0 { 7 } else { i }).to_str().to_strbuf() + (if i == 0 { 7 } else { i }).to_str().to_string() } 'V' => iso_week('V', tm), 'v' => { @@ -1032,10 +1032,10 @@ pub fn strftime(format: &str, tm: &Tm) -> String { format_strbuf!("{:02d}", (tm.tm_yday - (tm.tm_wday - 1 + 7) % 7 + 7) / 7) } - 'w' => (tm.tm_wday as int).to_str().to_strbuf(), - 'Y' => (tm.tm_year as int + 1900).to_str().to_strbuf(), + 'w' => (tm.tm_wday as int).to_str().to_string(), + 'Y' => (tm.tm_year as int + 1900).to_str().to_string(), 'y' => format_strbuf!("{:02d}", (tm.tm_year as int + 1900) % 100), - 'Z' => "".to_strbuf(), // FIXME(pcwalton): Implement this. + 'Z' => "".to_string(), // FIXME(pcwalton): Implement this. 'z' => { let sign = if tm.tm_gmtoff > 0_i32 { '+' } else { '-' }; let mut m = num::abs(tm.tm_gmtoff) / 60_i32; @@ -1044,7 +1044,7 @@ pub fn strftime(format: &str, tm: &Tm) -> String { format_strbuf!("{}{:02d}{:02d}", sign, h, m) } '+' => tm.rfc3339(), - '%' => "%".to_strbuf(), + '%' => "%".to_string(), _ => die() } } @@ -1068,7 +1068,7 @@ pub fn strftime(format: &str, tm: &Tm) -> String { } } - str::from_utf8(buf.as_slice()).unwrap().to_strbuf() + str::from_utf8(buf.as_slice()).unwrap().to_string() } #[cfg(test)] @@ -1230,9 +1230,9 @@ mod tests { } let format = "%a %b %e %T.%f %Y"; - assert_eq!(strptime("", format), Err("Invalid time".to_strbuf())); + assert_eq!(strptime("", format), Err("Invalid time".to_string())); assert!(strptime("Fri Feb 13 15:31:30", format) - == Err("Invalid time".to_strbuf())); + == Err("Invalid time".to_string())); match strptime("Fri Feb 13 15:31:30.01234 2009", format) { Err(e) => fail!(e), @@ -1253,68 +1253,68 @@ mod tests { fn test(s: &str, format: &str) -> bool { match strptime(s, format) { - Ok(ref tm) => tm.strftime(format) == s.to_strbuf(), + Ok(ref tm) => tm.strftime(format) == s.to_string(), Err(e) => fail!(e) } } let days = [ - "Sunday".to_strbuf(), - "Monday".to_strbuf(), - "Tuesday".to_strbuf(), - "Wednesday".to_strbuf(), - "Thursday".to_strbuf(), - "Friday".to_strbuf(), - "Saturday".to_strbuf() + "Sunday".to_string(), + "Monday".to_string(), + "Tuesday".to_string(), + "Wednesday".to_string(), + "Thursday".to_string(), + "Friday".to_string(), + "Saturday".to_string() ]; for day in days.iter() { assert!(test(day.as_slice(), "%A")); } let days = [ - "Sun".to_strbuf(), - "Mon".to_strbuf(), - "Tue".to_strbuf(), - "Wed".to_strbuf(), - "Thu".to_strbuf(), - "Fri".to_strbuf(), - "Sat".to_strbuf() + "Sun".to_string(), + "Mon".to_string(), + "Tue".to_string(), + "Wed".to_string(), + "Thu".to_string(), + "Fri".to_string(), + "Sat".to_string() ]; for day in days.iter() { assert!(test(day.as_slice(), "%a")); } let months = [ - "January".to_strbuf(), - "February".to_strbuf(), - "March".to_strbuf(), - "April".to_strbuf(), - "May".to_strbuf(), - "June".to_strbuf(), - "July".to_strbuf(), - "August".to_strbuf(), - "September".to_strbuf(), - "October".to_strbuf(), - "November".to_strbuf(), - "December".to_strbuf() + "January".to_string(), + "February".to_string(), + "March".to_string(), + "April".to_string(), + "May".to_string(), + "June".to_string(), + "July".to_string(), + "August".to_string(), + "September".to_string(), + "October".to_string(), + "November".to_string(), + "December".to_string() ]; for day in months.iter() { assert!(test(day.as_slice(), "%B")); } let months = [ - "Jan".to_strbuf(), - "Feb".to_strbuf(), - "Mar".to_strbuf(), - "Apr".to_strbuf(), - "May".to_strbuf(), - "Jun".to_strbuf(), - "Jul".to_strbuf(), - "Aug".to_strbuf(), - "Sep".to_strbuf(), - "Oct".to_strbuf(), - "Nov".to_strbuf(), - "Dec".to_strbuf() + "Jan".to_string(), + "Feb".to_string(), + "Mar".to_string(), + "Apr".to_string(), + "May".to_string(), + "Jun".to_string(), + "Jul".to_string(), + "Aug".to_string(), + "Sep".to_string(), + "Oct".to_string(), + "Nov".to_string(), + "Dec".to_string() ]; for day in months.iter() { assert!(test(day.as_slice(), "%b")); @@ -1365,7 +1365,7 @@ mod tests { assert!(test("%", "%%")); // Test for #7256 - assert_eq!(strptime("360", "%Y-%m-%d"), Err("Invalid year".to_strbuf())) + assert_eq!(strptime("360", "%Y-%m-%d"), Err("Invalid year".to_string())) } fn test_ctime() { @@ -1377,8 +1377,8 @@ mod tests { debug!("test_ctime: {:?} {:?}", utc.ctime(), local.ctime()); - assert_eq!(utc.ctime(), "Fri Feb 13 23:31:30 2009".to_strbuf()); - assert_eq!(local.ctime(), "Fri Feb 13 15:31:30 2009".to_strbuf()); + assert_eq!(utc.ctime(), "Fri Feb 13 23:31:30 2009".to_string()); + assert_eq!(local.ctime(), "Fri Feb 13 15:31:30 2009".to_string()); } fn test_strftime() { @@ -1388,58 +1388,58 @@ mod tests { let utc = at_utc(time); let local = at(time); - assert_eq!(local.strftime(""), "".to_strbuf()); - assert_eq!(local.strftime("%A"), "Friday".to_strbuf()); - assert_eq!(local.strftime("%a"), "Fri".to_strbuf()); - assert_eq!(local.strftime("%B"), "February".to_strbuf()); - assert_eq!(local.strftime("%b"), "Feb".to_strbuf()); - assert_eq!(local.strftime("%C"), "20".to_strbuf()); - assert_eq!(local.strftime("%c"), "Fri Feb 13 15:31:30 2009".to_strbuf()); - assert_eq!(local.strftime("%D"), "02/13/09".to_strbuf()); - assert_eq!(local.strftime("%d"), "13".to_strbuf()); - assert_eq!(local.strftime("%e"), "13".to_strbuf()); - assert_eq!(local.strftime("%f"), "000054321".to_strbuf()); - assert_eq!(local.strftime("%F"), "2009-02-13".to_strbuf()); - assert_eq!(local.strftime("%G"), "2009".to_strbuf()); - assert_eq!(local.strftime("%g"), "09".to_strbuf()); - assert_eq!(local.strftime("%H"), "15".to_strbuf()); - assert_eq!(local.strftime("%I"), "03".to_strbuf()); - assert_eq!(local.strftime("%j"), "044".to_strbuf()); - assert_eq!(local.strftime("%k"), "15".to_strbuf()); - assert_eq!(local.strftime("%l"), " 3".to_strbuf()); - assert_eq!(local.strftime("%M"), "31".to_strbuf()); - assert_eq!(local.strftime("%m"), "02".to_strbuf()); - assert_eq!(local.strftime("%n"), "\n".to_strbuf()); - assert_eq!(local.strftime("%P"), "pm".to_strbuf()); - assert_eq!(local.strftime("%p"), "PM".to_strbuf()); - assert_eq!(local.strftime("%R"), "15:31".to_strbuf()); - assert_eq!(local.strftime("%r"), "03:31:30 PM".to_strbuf()); - assert_eq!(local.strftime("%S"), "30".to_strbuf()); - assert_eq!(local.strftime("%s"), "1234567890".to_strbuf()); - assert_eq!(local.strftime("%T"), "15:31:30".to_strbuf()); - assert_eq!(local.strftime("%t"), "\t".to_strbuf()); - assert_eq!(local.strftime("%U"), "06".to_strbuf()); - assert_eq!(local.strftime("%u"), "5".to_strbuf()); - assert_eq!(local.strftime("%V"), "07".to_strbuf()); - assert_eq!(local.strftime("%v"), "13-Feb-2009".to_strbuf()); - assert_eq!(local.strftime("%W"), "06".to_strbuf()); - assert_eq!(local.strftime("%w"), "5".to_strbuf()); - assert_eq!(local.strftime("%X"), "15:31:30".to_strbuf()); // FIXME (#2350): support locale - assert_eq!(local.strftime("%x"), "02/13/09".to_strbuf()); // FIXME (#2350): support locale - assert_eq!(local.strftime("%Y"), "2009".to_strbuf()); - assert_eq!(local.strftime("%y"), "09".to_strbuf()); - assert_eq!(local.strftime("%+"), "2009-02-13T15:31:30-08:00".to_strbuf()); - assert_eq!(local.strftime("%z"), "-0800".to_strbuf()); - assert_eq!(local.strftime("%%"), "%".to_strbuf()); - - assert_eq!(local.ctime(), "Fri Feb 13 15:31:30 2009".to_strbuf()); - assert_eq!(local.rfc822z(), "Fri, 13 Feb 2009 15:31:30 -0800".to_strbuf()); - assert_eq!(local.rfc3339(), "2009-02-13T15:31:30-08:00".to_strbuf()); - - assert_eq!(utc.ctime(), "Fri Feb 13 23:31:30 2009".to_strbuf()); - assert_eq!(utc.rfc822(), "Fri, 13 Feb 2009 23:31:30 GMT".to_strbuf()); - assert_eq!(utc.rfc822z(), "Fri, 13 Feb 2009 23:31:30 -0000".to_strbuf()); - assert_eq!(utc.rfc3339(), "2009-02-13T23:31:30Z".to_strbuf()); + assert_eq!(local.strftime(""), "".to_string()); + assert_eq!(local.strftime("%A"), "Friday".to_string()); + assert_eq!(local.strftime("%a"), "Fri".to_string()); + assert_eq!(local.strftime("%B"), "February".to_string()); + assert_eq!(local.strftime("%b"), "Feb".to_string()); + assert_eq!(local.strftime("%C"), "20".to_string()); + assert_eq!(local.strftime("%c"), "Fri Feb 13 15:31:30 2009".to_string()); + assert_eq!(local.strftime("%D"), "02/13/09".to_string()); + assert_eq!(local.strftime("%d"), "13".to_string()); + assert_eq!(local.strftime("%e"), "13".to_string()); + assert_eq!(local.strftime("%f"), "000054321".to_string()); + assert_eq!(local.strftime("%F"), "2009-02-13".to_string()); + assert_eq!(local.strftime("%G"), "2009".to_string()); + assert_eq!(local.strftime("%g"), "09".to_string()); + assert_eq!(local.strftime("%H"), "15".to_string()); + assert_eq!(local.strftime("%I"), "03".to_string()); + assert_eq!(local.strftime("%j"), "044".to_string()); + assert_eq!(local.strftime("%k"), "15".to_string()); + assert_eq!(local.strftime("%l"), " 3".to_string()); + assert_eq!(local.strftime("%M"), "31".to_string()); + assert_eq!(local.strftime("%m"), "02".to_string()); + assert_eq!(local.strftime("%n"), "\n".to_string()); + assert_eq!(local.strftime("%P"), "pm".to_string()); + assert_eq!(local.strftime("%p"), "PM".to_string()); + assert_eq!(local.strftime("%R"), "15:31".to_string()); + assert_eq!(local.strftime("%r"), "03:31:30 PM".to_string()); + assert_eq!(local.strftime("%S"), "30".to_string()); + assert_eq!(local.strftime("%s"), "1234567890".to_string()); + assert_eq!(local.strftime("%T"), "15:31:30".to_string()); + assert_eq!(local.strftime("%t"), "\t".to_string()); + assert_eq!(local.strftime("%U"), "06".to_string()); + assert_eq!(local.strftime("%u"), "5".to_string()); + assert_eq!(local.strftime("%V"), "07".to_string()); + assert_eq!(local.strftime("%v"), "13-Feb-2009".to_string()); + assert_eq!(local.strftime("%W"), "06".to_string()); + assert_eq!(local.strftime("%w"), "5".to_string()); + assert_eq!(local.strftime("%X"), "15:31:30".to_string()); // FIXME (#2350): support locale + assert_eq!(local.strftime("%x"), "02/13/09".to_string()); // FIXME (#2350): support locale + assert_eq!(local.strftime("%Y"), "2009".to_string()); + assert_eq!(local.strftime("%y"), "09".to_string()); + assert_eq!(local.strftime("%+"), "2009-02-13T15:31:30-08:00".to_string()); + assert_eq!(local.strftime("%z"), "-0800".to_string()); + assert_eq!(local.strftime("%%"), "%".to_string()); + + assert_eq!(local.ctime(), "Fri Feb 13 15:31:30 2009".to_string()); + assert_eq!(local.rfc822z(), "Fri, 13 Feb 2009 15:31:30 -0800".to_string()); + assert_eq!(local.rfc3339(), "2009-02-13T15:31:30-08:00".to_string()); + + assert_eq!(utc.ctime(), "Fri Feb 13 23:31:30 2009".to_string()); + assert_eq!(utc.rfc822(), "Fri, 13 Feb 2009 23:31:30 GMT".to_string()); + assert_eq!(utc.rfc822z(), "Fri, 13 Feb 2009 23:31:30 -0000".to_string()); + assert_eq!(utc.rfc3339(), "2009-02-13T23:31:30Z".to_string()); } fn test_timespec_eq_ord() { diff --git a/src/liburl/lib.rs b/src/liburl/lib.rs index e02993fc1c528..b049246ca1883 100644 --- a/src/liburl/lib.rs +++ b/src/liburl/lib.rs @@ -39,13 +39,13 @@ use std::uint; /// ```rust /// use url::{Url, UserInfo}; /// -/// let url = Url { scheme: "https".to_strbuf(), -/// user: Some(UserInfo { user: "username".to_strbuf(), pass: None }), -/// host: "example.com".to_strbuf(), -/// port: Some("8080".to_strbuf()), -/// path: "/foo/bar".to_strbuf(), -/// query: vec!(("baz".to_strbuf(), "qux".to_strbuf())), -/// fragment: Some("quz".to_strbuf()) }; +/// let url = Url { scheme: "https".to_string(), +/// user: Some(UserInfo { user: "username".to_string(), pass: None }), +/// host: "example.com".to_string(), +/// port: Some("8080".to_string()), +/// path: "/foo/bar".to_string(), +/// query: vec!(("baz".to_string(), "qux".to_string())), +/// fragment: Some("quz".to_string()) }; /// // https://username@example.com:8080/foo/bar?baz=qux#quz /// ``` #[deriving(Clone, Eq, TotalEq)] @@ -61,7 +61,7 @@ pub struct Url { /// The path component of a URL, for example `/foo/bar`. pub path: String, /// The query component of a URL. - /// `vec!(("baz".to_strbuf(), "qux".to_strbuf()))` represents the fragment + /// `vec!(("baz".to_string(), "qux".to_string()))` represents the fragment /// `baz=qux` in the above example. pub query: Query, /// The fragment component, such as `quz`. Doesn't include the leading `#` character. @@ -73,7 +73,7 @@ pub struct Path { /// The path component of a URL, for example `/foo/bar`. pub path: String, /// The query component of a URL. - /// `vec!(("baz".to_strbuf(), "qux".to_strbuf()))` represents the fragment + /// `vec!(("baz".to_string(), "qux".to_string()))` represents the fragment /// `baz=qux` in the above example. pub query: Query, /// The fragment component, such as `quz`. Doesn't include the leading `#` character. @@ -417,10 +417,10 @@ fn split_char_first(s: &str, c: char) -> (String, String) { } } if index+mat == len { - return (s.slice(0, index).to_strbuf(), "".to_strbuf()); + return (s.slice(0, index).to_string(), "".to_string()); } else { - return (s.slice(0, index).to_strbuf(), - s.slice(index + mat, s.len()).to_strbuf()); + return (s.slice(0, index).to_string(), + s.slice(index + mat, s.len()).to_string()); } } @@ -451,9 +451,9 @@ fn query_from_str(rawquery: &str) -> Query { * # Example * * ```rust - * let query = vec!(("title".to_strbuf(), "The Village".to_strbuf()), - ("north".to_strbuf(), "52.91".to_strbuf()), - ("west".to_strbuf(), "4.10".to_strbuf())); + * let query = vec!(("title".to_string(), "The Village".to_string()), + ("north".to_string(), "52.91".to_string()), + ("west".to_string(), "4.10".to_string())); * println!("{}", url::query_to_str(&query)); // title=The%20Village&north=52.91&west=4.10 * ``` */ @@ -468,7 +468,7 @@ pub fn query_to_str(query: &Query) -> String { write!(&mut writer, "{}={}", encode_component(k.as_slice()), encode_component(v.as_slice())); } - str::from_utf8_lossy(writer.unwrap().as_slice()).to_strbuf() + str::from_utf8_lossy(writer.unwrap().as_slice()).to_string() } /** @@ -483,7 +483,7 @@ pub fn query_to_str(query: &Query) -> String { * * let scheme = match get_scheme("https://example.com/") { * Ok((sch, _)) => sch, - * Err(_) => "(None)".to_strbuf(), + * Err(_) => "(None)".to_string(), * }; * println!("Scheme in use: {}.", scheme); // Scheme in use: https. * ``` @@ -495,24 +495,24 @@ pub fn get_scheme(rawurl: &str) -> Result<(String, String), String> { '0' .. '9' | '+' | '-' | '.' => { if i == 0 { return Err("url: Scheme must begin with a \ - letter.".to_strbuf()); + letter.".to_string()); } continue; } ':' => { if i == 0 { - return Err("url: Scheme cannot be empty.".to_strbuf()); + return Err("url: Scheme cannot be empty.".to_string()); } else { - return Ok((rawurl.slice(0,i).to_strbuf(), - rawurl.slice(i+1,rawurl.len()).to_strbuf())); + return Ok((rawurl.slice(0,i).to_string(), + rawurl.slice(i+1,rawurl.len()).to_string())); } } _ => { - return Err("url: Invalid character in scheme.".to_strbuf()); + return Err("url: Invalid character in scheme.".to_string()); } } }; - return Err("url: Scheme must be terminated with a colon.".to_strbuf()); + return Err("url: Scheme must be terminated with a colon.".to_string()); } #[deriving(Clone, Eq)] @@ -527,7 +527,7 @@ fn get_authority(rawurl: &str) -> Result<(Option, String, Option, String), String> { if !rawurl.starts_with("//") { // there is no authority. - return Ok((None, "".to_strbuf(), None, rawurl.to_str().to_strbuf())); + return Ok((None, "".to_string(), None, rawurl.to_str().to_string())); } enum State { @@ -544,7 +544,7 @@ fn get_authority(rawurl: &str) -> let mut input = Digit; // most restricted, start here. let mut userinfo = None; - let mut host = "".to_strbuf(); + let mut host = "".to_string(); let mut port = None; let mut colon_count = 0; @@ -571,7 +571,7 @@ fn get_authority(rawurl: &str) -> // separators, don't change anything } _ => { - return Err("Illegal character in authority".to_strbuf()); + return Err("Illegal character in authority".to_string()); } } @@ -588,7 +588,7 @@ fn get_authority(rawurl: &str) -> // multiple colons means ipv6 address. if input == Unreserved { return Err( - "Illegal characters in IPv6 address.".to_strbuf()); + "Illegal characters in IPv6 address.".to_string()); } st = Ip6Host; } @@ -596,7 +596,7 @@ fn get_authority(rawurl: &str) -> pos = i; if input == Unreserved { // must be port - host = rawurl.slice(begin, i).to_strbuf(); + host = rawurl.slice(begin, i).to_string(); st = InPort; } else { // can't be sure whether this is an ipv6 address or a port @@ -606,19 +606,19 @@ fn get_authority(rawurl: &str) -> Ip6Port => { if input == Unreserved { return Err("Illegal characters in \ - authority.".to_strbuf()); + authority.".to_string()); } st = Ip6Host; } Ip6Host => { if colon_count > 7 { - host = rawurl.slice(begin, i).to_strbuf(); + host = rawurl.slice(begin, i).to_string(); pos = i; st = InPort; } } _ => { - return Err("Invalid ':' in authority.".to_strbuf()); + return Err("Invalid ':' in authority.".to_string()); } } input = Digit; // reset input class @@ -629,18 +629,18 @@ fn get_authority(rawurl: &str) -> colon_count = 0; // reset count match st { Start => { - let user = rawurl.slice(begin, i).to_strbuf(); + let user = rawurl.slice(begin, i).to_string(); userinfo = Some(UserInfo::new(user, None)); st = InHost; } PassHostPort => { - let user = rawurl.slice(begin, pos).to_strbuf(); - let pass = rawurl.slice(pos+1, i).to_strbuf(); + let user = rawurl.slice(begin, pos).to_string(); + let pass = rawurl.slice(pos+1, i).to_string(); userinfo = Some(UserInfo::new(user, Some(pass))); st = InHost; } _ => { - return Err("Invalid '@' in authority.".to_strbuf()); + return Err("Invalid '@' in authority.".to_string()); } } begin = i+1; @@ -657,27 +657,27 @@ fn get_authority(rawurl: &str) -> // finish up match st { Start => { - host = rawurl.slice(begin, end).to_strbuf(); + host = rawurl.slice(begin, end).to_string(); } PassHostPort | Ip6Port => { if input != Digit { - return Err("Non-digit characters in port.".to_strbuf()); + return Err("Non-digit characters in port.".to_string()); } - host = rawurl.slice(begin, pos).to_strbuf(); - port = Some(rawurl.slice(pos+1, end).to_strbuf()); + host = rawurl.slice(begin, pos).to_string(); + port = Some(rawurl.slice(pos+1, end).to_string()); } Ip6Host | InHost => { - host = rawurl.slice(begin, end).to_strbuf(); + host = rawurl.slice(begin, end).to_string(); } InPort => { if input != Digit { - return Err("Non-digit characters in port.".to_strbuf()); + return Err("Non-digit characters in port.".to_string()); } - port = Some(rawurl.slice(pos+1, end).to_strbuf()); + port = Some(rawurl.slice(pos+1, end).to_string()); } } - let rest = rawurl.slice(end, len).to_strbuf(); + let rest = rawurl.slice(end, len).to_string(); return Ok((userinfo, host, port, rest)); } @@ -698,19 +698,19 @@ fn get_path(rawurl: &str, authority: bool) -> end = i; break; } - _ => return Err("Invalid character in path.".to_strbuf()) + _ => return Err("Invalid character in path.".to_string()) } } if authority { if end != 0 && !rawurl.starts_with("/") { return Err("Non-empty path must begin with\ - '/' in presence of authority.".to_strbuf()); + '/' in presence of authority.".to_string()); } } return Ok((decode_component(rawurl.slice(0, end)), - rawurl.slice(end, len).to_strbuf())); + rawurl.slice(end, len).to_string())); } // returns the parsed query and the fragment, if present @@ -888,53 +888,53 @@ impl Hash for Path { #[test] fn test_split_char_first() { let (u,v) = split_char_first("hello, sweet world", ','); - assert_eq!(u, "hello".to_strbuf()); - assert_eq!(v, " sweet world".to_strbuf()); + assert_eq!(u, "hello".to_string()); + assert_eq!(v, " sweet world".to_string()); let (u,v) = split_char_first("hello sweet world", ','); - assert_eq!(u, "hello sweet world".to_strbuf()); - assert_eq!(v, "".to_strbuf()); + assert_eq!(u, "hello sweet world".to_string()); + assert_eq!(v, "".to_string()); } #[test] fn test_get_authority() { let (u, h, p, r) = get_authority( "//user:pass@rust-lang.org/something").unwrap(); - assert_eq!(u, Some(UserInfo::new("user".to_strbuf(), Some("pass".to_strbuf())))); - assert_eq!(h, "rust-lang.org".to_strbuf()); + assert_eq!(u, Some(UserInfo::new("user".to_string(), Some("pass".to_string())))); + assert_eq!(h, "rust-lang.org".to_string()); assert!(p.is_none()); - assert_eq!(r, "/something".to_strbuf()); + assert_eq!(r, "/something".to_string()); let (u, h, p, r) = get_authority( "//rust-lang.org:8000?something").unwrap(); assert!(u.is_none()); - assert_eq!(h, "rust-lang.org".to_strbuf()); - assert_eq!(p, Some("8000".to_strbuf())); - assert_eq!(r, "?something".to_strbuf()); + assert_eq!(h, "rust-lang.org".to_string()); + assert_eq!(p, Some("8000".to_string())); + assert_eq!(r, "?something".to_string()); let (u, h, p, r) = get_authority( "//rust-lang.org#blah").unwrap(); assert!(u.is_none()); - assert_eq!(h, "rust-lang.org".to_strbuf()); + assert_eq!(h, "rust-lang.org".to_string()); assert!(p.is_none()); - assert_eq!(r, "#blah".to_strbuf()); + assert_eq!(r, "#blah".to_string()); // ipv6 tests let (_, h, _, _) = get_authority( "//2001:0db8:85a3:0042:0000:8a2e:0370:7334#blah").unwrap(); - assert_eq!(h, "2001:0db8:85a3:0042:0000:8a2e:0370:7334".to_strbuf()); + assert_eq!(h, "2001:0db8:85a3:0042:0000:8a2e:0370:7334".to_string()); let (_, h, p, _) = get_authority( "//2001:0db8:85a3:0042:0000:8a2e:0370:7334:8000#blah").unwrap(); - assert_eq!(h, "2001:0db8:85a3:0042:0000:8a2e:0370:7334".to_strbuf()); - assert_eq!(p, Some("8000".to_strbuf())); + assert_eq!(h, "2001:0db8:85a3:0042:0000:8a2e:0370:7334".to_string()); + assert_eq!(p, Some("8000".to_string())); let (u, h, p, _) = get_authority( "//us:p@2001:0db8:85a3:0042:0000:8a2e:0370:7334:8000#blah" ).unwrap(); - assert_eq!(u, Some(UserInfo::new("us".to_strbuf(), Some("p".to_strbuf())))); - assert_eq!(h, "2001:0db8:85a3:0042:0000:8a2e:0370:7334".to_strbuf()); - assert_eq!(p, Some("8000".to_strbuf())); + assert_eq!(u, Some(UserInfo::new("us".to_string(), Some("p".to_string())))); + assert_eq!(h, "2001:0db8:85a3:0042:0000:8a2e:0370:7334".to_string()); + assert_eq!(p, Some("8000".to_string())); // invalid authorities; assert!(get_authority("//user:pass@rust-lang:something").is_err()); @@ -946,22 +946,22 @@ fn test_get_authority() { // these parse as empty, because they don't start with '//' let (_, h, _, _) = get_authority("user:pass@rust-lang").unwrap(); - assert_eq!(h, "".to_strbuf()); + assert_eq!(h, "".to_string()); let (_, h, _, _) = get_authority("rust-lang.org").unwrap(); - assert_eq!(h, "".to_strbuf()); + assert_eq!(h, "".to_string()); } #[test] fn test_get_path() { let (p, r) = get_path("/something+%20orother", true).unwrap(); - assert_eq!(p, "/something+ orother".to_strbuf()); - assert_eq!(r, "".to_strbuf()); + assert_eq!(p, "/something+ orother".to_string()); + assert_eq!(r, "".to_string()); let (p, r) = get_path("test@email.com#fragment", false).unwrap(); - assert_eq!(p, "test@email.com".to_strbuf()); - assert_eq!(r, "#fragment".to_strbuf()); + assert_eq!(p, "test@email.com".to_string()); + assert_eq!(r, "#fragment".to_string()); let (p, r) = get_path("/gen/:addr=?q=v", false).unwrap(); - assert_eq!(p, "/gen/:addr=".to_strbuf()); - assert_eq!(r, "?q=v".to_strbuf()); + assert_eq!(p, "/gen/:addr=".to_string()); + assert_eq!(r, "?q=v".to_string()); //failure cases assert!(get_path("something?q", true).is_err()); @@ -981,13 +981,13 @@ mod tests { let up = from_str(url); let u = up.unwrap(); - assert_eq!(&u.scheme, &"http".to_strbuf()); - assert_eq!(&u.user, &Some(UserInfo::new("user".to_strbuf(), Some("pass".to_strbuf())))); - assert_eq!(&u.host, &"rust-lang.org".to_strbuf()); - assert_eq!(&u.port, &Some("8080".to_strbuf())); - assert_eq!(&u.path, &"/doc/~u".to_strbuf()); - assert_eq!(&u.query, &vec!(("s".to_strbuf(), "v".to_strbuf()))); - assert_eq!(&u.fragment, &Some("something".to_strbuf())); + assert_eq!(&u.scheme, &"http".to_string()); + assert_eq!(&u.user, &Some(UserInfo::new("user".to_string(), Some("pass".to_string())))); + assert_eq!(&u.host, &"rust-lang.org".to_string()); + assert_eq!(&u.port, &Some("8080".to_string())); + assert_eq!(&u.path, &"/doc/~u".to_string()); + assert_eq!(&u.query, &vec!(("s".to_string(), "v".to_string()))); + assert_eq!(&u.fragment, &Some("something".to_string())); } #[test] @@ -996,69 +996,69 @@ mod tests { let up = path_from_str(path); let u = up.unwrap(); - assert_eq!(&u.path, &"/doc/~u".to_strbuf()); - assert_eq!(&u.query, &vec!(("s".to_strbuf(), "v".to_strbuf()))); - assert_eq!(&u.fragment, &Some("something".to_strbuf())); + assert_eq!(&u.path, &"/doc/~u".to_string()); + assert_eq!(&u.query, &vec!(("s".to_string(), "v".to_string()))); + assert_eq!(&u.fragment, &Some("something".to_string())); } #[test] fn test_url_parse_host_slash() { let urlstr = "http://0.42.42.42/"; let url = from_str(urlstr).unwrap(); - assert!(url.host == "0.42.42.42".to_strbuf()); - assert!(url.path == "/".to_strbuf()); + assert!(url.host == "0.42.42.42".to_string()); + assert!(url.path == "/".to_string()); } #[test] fn test_path_parse_host_slash() { let pathstr = "/"; let path = path_from_str(pathstr).unwrap(); - assert!(path.path == "/".to_strbuf()); + assert!(path.path == "/".to_string()); } #[test] fn test_url_host_with_port() { let urlstr = "scheme://host:1234"; let url = from_str(urlstr).unwrap(); - assert_eq!(&url.scheme, &"scheme".to_strbuf()); - assert_eq!(&url.host, &"host".to_strbuf()); - assert_eq!(&url.port, &Some("1234".to_strbuf())); + assert_eq!(&url.scheme, &"scheme".to_string()); + assert_eq!(&url.host, &"host".to_string()); + assert_eq!(&url.port, &Some("1234".to_string())); // is empty path really correct? Other tests think so - assert_eq!(&url.path, &"".to_strbuf()); + assert_eq!(&url.path, &"".to_string()); let urlstr = "scheme://host:1234/"; let url = from_str(urlstr).unwrap(); - assert_eq!(&url.scheme, &"scheme".to_strbuf()); - assert_eq!(&url.host, &"host".to_strbuf()); - assert_eq!(&url.port, &Some("1234".to_strbuf())); - assert_eq!(&url.path, &"/".to_strbuf()); + assert_eq!(&url.scheme, &"scheme".to_string()); + assert_eq!(&url.host, &"host".to_string()); + assert_eq!(&url.port, &Some("1234".to_string())); + assert_eq!(&url.path, &"/".to_string()); } #[test] fn test_url_with_underscores() { let urlstr = "http://dotcom.com/file_name.html"; let url = from_str(urlstr).unwrap(); - assert!(url.path == "/file_name.html".to_strbuf()); + assert!(url.path == "/file_name.html".to_string()); } #[test] fn test_path_with_underscores() { let pathstr = "/file_name.html"; let path = path_from_str(pathstr).unwrap(); - assert!(path.path == "/file_name.html".to_strbuf()); + assert!(path.path == "/file_name.html".to_string()); } #[test] fn test_url_with_dashes() { let urlstr = "http://dotcom.com/file-name.html"; let url = from_str(urlstr).unwrap(); - assert!(url.path == "/file-name.html".to_strbuf()); + assert!(url.path == "/file-name.html".to_string()); } #[test] fn test_path_with_dashes() { let pathstr = "/file-name.html"; let path = path_from_str(pathstr).unwrap(); - assert!(path.path == "/file-name.html".to_strbuf()); + assert!(path.path == "/file-name.html".to_string()); } #[test] @@ -1137,16 +1137,16 @@ mod tests { fn test_url_component_encoding() { let url = "http://rust-lang.org/doc%20uments?ba%25d%20=%23%26%2B"; let u = from_str(url).unwrap(); - assert!(u.path == "/doc uments".to_strbuf()); - assert!(u.query == vec!(("ba%d ".to_strbuf(), "#&+".to_strbuf()))); + assert!(u.path == "/doc uments".to_string()); + assert!(u.query == vec!(("ba%d ".to_string(), "#&+".to_string()))); } #[test] fn test_path_component_encoding() { let path = "/doc%20uments?ba%25d%20=%23%26%2B"; let p = path_from_str(path).unwrap(); - assert!(p.path == "/doc uments".to_strbuf()); - assert!(p.query == vec!(("ba%d ".to_strbuf(), "#&+".to_strbuf()))); + assert!(p.path == "/doc uments".to_string()); + assert!(p.query == vec!(("ba%d ".to_string(), "#&+".to_string()))); } #[test] @@ -1157,134 +1157,134 @@ mod tests { #[test] fn test_encode() { - assert_eq!(encode(""), "".to_strbuf()); - assert_eq!(encode("http://example.com"), "http://example.com".to_strbuf()); - assert_eq!(encode("foo bar% baz"), "foo%20bar%25%20baz".to_strbuf()); - assert_eq!(encode(" "), "%20".to_strbuf()); - assert_eq!(encode("!"), "!".to_strbuf()); - assert_eq!(encode("\""), "\"".to_strbuf()); - assert_eq!(encode("#"), "#".to_strbuf()); - assert_eq!(encode("$"), "$".to_strbuf()); - assert_eq!(encode("%"), "%25".to_strbuf()); - assert_eq!(encode("&"), "&".to_strbuf()); - assert_eq!(encode("'"), "%27".to_strbuf()); - assert_eq!(encode("("), "(".to_strbuf()); - assert_eq!(encode(")"), ")".to_strbuf()); - assert_eq!(encode("*"), "*".to_strbuf()); - assert_eq!(encode("+"), "+".to_strbuf()); - assert_eq!(encode(","), ",".to_strbuf()); - assert_eq!(encode("/"), "/".to_strbuf()); - assert_eq!(encode(":"), ":".to_strbuf()); - assert_eq!(encode(";"), ";".to_strbuf()); - assert_eq!(encode("="), "=".to_strbuf()); - assert_eq!(encode("?"), "?".to_strbuf()); - assert_eq!(encode("@"), "@".to_strbuf()); - assert_eq!(encode("["), "[".to_strbuf()); - assert_eq!(encode("]"), "]".to_strbuf()); + assert_eq!(encode(""), "".to_string()); + assert_eq!(encode("http://example.com"), "http://example.com".to_string()); + assert_eq!(encode("foo bar% baz"), "foo%20bar%25%20baz".to_string()); + assert_eq!(encode(" "), "%20".to_string()); + assert_eq!(encode("!"), "!".to_string()); + assert_eq!(encode("\""), "\"".to_string()); + assert_eq!(encode("#"), "#".to_string()); + assert_eq!(encode("$"), "$".to_string()); + assert_eq!(encode("%"), "%25".to_string()); + assert_eq!(encode("&"), "&".to_string()); + assert_eq!(encode("'"), "%27".to_string()); + assert_eq!(encode("("), "(".to_string()); + assert_eq!(encode(")"), ")".to_string()); + assert_eq!(encode("*"), "*".to_string()); + assert_eq!(encode("+"), "+".to_string()); + assert_eq!(encode(","), ",".to_string()); + assert_eq!(encode("/"), "/".to_string()); + assert_eq!(encode(":"), ":".to_string()); + assert_eq!(encode(";"), ";".to_string()); + assert_eq!(encode("="), "=".to_string()); + assert_eq!(encode("?"), "?".to_string()); + assert_eq!(encode("@"), "@".to_string()); + assert_eq!(encode("["), "[".to_string()); + assert_eq!(encode("]"), "]".to_string()); } #[test] fn test_encode_component() { - assert_eq!(encode_component(""), "".to_strbuf()); + assert_eq!(encode_component(""), "".to_string()); assert!(encode_component("http://example.com") == - "http%3A%2F%2Fexample.com".to_strbuf()); + "http%3A%2F%2Fexample.com".to_string()); assert!(encode_component("foo bar% baz") == - "foo%20bar%25%20baz".to_strbuf()); - assert_eq!(encode_component(" "), "%20".to_strbuf()); - assert_eq!(encode_component("!"), "%21".to_strbuf()); - assert_eq!(encode_component("#"), "%23".to_strbuf()); - assert_eq!(encode_component("$"), "%24".to_strbuf()); - assert_eq!(encode_component("%"), "%25".to_strbuf()); - assert_eq!(encode_component("&"), "%26".to_strbuf()); - assert_eq!(encode_component("'"), "%27".to_strbuf()); - assert_eq!(encode_component("("), "%28".to_strbuf()); - assert_eq!(encode_component(")"), "%29".to_strbuf()); - assert_eq!(encode_component("*"), "%2A".to_strbuf()); - assert_eq!(encode_component("+"), "%2B".to_strbuf()); - assert_eq!(encode_component(","), "%2C".to_strbuf()); - assert_eq!(encode_component("/"), "%2F".to_strbuf()); - assert_eq!(encode_component(":"), "%3A".to_strbuf()); - assert_eq!(encode_component(";"), "%3B".to_strbuf()); - assert_eq!(encode_component("="), "%3D".to_strbuf()); - assert_eq!(encode_component("?"), "%3F".to_strbuf()); - assert_eq!(encode_component("@"), "%40".to_strbuf()); - assert_eq!(encode_component("["), "%5B".to_strbuf()); - assert_eq!(encode_component("]"), "%5D".to_strbuf()); + "foo%20bar%25%20baz".to_string()); + assert_eq!(encode_component(" "), "%20".to_string()); + assert_eq!(encode_component("!"), "%21".to_string()); + assert_eq!(encode_component("#"), "%23".to_string()); + assert_eq!(encode_component("$"), "%24".to_string()); + assert_eq!(encode_component("%"), "%25".to_string()); + assert_eq!(encode_component("&"), "%26".to_string()); + assert_eq!(encode_component("'"), "%27".to_string()); + assert_eq!(encode_component("("), "%28".to_string()); + assert_eq!(encode_component(")"), "%29".to_string()); + assert_eq!(encode_component("*"), "%2A".to_string()); + assert_eq!(encode_component("+"), "%2B".to_string()); + assert_eq!(encode_component(","), "%2C".to_string()); + assert_eq!(encode_component("/"), "%2F".to_string()); + assert_eq!(encode_component(":"), "%3A".to_string()); + assert_eq!(encode_component(";"), "%3B".to_string()); + assert_eq!(encode_component("="), "%3D".to_string()); + assert_eq!(encode_component("?"), "%3F".to_string()); + assert_eq!(encode_component("@"), "%40".to_string()); + assert_eq!(encode_component("["), "%5B".to_string()); + assert_eq!(encode_component("]"), "%5D".to_string()); } #[test] fn test_decode() { - assert_eq!(decode(""), "".to_strbuf()); - assert_eq!(decode("abc/def 123"), "abc/def 123".to_strbuf()); - assert_eq!(decode("abc%2Fdef%20123"), "abc%2Fdef 123".to_strbuf()); - assert_eq!(decode("%20"), " ".to_strbuf()); - assert_eq!(decode("%21"), "%21".to_strbuf()); - assert_eq!(decode("%22"), "%22".to_strbuf()); - assert_eq!(decode("%23"), "%23".to_strbuf()); - assert_eq!(decode("%24"), "%24".to_strbuf()); - assert_eq!(decode("%25"), "%".to_strbuf()); - assert_eq!(decode("%26"), "%26".to_strbuf()); - assert_eq!(decode("%27"), "'".to_strbuf()); - assert_eq!(decode("%28"), "%28".to_strbuf()); - assert_eq!(decode("%29"), "%29".to_strbuf()); - assert_eq!(decode("%2A"), "%2A".to_strbuf()); - assert_eq!(decode("%2B"), "%2B".to_strbuf()); - assert_eq!(decode("%2C"), "%2C".to_strbuf()); - assert_eq!(decode("%2F"), "%2F".to_strbuf()); - assert_eq!(decode("%3A"), "%3A".to_strbuf()); - assert_eq!(decode("%3B"), "%3B".to_strbuf()); - assert_eq!(decode("%3D"), "%3D".to_strbuf()); - assert_eq!(decode("%3F"), "%3F".to_strbuf()); - assert_eq!(decode("%40"), "%40".to_strbuf()); - assert_eq!(decode("%5B"), "%5B".to_strbuf()); - assert_eq!(decode("%5D"), "%5D".to_strbuf()); + assert_eq!(decode(""), "".to_string()); + assert_eq!(decode("abc/def 123"), "abc/def 123".to_string()); + assert_eq!(decode("abc%2Fdef%20123"), "abc%2Fdef 123".to_string()); + assert_eq!(decode("%20"), " ".to_string()); + assert_eq!(decode("%21"), "%21".to_string()); + assert_eq!(decode("%22"), "%22".to_string()); + assert_eq!(decode("%23"), "%23".to_string()); + assert_eq!(decode("%24"), "%24".to_string()); + assert_eq!(decode("%25"), "%".to_string()); + assert_eq!(decode("%26"), "%26".to_string()); + assert_eq!(decode("%27"), "'".to_string()); + assert_eq!(decode("%28"), "%28".to_string()); + assert_eq!(decode("%29"), "%29".to_string()); + assert_eq!(decode("%2A"), "%2A".to_string()); + assert_eq!(decode("%2B"), "%2B".to_string()); + assert_eq!(decode("%2C"), "%2C".to_string()); + assert_eq!(decode("%2F"), "%2F".to_string()); + assert_eq!(decode("%3A"), "%3A".to_string()); + assert_eq!(decode("%3B"), "%3B".to_string()); + assert_eq!(decode("%3D"), "%3D".to_string()); + assert_eq!(decode("%3F"), "%3F".to_string()); + assert_eq!(decode("%40"), "%40".to_string()); + assert_eq!(decode("%5B"), "%5B".to_string()); + assert_eq!(decode("%5D"), "%5D".to_string()); } #[test] fn test_decode_component() { - assert_eq!(decode_component(""), "".to_strbuf()); - assert_eq!(decode_component("abc/def 123"), "abc/def 123".to_strbuf()); - assert_eq!(decode_component("abc%2Fdef%20123"), "abc/def 123".to_strbuf()); - assert_eq!(decode_component("%20"), " ".to_strbuf()); - assert_eq!(decode_component("%21"), "!".to_strbuf()); - assert_eq!(decode_component("%22"), "\"".to_strbuf()); - assert_eq!(decode_component("%23"), "#".to_strbuf()); - assert_eq!(decode_component("%24"), "$".to_strbuf()); - assert_eq!(decode_component("%25"), "%".to_strbuf()); - assert_eq!(decode_component("%26"), "&".to_strbuf()); - assert_eq!(decode_component("%27"), "'".to_strbuf()); - assert_eq!(decode_component("%28"), "(".to_strbuf()); - assert_eq!(decode_component("%29"), ")".to_strbuf()); - assert_eq!(decode_component("%2A"), "*".to_strbuf()); - assert_eq!(decode_component("%2B"), "+".to_strbuf()); - assert_eq!(decode_component("%2C"), ",".to_strbuf()); - assert_eq!(decode_component("%2F"), "/".to_strbuf()); - assert_eq!(decode_component("%3A"), ":".to_strbuf()); - assert_eq!(decode_component("%3B"), ";".to_strbuf()); - assert_eq!(decode_component("%3D"), "=".to_strbuf()); - assert_eq!(decode_component("%3F"), "?".to_strbuf()); - assert_eq!(decode_component("%40"), "@".to_strbuf()); - assert_eq!(decode_component("%5B"), "[".to_strbuf()); - assert_eq!(decode_component("%5D"), "]".to_strbuf()); + assert_eq!(decode_component(""), "".to_string()); + assert_eq!(decode_component("abc/def 123"), "abc/def 123".to_string()); + assert_eq!(decode_component("abc%2Fdef%20123"), "abc/def 123".to_string()); + assert_eq!(decode_component("%20"), " ".to_string()); + assert_eq!(decode_component("%21"), "!".to_string()); + assert_eq!(decode_component("%22"), "\"".to_string()); + assert_eq!(decode_component("%23"), "#".to_string()); + assert_eq!(decode_component("%24"), "$".to_string()); + assert_eq!(decode_component("%25"), "%".to_string()); + assert_eq!(decode_component("%26"), "&".to_string()); + assert_eq!(decode_component("%27"), "'".to_string()); + assert_eq!(decode_component("%28"), "(".to_string()); + assert_eq!(decode_component("%29"), ")".to_string()); + assert_eq!(decode_component("%2A"), "*".to_string()); + assert_eq!(decode_component("%2B"), "+".to_string()); + assert_eq!(decode_component("%2C"), ",".to_string()); + assert_eq!(decode_component("%2F"), "/".to_string()); + assert_eq!(decode_component("%3A"), ":".to_string()); + assert_eq!(decode_component("%3B"), ";".to_string()); + assert_eq!(decode_component("%3D"), "=".to_string()); + assert_eq!(decode_component("%3F"), "?".to_string()); + assert_eq!(decode_component("%40"), "@".to_string()); + assert_eq!(decode_component("%5B"), "[".to_string()); + assert_eq!(decode_component("%5D"), "]".to_string()); } #[test] fn test_encode_form_urlencoded() { let mut m = HashMap::new(); - assert_eq!(encode_form_urlencoded(&m), "".to_strbuf()); + assert_eq!(encode_form_urlencoded(&m), "".to_string()); - m.insert("".to_strbuf(), vec!()); - m.insert("foo".to_strbuf(), vec!()); - assert_eq!(encode_form_urlencoded(&m), "".to_strbuf()); + m.insert("".to_string(), vec!()); + m.insert("foo".to_string(), vec!()); + assert_eq!(encode_form_urlencoded(&m), "".to_string()); let mut m = HashMap::new(); - m.insert("foo".to_strbuf(), vec!("bar".to_strbuf(), "123".to_strbuf())); - assert_eq!(encode_form_urlencoded(&m), "foo=bar&foo=123".to_strbuf()); + m.insert("foo".to_string(), vec!("bar".to_string(), "123".to_string())); + assert_eq!(encode_form_urlencoded(&m), "foo=bar&foo=123".to_string()); let mut m = HashMap::new(); - m.insert("foo bar".to_strbuf(), vec!("abc".to_strbuf(), "12 = 34".to_strbuf())); + m.insert("foo bar".to_string(), vec!("abc".to_string(), "12 = 34".to_string())); assert!(encode_form_urlencoded(&m) == - "foo+bar=abc&foo+bar=12+%3D+34".to_strbuf()); + "foo+bar=abc&foo+bar=12+%3D+34".to_string()); } #[test] @@ -1294,8 +1294,8 @@ mod tests { let s = "a=1&foo+bar=abc&foo+bar=12+%3D+34".as_bytes(); let form = decode_form_urlencoded(s); assert_eq!(form.len(), 2); - assert_eq!(form.get(&"a".to_strbuf()), &vec!("1".to_strbuf())); - assert_eq!(form.get(&"foo bar".to_strbuf()), - &vec!("abc".to_strbuf(), "12 = 34".to_strbuf())); + assert_eq!(form.get(&"a".to_string()), &vec!("1".to_string())); + assert_eq!(form.get(&"foo bar".to_string()), + &vec!("abc".to_string(), "12 = 34".to_string())); } } diff --git a/src/libuuid/lib.rs b/src/libuuid/lib.rs index 351cd590a633f..a9c80c90fd6c8 100644 --- a/src/libuuid/lib.rs +++ b/src/libuuid/lib.rs @@ -329,7 +329,7 @@ impl Uuid { *s.get_mut(i*2+0) = digit.as_slice()[0]; *s.get_mut(i*2+1) = digit.as_slice()[1]; } - str::from_utf8(s.as_slice()).unwrap().to_strbuf() + str::from_utf8(s.as_slice()).unwrap().to_string() } /// Returns a string of hexadecimal digits, separated into groups with a hyphen. @@ -732,7 +732,7 @@ mod test { let u = Uuid::from_fields(d1, d2, d3, d4.as_slice()); - let expected = "a1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8".to_strbuf(); + let expected = "a1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8".to_string(); let result = u.to_simple_str(); assert!(result == expected); } @@ -743,7 +743,7 @@ mod test { 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8 ); let u = Uuid::from_bytes(b.as_slice()).unwrap(); - let expected = "a1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8".to_strbuf(); + let expected = "a1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8".to_string(); assert!(u.to_simple_str() == expected); } diff --git a/src/libworkcache/lib.rs b/src/libworkcache/lib.rs index 2d0d57a8b2135..9a82c411437e3 100644 --- a/src/libworkcache/lib.rs +++ b/src/libworkcache/lib.rs @@ -108,8 +108,8 @@ struct WorkKey { impl WorkKey { pub fn new(kind: &str, name: &str) -> WorkKey { WorkKey { - kind: kind.to_strbuf(), - name: name.to_strbuf(), + kind: kind.to_string(), + name: name.to_string(), } } } @@ -190,7 +190,7 @@ impl Database { // FIXME(pcwalton): Yuck. let mut new_db_cache = TreeMap::new(); for (ref k, ref v) in self.db_cache.iter() { - new_db_cache.insert((*k).to_strbuf(), (*v).to_strbuf()); + new_db_cache.insert((*k).to_string(), (*v).to_string()); } new_db_cache.to_json().to_pretty_writer(&mut f) @@ -262,7 +262,7 @@ fn json_encode<'a, T:Encodable, io::IoError>>(t: &T) -> String let mut writer = MemWriter::new(); let mut encoder = json::Encoder::new(&mut writer as &mut io::Writer); let _ = t.encode(&mut encoder); - str::from_utf8(writer.unwrap().as_slice()).unwrap().to_strbuf() + str::from_utf8(writer.unwrap().as_slice()).unwrap().to_string() } // FIXME(#5121) @@ -313,7 +313,7 @@ impl Exec { dependency_val: &str) { debug!("Discovering input {} {} {}", dependency_kind, dependency_name, dependency_val); self.discovered_inputs.insert_work_key(WorkKey::new(dependency_kind, dependency_name), - dependency_val.to_strbuf()); + dependency_val.to_string()); } pub fn discover_output(&mut self, dependency_kind: &str, @@ -321,7 +321,7 @@ impl Exec { dependency_val: &str) { debug!("Discovering output {} {} {}", dependency_kind, dependency_name, dependency_val); self.discovered_outputs.insert_work_key(WorkKey::new(dependency_kind, dependency_name), - dependency_val.to_strbuf()); + dependency_val.to_string()); } // returns pairs of (kind, name) @@ -364,11 +364,11 @@ impl<'a> Prep<'a> { pub fn declare_input(&mut self, kind: &str, name: &str, val: &str) { debug!("Declaring input {} {} {}", kind, name, val); self.declared_inputs.insert_work_key(WorkKey::new(kind, name), - val.to_strbuf()); + val.to_string()); } fn is_fresh(&self, cat: &str, kind: &str, name: &str, val: &str) -> bool { - let k = kind.to_strbuf(); + let k = kind.to_string(); let f = self.ctxt.freshness.deref().find(&k); debug!("freshness for: {}/{}/{}/{}", cat, kind, name, val) let fresh = match f { @@ -499,10 +499,10 @@ fn test() { return pth; } - let pth = make_path("foo.c".to_strbuf()); + let pth = make_path("foo.c".to_string()); File::create(&pth).write(bytes!("int main() { return 0; }")).unwrap(); - let db_path = make_path("db.json".to_strbuf()); + let db_path = make_path("db.json".to_string()); let cx = Context::new(Arc::new(RWLock::new(Database::new(db_path))), Arc::new(TreeMap::new())); @@ -514,14 +514,14 @@ fn test() { let contents = File::open(&pth).read_to_end().unwrap(); let file_content = from_utf8(contents.as_slice()).unwrap() - .to_strbuf(); + .to_string(); // FIXME (#9639): This needs to handle non-utf8 paths prep.declare_input("file", pth.as_str().unwrap(), file_content.as_slice()); prep.exec(proc(_exe) { - let out = make_path("foo.o".to_strbuf()); + let out = make_path("foo.o".to_string()); let compiler = if cfg!(windows) {"gcc"} else {"cc"}; Command::new(compiler).arg(pth).arg("-o").arg(out.clone()).status().unwrap(); @@ -529,7 +529,7 @@ fn test() { // Could run sub-rules inside here. // FIXME (#9639): This needs to handle non-utf8 paths - out.as_str().unwrap().to_strbuf() + out.as_str().unwrap().to_string() }) }); diff --git a/src/test/auxiliary/crateresolve5-1.rs b/src/test/auxiliary/crateresolve5-1.rs index 39702d74ca8c3..7cfb1dda4b9af 100644 --- a/src/test/auxiliary/crateresolve5-1.rs +++ b/src/test/auxiliary/crateresolve5-1.rs @@ -15,7 +15,7 @@ pub struct NameVal { pub name: String, pub val: int } pub fn struct_nameval() -> NameVal { - NameVal { name: "crateresolve5".to_strbuf(), val: 10 } + NameVal { name: "crateresolve5".to_string(), val: 10 } } pub enum e { diff --git a/src/test/auxiliary/crateresolve5-2.rs b/src/test/auxiliary/crateresolve5-2.rs index a1b19fce343e1..566c4385f3c2a 100644 --- a/src/test/auxiliary/crateresolve5-2.rs +++ b/src/test/auxiliary/crateresolve5-2.rs @@ -14,7 +14,7 @@ pub struct NameVal { pub name: String, pub val: int } pub fn struct_nameval() -> NameVal { - NameVal { name: "crateresolve5".to_strbuf(), val: 10 } + NameVal { name: "crateresolve5".to_string(), val: 10 } } pub enum e { diff --git a/src/test/auxiliary/issue-2631-a.rs b/src/test/auxiliary/issue-2631-a.rs index c8c9d07d90be1..793be5940c973 100644 --- a/src/test/auxiliary/issue-2631-a.rs +++ b/src/test/auxiliary/issue-2631-a.rs @@ -21,7 +21,7 @@ pub type header_map = HashMap>>; // the unused ty param is necessary so this gets monomorphized pub fn request(req: &header_map) { - let _x = (**((**req.get(&"METHOD".to_strbuf())).clone()).borrow() + let _x = (**((**req.get(&"METHOD".to_string())).clone()).borrow() .clone() .get(0)).clone(); } diff --git a/src/test/auxiliary/reexported_static_methods.rs b/src/test/auxiliary/reexported_static_methods.rs index 9a81c10751abe..882442f5e0090 100644 --- a/src/test/auxiliary/reexported_static_methods.rs +++ b/src/test/auxiliary/reexported_static_methods.rs @@ -47,7 +47,7 @@ pub mod sub_foo { impl Bort { pub fn bort() -> String { - "bort()".to_strbuf() + "bort()".to_string() } } } diff --git a/src/test/bench/core-set.rs b/src/test/bench/core-set.rs index 9d8fb798d06c1..ab2f9b0020624 100644 --- a/src/test/bench/core-set.rs +++ b/src/test/bench/core-set.rs @@ -90,11 +90,11 @@ impl Results { let mut set = f(); timed(&mut self.sequential_strings, || { for i in range(0u, num_keys) { - set.insert(i.to_str().to_strbuf()); + set.insert(i.to_str().to_string()); } for i in range(0u, num_keys) { - assert!(set.contains(&i.to_str().to_strbuf())); + assert!(set.contains(&i.to_str().to_string())); } }) } @@ -103,7 +103,7 @@ impl Results { let mut set = f(); timed(&mut self.random_strings, || { for _ in range(0, num_keys) { - let s = rng.gen::().to_str().to_strbuf(); + let s = rng.gen::().to_str().to_string(); set.insert(s); } }) @@ -112,11 +112,11 @@ impl Results { { let mut set = f(); for i in range(0u, num_keys) { - set.insert(i.to_str().to_strbuf()); + set.insert(i.to_str().to_string()); } timed(&mut self.delete_strings, || { for i in range(0u, num_keys) { - assert!(set.remove(&i.to_str().to_strbuf())); + assert!(set.remove(&i.to_str().to_string())); } }) } diff --git a/src/test/bench/core-std.rs b/src/test/bench/core-std.rs index 8cdd9695f0295..d53a89684213d 100644 --- a/src/test/bench/core-std.rs +++ b/src/test/bench/core-std.rs @@ -25,12 +25,12 @@ use std::io::File; macro_rules! bench ( ($argv:expr, $id:ident) => (maybe_run_test($argv.as_slice(), - stringify!($id).to_strbuf(), + stringify!($id).to_string(), $id)) ) fn main() { - let argv = os::args().move_iter().map(|x| x.to_strbuf()).collect::>(); + let argv = os::args().move_iter().map(|x| x.to_string()).collect::>(); let _tests = argv.slice(1, argv.len()); bench!(argv, shift_push); @@ -48,7 +48,7 @@ fn maybe_run_test(argv: &[String], name: String, test: ||) { if os::getenv("RUST_BENCH").is_some() { run_test = true } else if argv.len() > 0 { - run_test = argv.iter().any(|x| x == &"all".to_strbuf()) || argv.iter().any(|x| x == &name) + run_test = argv.iter().any(|x| x == &"all".to_string()) || argv.iter().any(|x| x == &name) } if !run_test { diff --git a/src/test/bench/msgsend-pipes-shared.rs b/src/test/bench/msgsend-pipes-shared.rs index 18fe5da6ca83a..1ec4a236dfd13 100644 --- a/src/test/bench/msgsend-pipes-shared.rs +++ b/src/test/bench/msgsend-pipes-shared.rs @@ -97,11 +97,11 @@ fn run(args: &[String]) { fn main() { let args = os::args(); let args = if os::getenv("RUST_BENCH").is_some() { - vec!("".to_strbuf(), "1000000".to_strbuf(), "10000".to_strbuf()) + vec!("".to_string(), "1000000".to_string(), "10000".to_string()) } else if args.len() <= 1u { - vec!("".to_strbuf(), "10000".to_strbuf(), "4".to_strbuf()) + vec!("".to_string(), "10000".to_string(), "4".to_string()) } else { - args.move_iter().map(|x| x.to_strbuf()).collect() + args.move_iter().map(|x| x.to_string()).collect() }; println!("{}", args); diff --git a/src/test/bench/msgsend-pipes.rs b/src/test/bench/msgsend-pipes.rs index 2ae574080613c..5da3e1e9ca6c5 100644 --- a/src/test/bench/msgsend-pipes.rs +++ b/src/test/bench/msgsend-pipes.rs @@ -107,11 +107,11 @@ fn run(args: &[String]) { fn main() { let args = os::args(); let args = if os::getenv("RUST_BENCH").is_some() { - vec!("".to_strbuf(), "1000000".to_strbuf(), "8".to_strbuf()) + vec!("".to_string(), "1000000".to_string(), "8".to_string()) } else if args.len() <= 1u { - vec!("".to_strbuf(), "10000".to_strbuf(), "4".to_strbuf()) + vec!("".to_string(), "10000".to_string(), "4".to_string()) } else { - args.clone().move_iter().map(|x| x.to_strbuf()).collect() + args.clone().move_iter().map(|x| x.to_string()).collect() }; println!("{:?}", args); diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs index 554e324331511..8be6439d88c41 100644 --- a/src/test/bench/shootout-k-nucleotide-pipes.rs +++ b/src/test/bench/shootout-k-nucleotide-pipes.rs @@ -129,13 +129,13 @@ fn make_sequence_processor(sz: uint, let buffer = match sz { 1u => { sort_and_fmt(&freqs, total) } 2u => { sort_and_fmt(&freqs, total) } - 3u => { format_strbuf!("{}\t{}", find(&freqs, "GGT".to_strbuf()), "GGT") } - 4u => { format_strbuf!("{}\t{}", find(&freqs, "GGTA".to_strbuf()), "GGTA") } - 6u => { format_strbuf!("{}\t{}", find(&freqs, "GGTATT".to_strbuf()), "GGTATT") } - 12u => { format_strbuf!("{}\t{}", find(&freqs, "GGTATTTTAATT".to_strbuf()), "GGTATTTTAATT") } - 18u => { format_strbuf!("{}\t{}", find(&freqs, "GGTATTTTAATTTATAGT".to_strbuf()), + 3u => { format_strbuf!("{}\t{}", find(&freqs, "GGT".to_string()), "GGT") } + 4u => { format_strbuf!("{}\t{}", find(&freqs, "GGTA".to_string()), "GGTA") } + 6u => { format_strbuf!("{}\t{}", find(&freqs, "GGTATT".to_string()), "GGTATT") } + 12u => { format_strbuf!("{}\t{}", find(&freqs, "GGTATTTTAATT".to_string()), "GGTATTTTAATT") } + 18u => { format_strbuf!("{}\t{}", find(&freqs, "GGTATTTTAATTTATAGT".to_string()), "GGTATTTTAATTTATAGT") } - _ => { "".to_strbuf() } + _ => { "".to_string() } }; to_parent.send(buffer); diff --git a/src/test/bench/shootout-pfib.rs b/src/test/bench/shootout-pfib.rs index da61a7780391d..33853a91b7608 100644 --- a/src/test/bench/shootout-pfib.rs +++ b/src/test/bench/shootout-pfib.rs @@ -55,7 +55,7 @@ struct Config { fn parse_opts(argv: Vec ) -> Config { let opts = vec!(getopts::optflag("", "stress", "")); - let argv = argv.iter().map(|x| x.to_strbuf()).collect::>(); + let argv = argv.iter().map(|x| x.to_string()).collect::>(); let opt_args = argv.slice(1, argv.len()); match getopts::getopts(opt_args, opts.as_slice()) { @@ -93,11 +93,11 @@ fn stress(num_tasks: int) { fn main() { let args = os::args(); let args = if os::getenv("RUST_BENCH").is_some() { - vec!("".to_strbuf(), "20".to_strbuf()) + vec!("".to_string(), "20".to_string()) } else if args.len() <= 1u { - vec!("".to_strbuf(), "8".to_strbuf()) + vec!("".to_string(), "8".to_string()) } else { - args.move_iter().map(|x| x.to_strbuf()).collect() + args.move_iter().map(|x| x.to_string()).collect() }; let opts = parse_opts(args.clone()); diff --git a/src/test/compile-fail/binop-bitxor-str.rs b/src/test/compile-fail/binop-bitxor-str.rs index 33110fc23a07b..3f26e3ce904cf 100644 --- a/src/test/compile-fail/binop-bitxor-str.rs +++ b/src/test/compile-fail/binop-bitxor-str.rs @@ -10,4 +10,4 @@ // error-pattern:`^` cannot be applied to type `std::string::String` -fn main() { let x = "a".to_strbuf() ^ "b".to_strbuf(); } +fn main() { let x = "a".to_string() ^ "b".to_string(); } diff --git a/src/test/compile-fail/borrowck-move-error-with-note.rs b/src/test/compile-fail/borrowck-move-error-with-note.rs index 41c6ddfbe4733..976a574a18f7d 100644 --- a/src/test/compile-fail/borrowck-move-error-with-note.rs +++ b/src/test/compile-fail/borrowck-move-error-with-note.rs @@ -34,7 +34,7 @@ impl Drop for S { } fn move_in_match() { - match S {f: "foo".to_strbuf(), g: "bar".to_strbuf()} { + match S {f: "foo".to_string(), g: "bar".to_string()} { S { //~ ERROR cannot move out of type `S`, which defines the `Drop` trait f: _s, //~ NOTE attempting to move value to here g: _t //~ NOTE and here diff --git a/src/test/compile-fail/borrowck-move-out-of-struct-with-dtor.rs b/src/test/compile-fail/borrowck-move-out-of-struct-with-dtor.rs index 47c0004840026..e6cb2d67324a4 100644 --- a/src/test/compile-fail/borrowck-move-out-of-struct-with-dtor.rs +++ b/src/test/compile-fail/borrowck-move-out-of-struct-with-dtor.rs @@ -14,14 +14,14 @@ impl Drop for S { } fn move_in_match() { - match S {f:"foo".to_strbuf()} { + match S {f:"foo".to_string()} { S {f:_s} => {} //~^ ERROR cannot move out of type `S`, which defines the `Drop` trait } } fn move_in_let() { - let S {f:_s} = S {f:"foo".to_strbuf()}; + let S {f:_s} = S {f:"foo".to_string()}; //~^ ERROR cannot move out of type `S`, which defines the `Drop` trait } diff --git a/src/test/compile-fail/borrowck-move-out-of-tuple-struct-with-dtor.rs b/src/test/compile-fail/borrowck-move-out-of-tuple-struct-with-dtor.rs index 51ec8e42a003e..625f71849057b 100644 --- a/src/test/compile-fail/borrowck-move-out-of-tuple-struct-with-dtor.rs +++ b/src/test/compile-fail/borrowck-move-out-of-tuple-struct-with-dtor.rs @@ -14,14 +14,14 @@ impl Drop for S { } fn move_in_match() { - match S("foo".to_strbuf()) { + match S("foo".to_string()) { S(_s) => {} //~^ ERROR cannot move out of type `S`, which defines the `Drop` trait } } fn move_in_let() { - let S(_s) = S("foo".to_strbuf()); + let S(_s) = S("foo".to_string()); //~^ ERROR cannot move out of type `S`, which defines the `Drop` trait } diff --git a/src/test/compile-fail/borrowck-move-out-of-vec-tail.rs b/src/test/compile-fail/borrowck-move-out-of-vec-tail.rs index 52a72d501a00e..4110cfd28efce 100644 --- a/src/test/compile-fail/borrowck-move-out-of-vec-tail.rs +++ b/src/test/compile-fail/borrowck-move-out-of-vec-tail.rs @@ -17,9 +17,9 @@ struct Foo { pub fn main() { let x = vec!( - Foo { string: "foo".to_strbuf() }, - Foo { string: "bar".to_strbuf() }, - Foo { string: "baz".to_strbuf() } + Foo { string: "foo".to_string() }, + Foo { string: "bar".to_string() }, + Foo { string: "baz".to_string() } ); let x: &[Foo] = x.as_slice(); match x { diff --git a/src/test/compile-fail/by-move-pattern-binding.rs b/src/test/compile-fail/by-move-pattern-binding.rs index c0c5c50a786c1..dd9ab6ca74ed8 100644 --- a/src/test/compile-fail/by-move-pattern-binding.rs +++ b/src/test/compile-fail/by-move-pattern-binding.rs @@ -20,7 +20,7 @@ struct S { fn f(x: String) {} fn main() { - let s = S { x: Bar("hello".to_strbuf()) }; + let s = S { x: Bar("hello".to_string()) }; match &s.x { &Foo => {} &Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move diff --git a/src/test/compile-fail/check-static-values-constraints.rs b/src/test/compile-fail/check-static-values-constraints.rs index 0bfb243264b8a..9c6967b461a0d 100644 --- a/src/test/compile-fail/check-static-values-constraints.rs +++ b/src/test/compile-fail/check-static-values-constraints.rs @@ -109,7 +109,7 @@ static mut STATIC13: SafeStruct = SafeStruct{field1: Variant1, field2: Variant3( static mut STATIC14: SafeStruct = SafeStruct { //~^ ERROR mutable static items are not allowed to have destructors field1: Variant1, - field2: Variant4("str".to_strbuf()) + field2: Variant4("str".to_string()) }; static STATIC15: &'static [Box] = &'static [box MyOwned, box MyOwned]; diff --git a/src/test/compile-fail/class-cast-to-trait.rs b/src/test/compile-fail/class-cast-to-trait.rs index e6c74c0d8ea38..ae0f377ba879d 100644 --- a/src/test/compile-fail/class-cast-to-trait.rs +++ b/src/test/compile-fail/class-cast-to-trait.rs @@ -58,6 +58,6 @@ fn cat(in_x : uint, in_y : int, in_name: String) -> cat { } fn main() { - let nyan: Box = box cat(0, 2, "nyan".to_strbuf()) as Box; + let nyan: Box = box cat(0, 2, "nyan".to_string()) as Box; nyan.eat(); //~ ERROR does not implement any method in scope named `eat` } diff --git a/src/test/compile-fail/disallowed-deconstructing-destructing-struct-let.rs b/src/test/compile-fail/disallowed-deconstructing-destructing-struct-let.rs index c499fb26d6856..2621820c2229f 100644 --- a/src/test/compile-fail/disallowed-deconstructing-destructing-struct-let.rs +++ b/src/test/compile-fail/disallowed-deconstructing-destructing-struct-let.rs @@ -24,7 +24,7 @@ fn unwrap(x: X) -> String { } fn main() { - let x = X { x: "hello".to_strbuf() }; + let x = X { x: "hello".to_string() }; let y = unwrap(x); println!("contents: {}", y); } diff --git a/src/test/compile-fail/disallowed-deconstructing-destructing-struct-match.rs b/src/test/compile-fail/disallowed-deconstructing-destructing-struct-match.rs index 80a884c78692f..5078009d4b222 100644 --- a/src/test/compile-fail/disallowed-deconstructing-destructing-struct-match.rs +++ b/src/test/compile-fail/disallowed-deconstructing-destructing-struct-match.rs @@ -19,7 +19,7 @@ impl Drop for X { } fn main() { - let x = X { x: "hello".to_strbuf() }; + let x = X { x: "hello".to_string() }; match x { X { x: y } => println!("contents: {}", y) diff --git a/src/test/compile-fail/integral-indexing.rs b/src/test/compile-fail/integral-indexing.rs index a45d6181941fa..967229a34074b 100644 --- a/src/test/compile-fail/integral-indexing.rs +++ b/src/test/compile-fail/integral-indexing.rs @@ -10,7 +10,7 @@ pub fn main() { let v: Vec = vec!(0, 1, 2, 3, 4, 5); - let s: String = "abcdef".to_strbuf(); + let s: String = "abcdef".to_string(); assert_eq!(v.as_slice()[3u], 3); assert_eq!(v.as_slice()[3u8], 3); //~ ERROR: mismatched types assert_eq!(v.as_slice()[3i8], 3); //~ ERROR: mismatched types diff --git a/src/test/compile-fail/issue-13428.rs b/src/test/compile-fail/issue-13428.rs index 1aac55ab0f64e..85bad9f8d6012 100644 --- a/src/test/compile-fail/issue-13428.rs +++ b/src/test/compile-fail/issue-13428.rs @@ -19,7 +19,7 @@ fn foo() -> String { //~ ERROR not all control paths return a value } fn bar() -> String { //~ ERROR not all control paths return a value - "foobar".to_strbuf() + "foobar".to_string() ; //~ NOTE consider removing this semicolon } diff --git a/src/test/compile-fail/issue-2063.rs b/src/test/compile-fail/issue-2063.rs index 9e22d5f22ec47..2c3dda015471f 100644 --- a/src/test/compile-fail/issue-2063.rs +++ b/src/test/compile-fail/issue-2063.rs @@ -23,7 +23,7 @@ trait to_str_2 { // the compiler to attempt autoderef and then // try to resolve the method. impl to_str_2 for t { - fn my_to_str() -> String { "t".to_strbuf() } + fn my_to_str() -> String { "t".to_string() } } fn new_t(x: t) { diff --git a/src/test/compile-fail/issue-7573.rs b/src/test/compile-fail/issue-7573.rs index 9b0a648e0d6ab..0ce3a62343f27 100644 --- a/src/test/compile-fail/issue-7573.rs +++ b/src/test/compile-fail/issue-7573.rs @@ -17,8 +17,8 @@ pub struct CrateId { impl CrateId { fn new(s: &str) -> CrateId { CrateId { - local_path: s.to_strbuf(), - junk: "wutevs".to_strbuf() + local_path: s.to_string(), + junk: "wutevs".to_string() } } } diff --git a/src/test/compile-fail/match-vec-mismatch.rs b/src/test/compile-fail/match-vec-mismatch.rs index 56d3d76bf7c17..edbdc77f0306d 100644 --- a/src/test/compile-fail/match-vec-mismatch.rs +++ b/src/test/compile-fail/match-vec-mismatch.rs @@ -9,7 +9,7 @@ // except according to those terms. fn main() { - match "foo".to_strbuf() { + match "foo".to_string() { ['f', 'o', ..] => {} //~ ERROR mismatched types _ => { } } diff --git a/src/test/compile-fail/match-vec-unreachable.rs b/src/test/compile-fail/match-vec-unreachable.rs index b91cf8d8bf6e4..a94b070964638 100644 --- a/src/test/compile-fail/match-vec-unreachable.rs +++ b/src/test/compile-fail/match-vec-unreachable.rs @@ -18,9 +18,9 @@ fn main() { _ => () } - let x: Vec = vec!["foo".to_strbuf(), - "bar".to_strbuf(), - "baz".to_strbuf()]; + let x: Vec = vec!["foo".to_string(), + "bar".to_string(), + "baz".to_string()]; let x: &[String] = x.as_slice(); match x { [a, _, _, ..] => { println!("{}", a); } diff --git a/src/test/compile-fail/minus-string.rs b/src/test/compile-fail/minus-string.rs index eb46c13948ee1..1ba30c67a03cf 100644 --- a/src/test/compile-fail/minus-string.rs +++ b/src/test/compile-fail/minus-string.rs @@ -10,4 +10,4 @@ // error-pattern:cannot apply unary operator `-` to type `std::string::String` -fn main() { -"foo".to_strbuf(); } +fn main() { -"foo".to_string(); } diff --git a/src/test/compile-fail/moves-based-on-type-access-to-field.rs b/src/test/compile-fail/moves-based-on-type-access-to-field.rs index 6bee6528d7c28..fd44b693dde6a 100644 --- a/src/test/compile-fail/moves-based-on-type-access-to-field.rs +++ b/src/test/compile-fail/moves-based-on-type-access-to-field.rs @@ -16,13 +16,13 @@ fn consume(_s: String) {} fn touch(_a: &A) {} fn f10() { - let x = Foo { f: "hi".to_strbuf(), y: 3 }; + let x = Foo { f: "hi".to_string(), y: 3 }; consume(x.f); touch(&x.y); //~ ERROR use of partially moved value: `x` } fn f20() { - let x = vec!("hi".to_strbuf()); + let x = vec!("hi".to_string()); consume(x.move_iter().next().unwrap()); touch(x.get(0)); //~ ERROR use of moved value: `x` } diff --git a/src/test/compile-fail/moves-based-on-type-exprs.rs b/src/test/compile-fail/moves-based-on-type-exprs.rs index ce7d51f610b78..82aa5c36c8e43 100644 --- a/src/test/compile-fail/moves-based-on-type-exprs.rs +++ b/src/test/compile-fail/moves-based-on-type-exprs.rs @@ -18,13 +18,13 @@ fn guard(_s: String) -> bool {fail!()} fn touch(_a: &A) {} fn f10() { - let x = "hi".to_strbuf(); + let x = "hi".to_string(); let _y = Foo { f:x }; touch(&x); //~ ERROR use of moved value: `x` } fn f20() { - let x = "hi".to_strbuf(); + let x = "hi".to_string(); let _y = (x, 3); touch(&x); //~ ERROR use of moved value: `x` } @@ -36,8 +36,8 @@ fn f21() { } fn f30(cond: bool) { - let x = "hi".to_strbuf(); - let y = "ho".to_strbuf(); + let x = "hi".to_string(); + let y = "ho".to_string(); let _y = if cond { x } else { @@ -48,8 +48,8 @@ fn f30(cond: bool) { } fn f40(cond: bool) { - let x = "hi".to_strbuf(); - let y = "ho".to_strbuf(); + let x = "hi".to_string(); + let y = "ho".to_string(); let _y = match cond { true => x, false => y @@ -59,8 +59,8 @@ fn f40(cond: bool) { } fn f50(cond: bool) { - let x = "hi".to_strbuf(); - let y = "ho".to_strbuf(); + let x = "hi".to_string(); + let y = "ho".to_string(); let _y = match cond { _ if guard(x) => 10, true => 10, @@ -71,31 +71,31 @@ fn f50(cond: bool) { } fn f70() { - let x = "hi".to_strbuf(); + let x = "hi".to_string(); let _y = [x]; touch(&x); //~ ERROR use of moved value: `x` } fn f80() { - let x = "hi".to_strbuf(); + let x = "hi".to_string(); let _y = vec!(x); touch(&x); //~ ERROR use of moved value: `x` } fn f100() { - let x = vec!("hi".to_strbuf()); + let x = vec!("hi".to_string()); let _y = x.move_iter().next().unwrap(); touch(&x); //~ ERROR use of moved value: `x` } fn f110() { - let x = vec!("hi".to_strbuf()); + let x = vec!("hi".to_string()); let _y = [x.move_iter().next().unwrap(), ..1]; touch(&x); //~ ERROR use of moved value: `x` } fn f120() { - let mut x = vec!("hi".to_strbuf(), "ho".to_strbuf()); + let mut x = vec!("hi".to_string(), "ho".to_string()); x.as_mut_slice().swap(0, 1); touch(x.get(0)); touch(x.get(1)); diff --git a/src/test/compile-fail/unsendable-class.rs b/src/test/compile-fail/unsendable-class.rs index 0a6d210e114dc..7c9b2f34ae90f 100644 --- a/src/test/compile-fail/unsendable-class.rs +++ b/src/test/compile-fail/unsendable-class.rs @@ -26,7 +26,7 @@ fn foo(i:int, j: @String) -> foo { } fn main() { - let cat = "kitty".to_strbuf(); + let cat = "kitty".to_string(); let (tx, _) = channel(); //~ ERROR does not fulfill `Send` tx.send(foo(42, @(cat))); //~ ERROR does not fulfill `Send` } diff --git a/src/test/run-fail/assert-macro-owned.rs b/src/test/run-fail/assert-macro-owned.rs index bbbe29cc13411..a1a8eb6a092dc 100644 --- a/src/test/run-fail/assert-macro-owned.rs +++ b/src/test/run-fail/assert-macro-owned.rs @@ -11,5 +11,5 @@ // error-pattern:failed at 'test-assert-owned' fn main() { - assert!(false, "test-assert-owned".to_strbuf()); + assert!(false, "test-assert-owned".to_string()); } diff --git a/src/test/run-fail/binop-fail-2.rs b/src/test/run-fail/binop-fail-2.rs index 091461bd5a890..1ae520bbf1a74 100644 --- a/src/test/run-fail/binop-fail-2.rs +++ b/src/test/run-fail/binop-fail-2.rs @@ -10,4 +10,4 @@ // error-pattern:quux fn my_err(s: String) -> ! { println!("{}", s); fail!("quux"); } -fn main() { 3u == my_err("bye".to_strbuf()); } +fn main() { 3u == my_err("bye".to_string()); } diff --git a/src/test/run-fail/binop-fail.rs b/src/test/run-fail/binop-fail.rs index 091461bd5a890..1ae520bbf1a74 100644 --- a/src/test/run-fail/binop-fail.rs +++ b/src/test/run-fail/binop-fail.rs @@ -10,4 +10,4 @@ // error-pattern:quux fn my_err(s: String) -> ! { println!("{}", s); fail!("quux"); } -fn main() { 3u == my_err("bye".to_strbuf()); } +fn main() { 3u == my_err("bye".to_string()); } diff --git a/src/test/run-fail/fmt-fail.rs b/src/test/run-fail/fmt-fail.rs index b7ad9fe98272f..ae89f9518406a 100644 --- a/src/test/run-fail/fmt-fail.rs +++ b/src/test/run-fail/fmt-fail.rs @@ -11,6 +11,6 @@ // error-pattern:meh fn main() { - let str_var: String = "meh".to_strbuf(); + let str_var: String = "meh".to_string(); fail!("{}", str_var); } diff --git a/src/test/run-fail/if-cond-bot.rs b/src/test/run-fail/if-cond-bot.rs index fc5b8ad2b3b32..d80ae967f0e2c 100644 --- a/src/test/run-fail/if-cond-bot.rs +++ b/src/test/run-fail/if-cond-bot.rs @@ -10,4 +10,4 @@ // error-pattern:quux fn my_err(s: String) -> ! { println!("{}", s); fail!("quux"); } -fn main() { if my_err("bye".to_strbuf()) { } } +fn main() { if my_err("bye".to_string()) { } } diff --git a/src/test/run-fail/result-get-fail.rs b/src/test/run-fail/result-get-fail.rs index fa9a2bdd98bb8..549a101654ba2 100644 --- a/src/test/run-fail/result-get-fail.rs +++ b/src/test/run-fail/result-get-fail.rs @@ -13,5 +13,5 @@ use std::result; fn main() { - println!("{:?}", result::Err::("kitty".to_strbuf()).unwrap()); + println!("{:?}", result::Err::("kitty".to_string()).unwrap()); } diff --git a/src/test/run-fail/str-overrun.rs b/src/test/run-fail/str-overrun.rs index ee3f74ad2f4a1..26c5a6988cf13 100644 --- a/src/test/run-fail/str-overrun.rs +++ b/src/test/run-fail/str-overrun.rs @@ -11,7 +11,7 @@ // error-pattern:index out of bounds: the len is 5 but the index is 5 fn main() { - let s: String = "hello".to_strbuf(); + let s: String = "hello".to_string(); // Bounds-check failure. assert_eq!(s.as_slice()[5], 0x0 as u8); diff --git a/src/test/run-fail/unwind-lambda.rs b/src/test/run-fail/unwind-lambda.rs index 229280e0b4bfd..00183aa674fa4 100644 --- a/src/test/run-fail/unwind-lambda.rs +++ b/src/test/run-fail/unwind-lambda.rs @@ -13,8 +13,8 @@ // error-pattern:fail fn main() { - let cheese = "roquefort".to_strbuf(); - let carrots = @"crunchy".to_strbuf(); + let cheese = "roquefort".to_string(); + let carrots = @"crunchy".to_string(); let result: |@String, |String||: 'static = (|tasties, macerate| { macerate((*tasties).clone()); diff --git a/src/test/run-fail/unwind-misc-1.rs b/src/test/run-fail/unwind-misc-1.rs index f160b92552504..a02c04b3de87f 100644 --- a/src/test/run-fail/unwind-misc-1.rs +++ b/src/test/run-fail/unwind-misc-1.rs @@ -22,9 +22,9 @@ fn main() { let mut map = collections::HashMap::new(); let mut arr = Vec::new(); for _i in range(0u, 10u) { - arr.push(@"key stuff".to_strbuf()); + arr.push(@"key stuff".to_string()); map.insert(arr.clone(), - arr.clone().append([@"value stuff".to_strbuf()])); + arr.clone().append([@"value stuff".to_string()])); if arr.len() == 5 { fail!(); } diff --git a/src/test/run-pass/autobind.rs b/src/test/run-pass/autobind.rs index e365f6318c863..5d1a502490140 100644 --- a/src/test/run-pass/autobind.rs +++ b/src/test/run-pass/autobind.rs @@ -16,6 +16,6 @@ fn g(act: |Vec | -> int) -> int { return act(vec!(1, 2, 3)); } pub fn main() { assert_eq!(g(f), 1); let f1: |Vec| -> String = f; - assert_eq!(f1(vec!["x".to_strbuf(), "y".to_strbuf(), "z".to_strbuf()]), - "x".to_strbuf()); + assert_eq!(f1(vec!["x".to_string(), "y".to_string(), "z".to_string()]), + "x".to_string()); } diff --git a/src/test/run-pass/autoref-intermediate-types-issue-3585.rs b/src/test/run-pass/autoref-intermediate-types-issue-3585.rs index 5494212ffbd14..e10428e3c5dc2 100644 --- a/src/test/run-pass/autoref-intermediate-types-issue-3585.rs +++ b/src/test/run-pass/autoref-intermediate-types-issue-3585.rs @@ -28,5 +28,5 @@ impl Foo for uint { pub fn main() { let x = @3u; - assert_eq!(x.foo(), "@3".to_strbuf()); + assert_eq!(x.foo(), "@3".to_string()); } diff --git a/src/test/run-pass/backtrace.rs b/src/test/run-pass/backtrace.rs index a3881424bb15f..894c54218b451 100644 --- a/src/test/run-pass/backtrace.rs +++ b/src/test/run-pass/backtrace.rs @@ -36,14 +36,14 @@ fn double() { fn runtest(me: &str) { let mut env = os::env().move_iter() .map(|(ref k, ref v)| { - (k.to_strbuf(), v.to_strbuf()) + (k.to_string(), v.to_string()) }).collect::>(); match env.iter() .position(|&(ref s, _)| "RUST_BACKTRACE" == s.as_slice()) { Some(i) => { env.remove(i); } None => {} } - env.push(("RUST_BACKTRACE".to_strbuf(), "1".to_strbuf())); + env.push(("RUST_BACKTRACE".to_string(), "1".to_string())); // Make sure that the stack trace is printed let mut p = Command::new(me).arg("fail").env(env.as_slice()).spawn().unwrap(); diff --git a/src/test/run-pass/block-explicit-types.rs b/src/test/run-pass/block-explicit-types.rs index bd74a0bd8080c..63051d71271dd 100644 --- a/src/test/run-pass/block-explicit-types.rs +++ b/src/test/run-pass/block-explicit-types.rs @@ -10,5 +10,5 @@ pub fn main() { fn as_buf(s: String, f: |String| -> T) -> T { f(s) } - as_buf("foo".to_strbuf(), |foo: String| -> () println!("{}", foo) ); + as_buf("foo".to_string(), |foo: String| -> () println!("{}", foo) ); } diff --git a/src/test/run-pass/borrowed-ptr-pattern-2.rs b/src/test/run-pass/borrowed-ptr-pattern-2.rs index 9d23068b9ade3..75b54b1af86bd 100644 --- a/src/test/run-pass/borrowed-ptr-pattern-2.rs +++ b/src/test/run-pass/borrowed-ptr-pattern-2.rs @@ -16,6 +16,6 @@ fn foo(s: &String) -> bool { } pub fn main() { - assert!(foo(&"kitty".to_strbuf())); - assert!(!foo(&"gata".to_strbuf())); + assert!(foo(&"kitty".to_string())); + assert!(!foo(&"gata".to_string())); } diff --git a/src/test/run-pass/bug-7183-generics.rs b/src/test/run-pass/bug-7183-generics.rs index 4cbb52a0b3d44..7ed5f5aef9fb7 100644 --- a/src/test/run-pass/bug-7183-generics.rs +++ b/src/test/run-pass/bug-7183-generics.rs @@ -34,11 +34,11 @@ impl Speak for Option { pub fn main() { - assert_eq!(3.hi(), "hello: 3".to_strbuf()); + assert_eq!(3.hi(), "hello: 3".to_string()); assert_eq!(Some(Some(3)).hi(), - "something!something!hello: 3".to_strbuf()); - assert_eq!(None::.hi(), "hello - none".to_strbuf()); + "something!something!hello: 3".to_string()); + assert_eq!(None::.hi(), "hello - none".to_string()); - assert_eq!(Some(None::).hi(), "something!hello - none".to_strbuf()); - assert_eq!(Some(3).hi(), "something!hello: 3".to_strbuf()); + assert_eq!(Some(None::).hi(), "something!hello - none".to_string()); + assert_eq!(Some(3).hi(), "something!hello: 3".to_string()); } diff --git a/src/test/run-pass/c-stack-returning-int64.rs b/src/test/run-pass/c-stack-returning-int64.rs index 59b60d43fb1e9..540a00d3a3122 100644 --- a/src/test/run-pass/c-stack-returning-int64.rs +++ b/src/test/run-pass/c-stack-returning-int64.rs @@ -30,7 +30,7 @@ fn atoll(s: String) -> i64 { } pub fn main() { - assert_eq!(atol("1024".to_strbuf()) * 10, atol("10240".to_strbuf())); - assert!((atoll("11111111111111111".to_strbuf()) * 10) == - atoll("111111111111111110".to_strbuf())); + assert_eq!(atol("1024".to_string()) * 10, atol("10240".to_string())); + assert!((atoll("11111111111111111".to_string()) * 10) == + atoll("111111111111111110".to_string())); } diff --git a/src/test/run-pass/child-outlives-parent.rs b/src/test/run-pass/child-outlives-parent.rs index 4e521a112971f..82855729fa882 100644 --- a/src/test/run-pass/child-outlives-parent.rs +++ b/src/test/run-pass/child-outlives-parent.rs @@ -15,5 +15,5 @@ use std::task; fn child2(_s: String) { } pub fn main() { - let _x = task::spawn(proc() child2("hi".to_strbuf())); + let _x = task::spawn(proc() child2("hi".to_string())); } diff --git a/src/test/run-pass/class-attributes-1.rs b/src/test/run-pass/class-attributes-1.rs index e1b4b26ef07a9..28081e5292aaa 100644 --- a/src/test/run-pass/class-attributes-1.rs +++ b/src/test/run-pass/class-attributes-1.rs @@ -24,4 +24,4 @@ impl Drop for cat { #[cat_maker] fn cat(name: String) -> cat { cat{name: name,} } -pub fn main() { let _kitty = cat("Spotty".to_strbuf()); } +pub fn main() { let _kitty = cat("Spotty".to_string()); } diff --git a/src/test/run-pass/class-attributes-2.rs b/src/test/run-pass/class-attributes-2.rs index 9aa16e6f9d99e..bd62f838444af 100644 --- a/src/test/run-pass/class-attributes-2.rs +++ b/src/test/run-pass/class-attributes-2.rs @@ -34,5 +34,5 @@ fn cat(name: String) -> cat { } pub fn main() { - let _kitty = cat("Spotty".to_strbuf()); + let _kitty = cat("Spotty".to_string()); } diff --git a/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs b/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs index d01dd8a1b90e4..f3d12d21684e4 100644 --- a/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs +++ b/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs @@ -17,10 +17,10 @@ use cci_class_cast::kitty::cat; fn print_out(thing: Box, expected: String) { let actual = thing.to_str(); println!("{}", actual); - assert_eq!(actual.to_strbuf(), expected); + assert_eq!(actual.to_string(), expected); } pub fn main() { - let nyan: Box = box cat(0u, 2, "nyan".to_strbuf()) as Box; - print_out(nyan, "nyan".to_strbuf()); + let nyan: Box = box cat(0u, 2, "nyan".to_string()) as Box; + print_out(nyan, "nyan".to_string()); } diff --git a/src/test/run-pass/class-cast-to-trait-multiple-types.rs b/src/test/run-pass/class-cast-to-trait-multiple-types.rs index 4bd93cb6ea4e4..982b8f1d900fd 100644 --- a/src/test/run-pass/class-cast-to-trait-multiple-types.rs +++ b/src/test/run-pass/class-cast-to-trait-multiple-types.rs @@ -93,7 +93,7 @@ fn annoy_neighbors(critter: &mut noisy) { } pub fn main() { - let mut nyan: cat = cat(0u, 2, "nyan".to_strbuf()); + let mut nyan: cat = cat(0u, 2, "nyan".to_string()); let mut whitefang: dog = dog(); annoy_neighbors(&mut nyan); annoy_neighbors(&mut whitefang); diff --git a/src/test/run-pass/class-cast-to-trait.rs b/src/test/run-pass/class-cast-to-trait.rs index 6f943151a9380..2525066ed6bdf 100644 --- a/src/test/run-pass/class-cast-to-trait.rs +++ b/src/test/run-pass/class-cast-to-trait.rs @@ -60,7 +60,7 @@ fn cat(in_x : uint, in_y : int, in_name: String) -> cat { pub fn main() { - let mut nyan = cat(0u, 2, "nyan".to_strbuf()); + let mut nyan = cat(0u, 2, "nyan".to_string()); let mut nyan: &mut noisy = &mut nyan; nyan.speak(); } diff --git a/src/test/run-pass/class-exports.rs b/src/test/run-pass/class-exports.rs index 7e3871b59e16a..80f8ed936370b 100644 --- a/src/test/run-pass/class-exports.rs +++ b/src/test/run-pass/class-exports.rs @@ -33,6 +33,6 @@ mod kitty { } pub fn main() { - assert_eq!(cat("Spreckles".to_strbuf()).get_name(), - "Spreckles".to_strbuf()); + assert_eq!(cat("Spreckles".to_string()).get_name(), + "Spreckles".to_string()); } diff --git a/src/test/run-pass/class-impl-very-parameterized-trait.rs b/src/test/run-pass/class-impl-very-parameterized-trait.rs index 0f6dec62e1be7..285566570b185 100644 --- a/src/test/run-pass/class-impl-very-parameterized-trait.rs +++ b/src/test/run-pass/class-impl-very-parameterized-trait.rs @@ -114,9 +114,9 @@ impl cat { } pub fn main() { - let mut nyan: cat = cat::new(0, 2, "nyan".to_strbuf()); + let mut nyan: cat = cat::new(0, 2, "nyan".to_string()); for _ in range(1u, 5) { nyan.speak(); } - assert!(*nyan.find(&1).unwrap() == "nyan".to_strbuf()); + assert!(*nyan.find(&1).unwrap() == "nyan".to_string()); assert_eq!(nyan.find(&10), None); let mut spotty: cat = cat::new(2, 57, tuxedo); for _ in range(0u, 6) { spotty.speak(); } diff --git a/src/test/run-pass/class-implement-trait-cross-crate.rs b/src/test/run-pass/class-implement-trait-cross-crate.rs index e386f72a4e2b0..8c36174d5f1ca 100644 --- a/src/test/run-pass/class-implement-trait-cross-crate.rs +++ b/src/test/run-pass/class-implement-trait-cross-crate.rs @@ -57,7 +57,7 @@ fn cat(in_x : uint, in_y : int, in_name: String) -> cat { pub fn main() { - let mut nyan = cat(0u, 2, "nyan".to_strbuf()); + let mut nyan = cat(0u, 2, "nyan".to_string()); nyan.eat(); assert!((!nyan.eat())); for _ in range(1u, 10u) { nyan.speak(); }; diff --git a/src/test/run-pass/class-implement-traits.rs b/src/test/run-pass/class-implement-traits.rs index 6db7b85534ecb..034ce8626d087 100644 --- a/src/test/run-pass/class-implement-traits.rs +++ b/src/test/run-pass/class-implement-traits.rs @@ -62,7 +62,7 @@ fn make_speak(mut c: C) { } pub fn main() { - let mut nyan = cat(0u, 2, "nyan".to_strbuf()); + let mut nyan = cat(0u, 2, "nyan".to_string()); nyan.eat(); assert!((!nyan.eat())); for _ in range(1u, 10u) { diff --git a/src/test/run-pass/class-separate-impl.rs b/src/test/run-pass/class-separate-impl.rs index 9bb23f55e5a94..3d486144c3eed 100644 --- a/src/test/run-pass/class-separate-impl.rs +++ b/src/test/run-pass/class-separate-impl.rs @@ -60,10 +60,10 @@ impl fmt::Show for cat { fn print_out(thing: Box, expected: String) { let actual = thing.to_str(); println!("{}", actual); - assert_eq!(actual.to_strbuf(), expected); + assert_eq!(actual.to_string(), expected); } pub fn main() { - let nyan: Box = box cat(0u, 2, "nyan".to_strbuf()) as Box; - print_out(nyan, "nyan".to_strbuf()); + let nyan: Box = box cat(0u, 2, "nyan".to_string()) as Box; + print_out(nyan, "nyan".to_string()); } diff --git a/src/test/run-pass/class-str-field.rs b/src/test/run-pass/class-str-field.rs index 540d18d4d27fe..2fb8610092bf9 100644 --- a/src/test/run-pass/class-str-field.rs +++ b/src/test/run-pass/class-str-field.rs @@ -21,5 +21,5 @@ fn cat(in_name: String) -> cat { } pub fn main() { - let _nyan = cat("nyan".to_strbuf()); + let _nyan = cat("nyan".to_string()); } diff --git a/src/test/run-pass/classes-cross-crate.rs b/src/test/run-pass/classes-cross-crate.rs index 554fb607b15f3..61ed0016d09a1 100644 --- a/src/test/run-pass/classes-cross-crate.rs +++ b/src/test/run-pass/classes-cross-crate.rs @@ -13,7 +13,7 @@ extern crate cci_class_4; use cci_class_4::kitties::cat; pub fn main() { - let mut nyan = cat(0u, 2, "nyan".to_strbuf()); + let mut nyan = cat(0u, 2, "nyan".to_string()); nyan.eat(); assert!((!nyan.eat())); for _ in range(1u, 10u) { nyan.speak(); }; diff --git a/src/test/run-pass/classes.rs b/src/test/run-pass/classes.rs index 8c099fd2e83b4..5d1296cf46e3f 100644 --- a/src/test/run-pass/classes.rs +++ b/src/test/run-pass/classes.rs @@ -49,7 +49,7 @@ fn cat(in_x : uint, in_y : int, in_name: String) -> cat { } pub fn main() { - let mut nyan = cat(0u, 2, "nyan".to_strbuf()); + let mut nyan = cat(0u, 2, "nyan".to_string()); nyan.eat(); assert!((!nyan.eat())); for _ in range(1u, 10u) { nyan.speak(); }; diff --git a/src/test/run-pass/closure-reform.rs b/src/test/run-pass/closure-reform.rs index 94d31b3a2c098..5de7aee4aa486 100644 --- a/src/test/run-pass/closure-reform.rs +++ b/src/test/run-pass/closure-reform.rs @@ -15,7 +15,7 @@ use std::mem; use std::io::stdio::println; fn call_it(f: proc(String) -> String) { - println!("{}", f("Fred".to_strbuf())) + println!("{}", f("Fred".to_string())) } fn call_a_thunk(f: ||) { @@ -48,15 +48,15 @@ fn call_bare_again(f: extern "Rust" fn(&str)) { pub fn main() { // Procs - let greeting = "Hello ".to_strbuf(); + let greeting = "Hello ".to_string(); call_it(proc(s) { format_strbuf!("{}{}", greeting, s) }); - let greeting = "Goodbye ".to_strbuf(); + let greeting = "Goodbye ".to_string(); call_it(proc(s) format_strbuf!("{}{}", greeting, s)); - let greeting = "How's life, ".to_strbuf(); + let greeting = "How's life, ".to_string(); call_it(proc(s: String) -> String { format_strbuf!("{}{}", greeting, s) }); diff --git a/src/test/run-pass/complex.rs b/src/test/run-pass/complex.rs index 5b6b5603c32b7..f8c8ac20d72af 100644 --- a/src/test/run-pass/complex.rs +++ b/src/test/run-pass/complex.rs @@ -19,14 +19,14 @@ fn putstr(_s: String) { } fn putint(_i: int) { let mut i: int = 33; - while i < 36 { putstr("hi".to_strbuf()); i = i + 1; } + while i < 36 { putstr("hi".to_string()); i = i + 1; } } fn zerg(i: int) -> int { return i; } fn foo(x: int) -> int { let mut y: t = x + 2; - putstr("hello".to_strbuf()); + putstr("hello".to_string()); while y < 10 { putint(y); if y * 3 == 4 { y = y + 2; nothing(); } } let mut z: t; z = 0x55; diff --git a/src/test/run-pass/concat.rs b/src/test/run-pass/concat.rs index c94887f16a981..64209f2446099 100644 --- a/src/test/run-pass/concat.rs +++ b/src/test/run-pass/concat.rs @@ -9,8 +9,8 @@ // except according to those terms. pub fn main() { - assert_eq!(format!(concat!("foo", "bar", "{}"), "baz"), "foobarbaz".to_strbuf()); - assert_eq!(format!(concat!()), "".to_strbuf()); + assert_eq!(format!(concat!("foo", "bar", "{}"), "baz"), "foobarbaz".to_string()); + assert_eq!(format!(concat!()), "".to_string()); assert_eq!( concat!(1, 2i, 3u, 4f32, 4.0, 'a', true, ()), diff --git a/src/test/run-pass/crate-method-reexport-grrrrrrr.rs b/src/test/run-pass/crate-method-reexport-grrrrrrr.rs index 56f6871ed54c3..456f7ec3e99f3 100644 --- a/src/test/run-pass/crate-method-reexport-grrrrrrr.rs +++ b/src/test/run-pass/crate-method-reexport-grrrrrrr.rs @@ -24,5 +24,5 @@ pub fn main() { let x = @(); x.cx(); let y = (); - y.add("hi".to_strbuf()); + y.add("hi".to_string()); } diff --git a/src/test/run-pass/deriving-hash.rs b/src/test/run-pass/deriving-hash.rs index a05637a024331..a7211e77cd05d 100644 --- a/src/test/run-pass/deriving-hash.rs +++ b/src/test/run-pass/deriving-hash.rs @@ -22,12 +22,12 @@ struct Person { fn main() { let person1 = Person { id: 5, - name: "Janet".to_strbuf(), + name: "Janet".to_string(), phone: 555_666_7777 }; let person2 = Person { id: 5, - name: "Bob".to_strbuf(), + name: "Bob".to_string(), phone: 555_666_7777 }; assert!(hash::hash(&person1) == hash::hash(&person1)); diff --git a/src/test/run-pass/deriving-show-2.rs b/src/test/run-pass/deriving-show-2.rs index 0e70fabbed39b..a5e86dee18e8c 100644 --- a/src/test/run-pass/deriving-show-2.rs +++ b/src/test/run-pass/deriving-show-2.rs @@ -41,15 +41,15 @@ impl fmt::Show for Custom { } pub fn main() { - assert_eq!(B1.to_str(), "B1".to_strbuf()); - assert_eq!(B2.to_str(), "B2".to_strbuf()); - assert_eq!(C1(3).to_str(), "C1(3)".to_strbuf()); - assert_eq!(C2(B2).to_str(), "C2(B2)".to_strbuf()); - assert_eq!(D1{ a: 2 }.to_str(), "D1 { a: 2 }".to_strbuf()); - assert_eq!(E.to_str(), "E".to_strbuf()); - assert_eq!(F(3).to_str(), "F(3)".to_strbuf()); - assert_eq!(G(3, 4).to_str(), "G(3, 4)".to_strbuf()); - assert_eq!(G(3, 4).to_str(), "G(3, 4)".to_strbuf()); - assert_eq!(I{ a: 2, b: 4 }.to_str(), "I { a: 2, b: 4 }".to_strbuf()); - assert_eq!(J(Custom).to_str(), "J(yay)".to_strbuf()); + assert_eq!(B1.to_str(), "B1".to_string()); + assert_eq!(B2.to_str(), "B2".to_string()); + assert_eq!(C1(3).to_str(), "C1(3)".to_string()); + assert_eq!(C2(B2).to_str(), "C2(B2)".to_string()); + assert_eq!(D1{ a: 2 }.to_str(), "D1 { a: 2 }".to_string()); + assert_eq!(E.to_str(), "E".to_string()); + assert_eq!(F(3).to_str(), "F(3)".to_string()); + assert_eq!(G(3, 4).to_str(), "G(3, 4)".to_string()); + assert_eq!(G(3, 4).to_str(), "G(3, 4)".to_string()); + assert_eq!(I{ a: 2, b: 4 }.to_str(), "I { a: 2, b: 4 }".to_string()); + assert_eq!(J(Custom).to_str(), "J(yay)".to_string()); } diff --git a/src/test/run-pass/deriving-show.rs b/src/test/run-pass/deriving-show.rs index 7254ed7d5301a..a44bb61a1ccd8 100644 --- a/src/test/run-pass/deriving-show.rs +++ b/src/test/run-pass/deriving-show.rs @@ -28,7 +28,7 @@ enum Enum { macro_rules! t { ($x:expr, $expected:expr) => { - assert_eq!(format!("{}", $x), $expected.to_strbuf()) + assert_eq!(format!("{}", $x), $expected.to_string()) } } diff --git a/src/test/run-pass/deriving-via-extension-struct-tuple.rs b/src/test/run-pass/deriving-via-extension-struct-tuple.rs index aec707b0946d2..edb0272dfeeb2 100644 --- a/src/test/run-pass/deriving-via-extension-struct-tuple.rs +++ b/src/test/run-pass/deriving-via-extension-struct-tuple.rs @@ -12,9 +12,9 @@ struct Foo(int, int, String); pub fn main() { - let a1 = Foo(5, 6, "abc".to_strbuf()); - let a2 = Foo(5, 6, "abc".to_strbuf()); - let b = Foo(5, 7, "def".to_strbuf()); + let a1 = Foo(5, 6, "abc".to_string()); + let a2 = Foo(5, 6, "abc".to_string()); + let b = Foo(5, 7, "def".to_string()); assert!(a1 == a1); assert!(a2 == a1); diff --git a/src/test/run-pass/drop-on-ret.rs b/src/test/run-pass/drop-on-ret.rs index 7a372315b6c0c..0786974e11207 100644 --- a/src/test/run-pass/drop-on-ret.rs +++ b/src/test/run-pass/drop-on-ret.rs @@ -13,7 +13,7 @@ fn f() -> int { if true { - let _s: String = "should not leak".to_strbuf(); + let _s: String = "should not leak".to_string(); return 1; } return 0; diff --git a/src/test/run-pass/enum-discrim-width-stuff.rs b/src/test/run-pass/enum-discrim-width-stuff.rs index f028d871c20de..85da586a72c01 100644 --- a/src/test/run-pass/enum-discrim-width-stuff.rs +++ b/src/test/run-pass/enum-discrim-width-stuff.rs @@ -23,8 +23,8 @@ macro_rules! check { assert_eq!(size_of::(), size_of::<$t>()); assert_eq!(V as $t, $v); assert_eq!(C as $t, $v); - assert_eq!(format!("{:?}", V), "V".to_strbuf()); - assert_eq!(format!("{:?}", C), "V".to_strbuf()); + assert_eq!(format!("{:?}", V), "V".to_string()); + assert_eq!(format!("{:?}", C), "V".to_string()); } } $m::check(); diff --git a/src/test/run-pass/enum-disr-val-pretty.rs b/src/test/run-pass/enum-disr-val-pretty.rs index 70e51148bf3ea..66b11aefd324b 100644 --- a/src/test/run-pass/enum-disr-val-pretty.rs +++ b/src/test/run-pass/enum-disr-val-pretty.rs @@ -13,10 +13,10 @@ enum color { red = 1, green, blue, imaginary = -1, } pub fn main() { - test_color(red, 1, "red".to_strbuf()); - test_color(green, 2, "green".to_strbuf()); - test_color(blue, 3, "blue".to_strbuf()); - test_color(imaginary, -1, "imaginary".to_strbuf()); + test_color(red, 1, "red".to_string()); + test_color(green, 2, "green".to_string()); + test_color(blue, 3, "blue".to_string()); + test_color(imaginary, -1, "imaginary".to_string()); } fn test_color(color: color, val: int, _name: String) { diff --git a/src/test/run-pass/enum-variants.rs b/src/test/run-pass/enum-variants.rs index 076a389b6e974..4e283b5480849 100644 --- a/src/test/run-pass/enum-variants.rs +++ b/src/test/run-pass/enum-variants.rs @@ -18,8 +18,8 @@ enum Animal { } pub fn main() { - let mut a: Animal = Dog("Cocoa".to_strbuf(), 37.2); - a = Cat{ name: "Spotty".to_strbuf(), weight: 2.7 }; + let mut a: Animal = Dog("Cocoa".to_string(), 37.2); + a = Cat{ name: "Spotty".to_string(), weight: 2.7 }; // permuting the fields should work too - let _c = Cat { weight: 3.1, name: "Spreckles".to_strbuf() }; + let _c = Cat { weight: 3.1, name: "Spreckles".to_string() }; } diff --git a/src/test/run-pass/estr-uniq.rs b/src/test/run-pass/estr-uniq.rs index 82bdb7ef88ee0..1652016b51b06 100644 --- a/src/test/run-pass/estr-uniq.rs +++ b/src/test/run-pass/estr-uniq.rs @@ -11,9 +11,9 @@ #![allow(dead_assignment)] pub fn main() { - let x : String = "hello".to_strbuf(); - let _y : String = "there".to_strbuf(); - let mut z = "thing".to_strbuf(); + let x : String = "hello".to_string(); + let _y : String = "there".to_string(); + let mut z = "thing".to_string(); z = x; assert_eq!(z.as_slice()[0], ('h' as u8)); assert_eq!(z.as_slice()[4], ('o' as u8)); diff --git a/src/test/run-pass/exec-env.rs b/src/test/run-pass/exec-env.rs index b4bd4a8201ed5..8775cb6da2ed2 100644 --- a/src/test/run-pass/exec-env.rs +++ b/src/test/run-pass/exec-env.rs @@ -13,5 +13,5 @@ use std::os; pub fn main() { - assert_eq!(os::getenv("TEST_EXEC_ENV"), Some("22".to_strbuf())); + assert_eq!(os::getenv("TEST_EXEC_ENV"), Some("22".to_string())); } diff --git a/src/test/run-pass/explicit_self_xcrate_exe.rs b/src/test/run-pass/explicit_self_xcrate_exe.rs index 4e6b038f8ed4a..ee74fc0b0a326 100644 --- a/src/test/run-pass/explicit_self_xcrate_exe.rs +++ b/src/test/run-pass/explicit_self_xcrate_exe.rs @@ -14,6 +14,6 @@ extern crate explicit_self_xcrate; use explicit_self_xcrate::{Foo, Bar}; pub fn main() { - let x = Bar { x: "hello".to_strbuf() }; + let x = Bar { x: "hello".to_string() }; x.f(); } diff --git a/src/test/run-pass/exponential-notation.rs b/src/test/run-pass/exponential-notation.rs index efe0e0de40ebc..7d79815f7780d 100644 --- a/src/test/run-pass/exponential-notation.rs +++ b/src/test/run-pass/exponential-notation.rs @@ -13,7 +13,7 @@ use s = std::num::strconv; use to_str = std::num::strconv::float_to_str_common; -macro_rules! t(($a:expr, $b:expr) => { { let (r, _) = $a; assert_eq!(r, $b.to_strbuf()) } }) +macro_rules! t(($a:expr, $b:expr) => { { let (r, _) = $a; assert_eq!(r, $b.to_string()) } }) pub fn main() { // Basic usage diff --git a/src/test/run-pass/fixed_length_vec_glue.rs b/src/test/run-pass/fixed_length_vec_glue.rs index 9c9f0e82d14ac..a40ab713c2d6c 100644 --- a/src/test/run-pass/fixed_length_vec_glue.rs +++ b/src/test/run-pass/fixed_length_vec_glue.rs @@ -17,5 +17,5 @@ pub fn main() { let arr = [1,2,3]; let struc = Struc {a: 13u8, b: arr, c: 42}; let s = repr::repr_to_str(&struc); - assert_eq!(s, "Struc{a: 13u8, b: [1, 2, 3], c: 42}".to_strbuf()); + assert_eq!(s, "Struc{a: 13u8, b: [1, 2, 3], c: 42}".to_string()); } diff --git a/src/test/run-pass/foreign-fn-linkname.rs b/src/test/run-pass/foreign-fn-linkname.rs index d8f8fdc9cf071..890f5158a65ff 100644 --- a/src/test/run-pass/foreign-fn-linkname.rs +++ b/src/test/run-pass/foreign-fn-linkname.rs @@ -32,6 +32,6 @@ fn strlen(str: String) -> uint { } pub fn main() { - let len = strlen("Rust".to_strbuf()); + let len = strlen("Rust".to_string()); assert_eq!(len, 4u); } diff --git a/src/test/run-pass/format-ref-cell.rs b/src/test/run-pass/format-ref-cell.rs index a033fc01df389..520735c05c33b 100644 --- a/src/test/run-pass/format-ref-cell.rs +++ b/src/test/run-pass/format-ref-cell.rs @@ -14,5 +14,5 @@ pub fn main() { let name = RefCell::new("rust"); let what = RefCell::new("rocks"); let msg = format!("{name:?} {:?}", &*what.borrow(), name=&*name.borrow()); - assert_eq!(msg, "&\"rust\" &\"rocks\"".to_strbuf()); + assert_eq!(msg, "&\"rust\" &\"rocks\"".to_string()); } diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs index 7ea66c552785a..d7eb2de36b034 100644 --- a/src/test/run-pass/hashmap-memory.rs +++ b/src/test/run-pass/hashmap-memory.rs @@ -21,7 +21,7 @@ extern crate collections; */ pub fn map(filename: String, emit: map_reduce::putter) { - emit(filename, "1".to_strbuf()); + emit(filename, "1".to_string()); } mod map_reduce { @@ -86,7 +86,7 @@ mod map_reduce { find_reducer(k, cc) => { let mut c; match reducers.find(&str::from_utf8( - k.as_slice()).unwrap().to_strbuf()) { + k.as_slice()).unwrap().to_string()) { Some(&_c) => { c = _c; } None => { c = 0; } } @@ -99,5 +99,5 @@ mod map_reduce { pub fn main() { map_reduce::map_reduce( - vec!("../src/test/run-pass/hashmap-memory.rs".to_strbuf())); + vec!("../src/test/run-pass/hashmap-memory.rs".to_string())); } diff --git a/src/test/run-pass/html-literals.rs b/src/test/run-pass/html-literals.rs index 0c6af1a0abfbc..c8163f08c6f89 100644 --- a/src/test/run-pass/html-literals.rs +++ b/src/test/run-pass/html-literals.rs @@ -41,7 +41,7 @@ macro_rules! parse_node ( ) => ( parse_node!( [$(: $tags ($(:$tag_nodes),*))*]; - [$(:$head_nodes,)* :tag(stringify!($head).to_strbuf(), + [$(:$head_nodes,)* :tag(stringify!($head).to_string(), vec!($($nodes),*))]; $($rest)* ) @@ -66,7 +66,7 @@ macro_rules! parse_node ( ) => ( parse_node!( [$(: $tags ($(:$tag_nodes),*))*]; - [$(:$nodes,)* :text(".".to_strbuf())]; + [$(:$nodes,)* :text(".".to_string())]; $($rest)* ) ); @@ -78,7 +78,7 @@ macro_rules! parse_node ( ) => ( parse_node!( [$(: $tags ($(:$tag_nodes),*))*]; - [$(:$nodes,)* :text(stringify!($word).to_strbuf())]; + [$(:$nodes,)* :text(stringify!($word).to_string())]; $($rest)* ) ); diff --git a/src/test/run-pass/ifmt.rs b/src/test/run-pass/ifmt.rs index 3b09cf0373eb1..6d875a7ff9b55 100644 --- a/src/test/run-pass/ifmt.rs +++ b/src/test/run-pass/ifmt.rs @@ -175,7 +175,7 @@ fn test_write() { writeln!(w, "{foo}", foo="bar"); } - let s = str::from_utf8(buf.unwrap().as_slice()).unwrap().to_owned(); + let s = str::from_utf8(buf.unwrap().as_slice()).unwrap().to_string(); t!(s, "34helloline\nbar\n"); } @@ -199,7 +199,7 @@ fn test_format_args() { format_args!(|args| { write!(w, "{}", args); }, "test"); format_args!(|args| { write!(w, "{}", args); }, "{test}", test=3); } - let s = str::from_utf8(buf.unwrap().as_slice()).unwrap().to_owned(); + let s = str::from_utf8(buf.unwrap().as_slice()).unwrap().to_string(); t!(s, "1test3"); let s = format_args!(fmt::format, "hello {}", "world"); @@ -222,5 +222,5 @@ fn test_order() { } assert_eq!(format!("{} {} {a} {b} {} {c}", foo(), foo(), foo(), a=foo(), b=foo(), c=foo()), - "1 2 4 5 3 6".to_strbuf()); + "1 2 4 5 3 6".to_string()); } diff --git a/src/test/run-pass/issue-13304.rs b/src/test/run-pass/issue-13304.rs index 17bc4e64eacb8..37df74031acf3 100644 --- a/src/test/run-pass/issue-13304.rs +++ b/src/test/run-pass/issue-13304.rs @@ -35,12 +35,12 @@ fn main() { rx.recv(); } } else { - parent("green".to_strbuf()); - parent("native".to_strbuf()); + parent("green".to_string()); + parent("native".to_string()); let (tx, rx) = channel(); native::task::spawn(proc() { - parent("green".to_strbuf()); - parent("native".to_strbuf()); + parent("green".to_string()); + parent("native".to_string()); tx.send(()); }); rx.recv(); diff --git a/src/test/run-pass/issue-1701.rs b/src/test/run-pass/issue-1701.rs index 44bebc57345ce..d1b2c8e28707e 100644 --- a/src/test/run-pass/issue-1701.rs +++ b/src/test/run-pass/issue-1701.rs @@ -16,16 +16,16 @@ enum animal { cat(pattern), dog(breed), rabbit(name, ear_kind), tiger } fn noise(a: animal) -> Option { match a { - cat(..) => { Some("meow".to_strbuf()) } - dog(..) => { Some("woof".to_strbuf()) } + cat(..) => { Some("meow".to_string()) } + dog(..) => { Some("woof".to_string()) } rabbit(..) => { None } - tiger(..) => { Some("roar".to_strbuf()) } + tiger(..) => { Some("roar".to_string()) } } } pub fn main() { - assert_eq!(noise(cat(tabby)), Some("meow".to_strbuf())); - assert_eq!(noise(dog(pug)), Some("woof".to_strbuf())); - assert_eq!(noise(rabbit("Hilbert".to_strbuf(), upright)), None); - assert_eq!(noise(tiger), Some("roar".to_strbuf())); + assert_eq!(noise(cat(tabby)), Some("meow".to_string())); + assert_eq!(noise(dog(pug)), Some("woof".to_string())); + assert_eq!(noise(rabbit("Hilbert".to_string(), upright)), None); + assert_eq!(noise(tiger), Some("roar".to_string())); } diff --git a/src/test/run-pass/issue-2631-b.rs b/src/test/run-pass/issue-2631-b.rs index 8216e34113594..6df8f1a17ad8a 100644 --- a/src/test/run-pass/issue-2631-b.rs +++ b/src/test/run-pass/issue-2631-b.rs @@ -20,8 +20,8 @@ use std::cell::RefCell; use collections::HashMap; pub fn main() { - let v = vec!(@"hi".to_strbuf()); + let v = vec!(@"hi".to_string()); let mut m: req::header_map = HashMap::new(); - m.insert("METHOD".to_strbuf(), @RefCell::new(v)); + m.insert("METHOD".to_string(), @RefCell::new(v)); request::(&m); } diff --git a/src/test/run-pass/issue-2804-2.rs b/src/test/run-pass/issue-2804-2.rs index 988e2651b0b9e..7ad8ff9bfaa0b 100644 --- a/src/test/run-pass/issue-2804-2.rs +++ b/src/test/run-pass/issue-2804-2.rs @@ -17,7 +17,7 @@ extern crate collections; use collections::HashMap; fn add_interfaces(managed_ip: String, device: HashMap) { - println!("{}, {:?}", managed_ip, device.get(&"interfaces".to_strbuf())); + println!("{}, {:?}", managed_ip, device.get(&"interfaces".to_string())); } pub fn main() {} diff --git a/src/test/run-pass/issue-2804.rs b/src/test/run-pass/issue-2804.rs index 46fa8d9ad4640..fd0cfb5425def 100644 --- a/src/test/run-pass/issue-2804.rs +++ b/src/test/run-pass/issue-2804.rs @@ -23,9 +23,9 @@ enum object { fn lookup(table: Box, key: String, default: String) -> String { - match table.find(&key.to_strbuf()) { + match table.find(&key.to_string()) { option::Some(&json::String(ref s)) => { - (*s).to_strbuf() + (*s).to_string() } option::Some(value) => { println!("{} was expected to be a string but is a {:?}", key, value); @@ -42,22 +42,22 @@ fn add_interface(_store: int, managed_ip: String, data: json::Json) -> (String, match &data { &json::Object(ref interface) => { let name = lookup((*interface).clone(), - "ifDescr".to_strbuf(), - "".to_strbuf()); + "ifDescr".to_string(), + "".to_string()); let label = format_strbuf!("{}-{}", managed_ip, name); (label, bool_value(false)) } _ => { println!("Expected dict for {} interfaces but found {:?}", managed_ip, data); - ("gnos:missing-interface".to_strbuf(), bool_value(true)) + ("gnos:missing-interface".to_string(), bool_value(true)) } } } fn add_interfaces(store: int, managed_ip: String, device: HashMap) -> Vec<(String, object)> { - match device.get(&"interfaces".to_strbuf()) + match device.get(&"interfaces".to_string()) { &json::List(ref interfaces) => { @@ -68,7 +68,7 @@ fn add_interfaces(store: int, managed_ip: String, device: HashMap { println!("Expected list for {} interfaces but found {:?}", managed_ip, - device.get(&"interfaces".to_strbuf())); + device.get(&"interfaces".to_string())); Vec::new() } } diff --git a/src/test/run-pass/issue-3389.rs b/src/test/run-pass/issue-3389.rs index bb20bb402f312..8f6b813719973 100644 --- a/src/test/run-pass/issue-3389.rs +++ b/src/test/run-pass/issue-3389.rs @@ -25,8 +25,8 @@ pub fn main() { content: Vec::new(), children: Vec::new() }; - let v = vec!("123".to_strbuf(), "abc".to_strbuf()); - node.content = vec!("123".to_strbuf(), "abc".to_strbuf()); + let v = vec!("123".to_string(), "abc".to_string()); + node.content = vec!("123".to_string(), "abc".to_string()); print_str_vector(v); print_str_vector(node.content.clone()); diff --git a/src/test/run-pass/issue-3424.rs b/src/test/run-pass/issue-3424.rs index eaa9124fc527d..b7818ea732ad4 100644 --- a/src/test/run-pass/issue-3424.rs +++ b/src/test/run-pass/issue-3424.rs @@ -20,7 +20,7 @@ type rsrc_loader = proc(path: &Path) -> result::Result; fn tester() { let loader: rsrc_loader = proc(_path) { - result::Ok("more blah".to_strbuf()) + result::Ok("more blah".to_string()) }; let path = path::Path::new("blah"); diff --git a/src/test/run-pass/issue-3556.rs b/src/test/run-pass/issue-3556.rs index ac93742342377..b9b3301fc883d 100644 --- a/src/test/run-pass/issue-3556.rs +++ b/src/test/run-pass/issue-3556.rs @@ -35,13 +35,13 @@ pub fn main() // assert!(check_strs(fmt!("%?", ETag(@~["foo".to_string()], @"bar".to_string())), // "ETag(@~[ ~\"foo\" ], @~\"bar\")")); - let t = Text(@"foo".to_strbuf()); - let u = Section(@vec!("alpha".to_strbuf()), + let t = Text(@"foo".to_string()); + let u = Section(@vec!("alpha".to_string()), true, @vec!(t), - @"foo".to_strbuf(), - @"foo".to_strbuf(), @"foo".to_strbuf(), @"foo".to_strbuf(), - @"foo".to_strbuf()); + @"foo".to_string(), + @"foo".to_string(), @"foo".to_string(), @"foo".to_string(), + @"foo".to_string()); let v = format!("{:?}", u); // this is the line that causes the seg fault assert!(v.len() > 0); } diff --git a/src/test/run-pass/issue-3559.rs b/src/test/run-pass/issue-3559.rs index 044087ec0ca0e..01d4216107aa6 100644 --- a/src/test/run-pass/issue-3559.rs +++ b/src/test/run-pass/issue-3559.rs @@ -22,8 +22,8 @@ fn check_strs(actual: &str, expected: &str) -> bool { pub fn main() { let mut table = HashMap::new(); - table.insert("one".to_strbuf(), 1); - table.insert("two".to_strbuf(), 2); + table.insert("one".to_string(), 1); + table.insert("two".to_string(), 2); assert!(check_strs(table.to_str().as_slice(), "{one: 1, two: 2}") || check_strs(table.to_str().as_slice(), "{two: 2, one: 1}")); } diff --git a/src/test/run-pass/issue-3563-3.rs b/src/test/run-pass/issue-3563-3.rs index 0489d06cb8737..ac022d5c21238 100644 --- a/src/test/run-pass/issue-3563-3.rs +++ b/src/test/run-pass/issue-3563-3.rs @@ -101,7 +101,7 @@ impl fmt::Show for AsciiArt { // Convert each line into a string. let lines = self.lines.iter() .map(|line| { - str::from_chars(line.as_slice()).to_strbuf() + str::from_chars(line.as_slice()).to_string() }) .collect::>(); diff --git a/src/test/run-pass/issue-3935.rs b/src/test/run-pass/issue-3935.rs index a2da6aeeff34e..0237a56fd17e1 100644 --- a/src/test/run-pass/issue-3935.rs +++ b/src/test/run-pass/issue-3935.rs @@ -14,8 +14,8 @@ struct Bike { } pub fn main() { - let town_bike = Bike { name: "schwinn".to_strbuf() }; - let my_bike = Bike { name: "surly".to_strbuf() }; + let town_bike = Bike { name: "schwinn".to_string() }; + let my_bike = Bike { name: "surly".to_string() }; assert!(town_bike != my_bike); } diff --git a/src/test/run-pass/issue-4541.rs b/src/test/run-pass/issue-4541.rs index 6049c9807f5cd..c9baab3cfa49e 100644 --- a/src/test/run-pass/issue-4541.rs +++ b/src/test/run-pass/issue-4541.rs @@ -17,13 +17,13 @@ fn parse_args() -> String { match args[n].as_slice() { "-v" => (), s => { - return s.to_strbuf(); + return s.to_string(); } } n += 1; } - return "".to_strbuf() + return "".to_string() } pub fn main() { diff --git a/src/test/run-pass/issue-5008-borrowed-traitobject-method-call.rs b/src/test/run-pass/issue-5008-borrowed-traitobject-method-call.rs index ba822eabf0b56..5e7e7503f640a 100644 --- a/src/test/run-pass/issue-5008-borrowed-traitobject-method-call.rs +++ b/src/test/run-pass/issue-5008-borrowed-traitobject-method-call.rs @@ -25,7 +25,7 @@ struct Thing { } impl Thing { - fn new() -> Thing { Thing { name: "dummy".to_strbuf() } } + fn new() -> Thing { Thing { name: "dummy".to_string() } } } impl Debuggable for Thing { diff --git a/src/test/run-pass/issue-5353.rs b/src/test/run-pass/issue-5353.rs index 77c3772870362..2d729f8ced8d8 100644 --- a/src/test/run-pass/issue-5353.rs +++ b/src/test/run-pass/issue-5353.rs @@ -15,9 +15,9 @@ fn gl_err_str(err: u32) -> String { match err { - INVALID_ENUM => { "Invalid enum".to_strbuf() }, - INVALID_VALUE => { "Invalid value".to_strbuf() }, - _ => { "Unknown error".to_strbuf() } + INVALID_ENUM => { "Invalid enum".to_string() }, + INVALID_VALUE => { "Invalid value".to_string() }, + _ => { "Unknown error".to_string() } } } diff --git a/src/test/run-pass/issue-5550.rs b/src/test/run-pass/issue-5550.rs index 883e275e9b778..56404bfe38870 100644 --- a/src/test/run-pass/issue-5550.rs +++ b/src/test/run-pass/issue-5550.rs @@ -11,7 +11,7 @@ #![allow(dead_assignment)] pub fn main() { - let s: String = "foobar".to_strbuf(); + let s: String = "foobar".to_string(); let mut t: &str = s.as_slice(); t = t.slice(0, 3); // for master: str::view(t, 0, 3) maybe } diff --git a/src/test/run-pass/issue-5666.rs b/src/test/run-pass/issue-5666.rs index db15d3d665af2..3e6ef1d2163e7 100644 --- a/src/test/run-pass/issue-5666.rs +++ b/src/test/run-pass/issue-5666.rs @@ -19,14 +19,14 @@ trait Barks { impl Barks for Dog { fn bark(&self) -> String { - return format!("woof! (I'm {})", self.name).to_strbuf(); + return format!("woof! (I'm {})", self.name).to_string(); } } pub fn main() { - let snoopy = box Dog{name: "snoopy".to_strbuf()}; - let bubbles = box Dog{name: "bubbles".to_strbuf()}; + let snoopy = box Dog{name: "snoopy".to_string()}; + let bubbles = box Dog{name: "bubbles".to_string()}; let barker = [snoopy as Box, bubbles as Box]; for pup in barker.iter() { diff --git a/src/test/run-pass/issue-8898.rs b/src/test/run-pass/issue-8898.rs index cee37aebb4df5..595ddffd39cff 100644 --- a/src/test/run-pass/issue-8898.rs +++ b/src/test/run-pass/issue-8898.rs @@ -21,10 +21,10 @@ pub fn main() { let slice = x.slice(0,1); let z = @x; - assert_repr_eq(abc, "[1, 2, 3]".to_strbuf()); - assert_repr_eq(tf, "[true, false]".to_strbuf()); - assert_repr_eq(x, "[(), ()]".to_strbuf()); - assert_repr_eq(slice, "&[()]".to_strbuf()); - assert_repr_eq(&x, "&[(), ()]".to_strbuf()); - assert_repr_eq(z, "@[(), ()]".to_strbuf()); + assert_repr_eq(abc, "[1, 2, 3]".to_string()); + assert_repr_eq(tf, "[true, false]".to_string()); + assert_repr_eq(x, "[(), ()]".to_string()); + assert_repr_eq(slice, "&[()]".to_string()); + assert_repr_eq(&x, "&[(), ()]".to_string()); + assert_repr_eq(z, "@[(), ()]".to_string()); } diff --git a/src/test/run-pass/issue-9047.rs b/src/test/run-pass/issue-9047.rs index e509d076cdbbc..9941381985218 100644 --- a/src/test/run-pass/issue-9047.rs +++ b/src/test/run-pass/issue-9047.rs @@ -13,7 +13,7 @@ fn decode() -> String { let mut ch_start: uint; break 'outer; } - "".to_strbuf() + "".to_string() } pub fn main() { diff --git a/src/test/run-pass/issue-9259.rs b/src/test/run-pass/issue-9259.rs index 9943780eb2028..35f51efe135ca 100644 --- a/src/test/run-pass/issue-9259.rs +++ b/src/test/run-pass/issue-9259.rs @@ -14,9 +14,9 @@ struct A<'a> { } pub fn main() { - let b = &["foo".to_strbuf()]; + let b = &["foo".to_string()]; let a = A { - a: &["test".to_strbuf()], + a: &["test".to_string()], b: Some(b), }; assert_eq!(a.b.get_ref()[0].as_slice(), "foo"); diff --git a/src/test/run-pass/issue-9394-inherited-trait-calls.rs b/src/test/run-pass/issue-9394-inherited-trait-calls.rs index 1c1b0b61202b9..7273a45d89326 100644 --- a/src/test/run-pass/issue-9394-inherited-trait-calls.rs +++ b/src/test/run-pass/issue-9394-inherited-trait-calls.rs @@ -12,7 +12,7 @@ trait Base: Base2 + Base3{ fn foo(&self) -> String; fn foo1(&self) -> String; fn foo2(&self) -> String{ - "base foo2".to_strbuf() + "base foo2".to_string() } } @@ -32,39 +32,39 @@ struct X; impl Base for X { fn foo(&self) -> String{ - "base foo".to_strbuf() + "base foo".to_string() } fn foo1(&self) -> String{ - "base foo1".to_strbuf() + "base foo1".to_string() } } impl Base2 for X { fn baz(&self) -> String{ - "base2 baz".to_strbuf() + "base2 baz".to_string() } } impl Base3 for X { fn root(&self) -> String{ - "base3 root".to_strbuf() + "base3 root".to_string() } } impl Super for X { fn bar(&self) -> String{ - "super bar".to_strbuf() + "super bar".to_string() } } pub fn main() { let n = X; let s = &n as &Super; - assert_eq!(s.bar(),"super bar".to_strbuf()); - assert_eq!(s.foo(),"base foo".to_strbuf()); - assert_eq!(s.foo1(),"base foo1".to_strbuf()); - assert_eq!(s.foo2(),"base foo2".to_strbuf()); - assert_eq!(s.baz(),"base2 baz".to_strbuf()); - assert_eq!(s.root(),"base3 root".to_strbuf()); + assert_eq!(s.bar(),"super bar".to_string()); + assert_eq!(s.foo(),"base foo".to_string()); + assert_eq!(s.foo1(),"base foo1".to_string()); + assert_eq!(s.foo2(),"base foo2".to_string()); + assert_eq!(s.baz(),"base2 baz".to_string()); + assert_eq!(s.root(),"base3 root".to_string()); } diff --git a/src/test/run-pass/issue-9446.rs b/src/test/run-pass/issue-9446.rs index 9384e8c2b097c..a6adb1d369e40 100644 --- a/src/test/run-pass/issue-9446.rs +++ b/src/test/run-pass/issue-9446.rs @@ -28,12 +28,12 @@ impl Drop for Wrapper { pub fn main() { { // This runs without complaint. - let x = Wrapper::new("Bob".to_strbuf()); + let x = Wrapper::new("Bob".to_string()); x.say_hi(); } { // This fails to compile, circa 0.8-89-gc635fba. // error: internal compiler error: drop_ty_immediate: non-box ty - Wrapper::new("Bob".to_strbuf()).say_hi(); + Wrapper::new("Bob".to_string()).say_hi(); } } diff --git a/src/test/run-pass/istr.rs b/src/test/run-pass/istr.rs index baee60ce38752..af60f18e54228 100644 --- a/src/test/run-pass/istr.rs +++ b/src/test/run-pass/istr.rs @@ -11,26 +11,26 @@ use std::string::String; fn test_stack_assign() { - let s: String = "a".to_strbuf(); + let s: String = "a".to_string(); println!("{}", s.clone()); - let t: String = "a".to_strbuf(); + let t: String = "a".to_string(); assert!(s == t); - let u: String = "b".to_strbuf(); + let u: String = "b".to_string(); assert!((s != u)); } -fn test_heap_lit() { "a big string".to_strbuf(); } +fn test_heap_lit() { "a big string".to_string(); } fn test_heap_assign() { - let s: String = "a big ol' string".to_strbuf(); - let t: String = "a big ol' string".to_strbuf(); + let s: String = "a big ol' string".to_string(); + let t: String = "a big ol' string".to_string(); assert!(s == t); - let u: String = "a bad ol' string".to_strbuf(); + let u: String = "a bad ol' string".to_string(); assert!((s != u)); } fn test_heap_log() { - let s = "a big ol' string".to_strbuf(); + let s = "a big ol' string".to_string(); println!("{}", s); } diff --git a/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs b/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs index 6b217986cda90..dd0e9dc4295f7 100644 --- a/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs +++ b/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs @@ -21,13 +21,13 @@ fn check_log(exp: String, v: T) { pub fn main() { let mut x = Some(a(22u)); - let exp = "Some(a(22u))".to_strbuf(); + let exp = "Some(a(22u))".to_string(); let act = format_strbuf!("{:?}", x); assert_eq!(act, exp); check_log(exp, x); x = None; - let exp = "None".to_strbuf(); + let exp = "None".to_string(); let act = format_strbuf!("{:?}", x); assert_eq!(act, exp); check_log(exp, x); diff --git a/src/test/run-pass/log-knows-the-names-of-variants.rs b/src/test/run-pass/log-knows-the-names-of-variants.rs index 250f7d0260681..2a8402cc3fc33 100644 --- a/src/test/run-pass/log-knows-the-names-of-variants.rs +++ b/src/test/run-pass/log-knows-the-names-of-variants.rs @@ -19,7 +19,7 @@ enum bar { } pub fn main() { - assert_eq!("a(22u)".to_strbuf(), format_strbuf!("{:?}", a(22u))); - assert_eq!("c".to_strbuf(), format_strbuf!("{:?}", c)); - assert_eq!("d".to_strbuf(), format_strbuf!("{:?}", d)); + assert_eq!("a(22u)".to_string(), format_strbuf!("{:?}", a(22u))); + assert_eq!("c".to_string(), format_strbuf!("{:?}", c)); + assert_eq!("d".to_string(), format_strbuf!("{:?}", d)); } diff --git a/src/test/run-pass/match-borrowed_str.rs b/src/test/run-pass/match-borrowed_str.rs index b657181a36b98..a74f3e8332636 100644 --- a/src/test/run-pass/match-borrowed_str.rs +++ b/src/test/run-pass/match-borrowed_str.rs @@ -12,47 +12,47 @@ fn f1(ref_string: &str) -> String { match ref_string { - "a" => "found a".to_strbuf(), - "b" => "found b".to_strbuf(), - _ => "not found".to_strbuf() + "a" => "found a".to_string(), + "b" => "found b".to_string(), + _ => "not found".to_string() } } fn f2(ref_string: &str) -> String { match ref_string { - "a" => "found a".to_strbuf(), - "b" => "found b".to_strbuf(), + "a" => "found a".to_string(), + "b" => "found b".to_string(), s => format_strbuf!("not found ({})", s) } } fn g1(ref_1: &str, ref_2: &str) -> String { match (ref_1, ref_2) { - ("a", "b") => "found a,b".to_strbuf(), - ("b", "c") => "found b,c".to_strbuf(), - _ => "not found".to_strbuf() + ("a", "b") => "found a,b".to_string(), + ("b", "c") => "found b,c".to_string(), + _ => "not found".to_string() } } fn g2(ref_1: &str, ref_2: &str) -> String { match (ref_1, ref_2) { - ("a", "b") => "found a,b".to_strbuf(), - ("b", "c") => "found b,c".to_strbuf(), + ("a", "b") => "found a,b".to_string(), + ("b", "c") => "found b,c".to_string(), (s1, s2) => format_strbuf!("not found ({}, {})", s1, s2) } } pub fn main() { - assert_eq!(f1("b"), "found b".to_strbuf()); - assert_eq!(f1("c"), "not found".to_strbuf()); - assert_eq!(f1("d"), "not found".to_strbuf()); - assert_eq!(f2("b"), "found b".to_strbuf()); - assert_eq!(f2("c"), "not found (c)".to_strbuf()); - assert_eq!(f2("d"), "not found (d)".to_strbuf()); - assert_eq!(g1("b", "c"), "found b,c".to_strbuf()); - assert_eq!(g1("c", "d"), "not found".to_strbuf()); - assert_eq!(g1("d", "e"), "not found".to_strbuf()); - assert_eq!(g2("b", "c"), "found b,c".to_strbuf()); - assert_eq!(g2("c", "d"), "not found (c, d)".to_strbuf()); - assert_eq!(g2("d", "e"), "not found (d, e)".to_strbuf()); + assert_eq!(f1("b"), "found b".to_string()); + assert_eq!(f1("c"), "not found".to_string()); + assert_eq!(f1("d"), "not found".to_string()); + assert_eq!(f2("b"), "found b".to_string()); + assert_eq!(f2("c"), "not found (c)".to_string()); + assert_eq!(f2("d"), "not found (d)".to_string()); + assert_eq!(g1("b", "c"), "found b,c".to_string()); + assert_eq!(g1("c", "d"), "not found".to_string()); + assert_eq!(g1("d", "e"), "not found".to_string()); + assert_eq!(g2("b", "c"), "found b,c".to_string()); + assert_eq!(g2("c", "d"), "not found (c, d)".to_string()); + assert_eq!(g2("d", "e"), "not found (d, e)".to_string()); } diff --git a/src/test/run-pass/match-str.rs b/src/test/run-pass/match-str.rs index 8ab1b3d6dcdb0..574d7c3bf7f91 100644 --- a/src/test/run-pass/match-str.rs +++ b/src/test/run-pass/match-str.rs @@ -16,7 +16,7 @@ pub fn main() { enum t { tag1(String), tag2, } - match tag1("test".to_strbuf()) { + match tag1("test".to_string()) { tag2 => fail!(), tag1(ref s) if "test" != s.as_slice() => fail!(), tag1(ref s) if "test" == s.as_slice() => (), diff --git a/src/test/run-pass/monad.rs b/src/test/run-pass/monad.rs index daee9c3b03189..4642978d46c78 100644 --- a/src/test/run-pass/monad.rs +++ b/src/test/run-pass/monad.rs @@ -38,17 +38,17 @@ impl option_monad for Option { } fn transform(x: Option) -> Option { - x.bind(|n| Some(*n + 1) ).bind(|n| Some(n.to_str().to_strbuf()) ) + x.bind(|n| Some(*n + 1) ).bind(|n| Some(n.to_str().to_string()) ) } pub fn main() { - assert_eq!(transform(Some(10)), Some("11".to_strbuf())); + assert_eq!(transform(Some(10)), Some("11".to_string())); assert_eq!(transform(None), None); - assert!((vec!("hi".to_strbuf())) + assert!((vec!("hi".to_string())) .bind(|x| vec!(x.clone(), format_strbuf!("{}!", x)) ) .bind(|x| vec!(x.clone(), format_strbuf!("{}?", x)) ) == - vec!("hi".to_strbuf(), - "hi?".to_strbuf(), - "hi!".to_strbuf(), - "hi!?".to_strbuf())); + vec!("hi".to_string(), + "hi?".to_string(), + "hi!".to_string(), + "hi!?".to_string())); } diff --git a/src/test/run-pass/move-self.rs b/src/test/run-pass/move-self.rs index 66b943e5ceefa..c69cd17864a54 100644 --- a/src/test/run-pass/move-self.rs +++ b/src/test/run-pass/move-self.rs @@ -23,6 +23,6 @@ impl S { } pub fn main() { - let x = S { x: "Hello!".to_strbuf() }; + let x = S { x: "Hello!".to_string() }; x.foo(); } diff --git a/src/test/run-pass/nullable-pointer-iotareduction.rs b/src/test/run-pass/nullable-pointer-iotareduction.rs index df9b8bd64f0ca..0e185c3a33599 100644 --- a/src/test/run-pass/nullable-pointer-iotareduction.rs +++ b/src/test/run-pass/nullable-pointer-iotareduction.rs @@ -76,7 +76,7 @@ pub fn main() { check_type!(&17: &int); check_type!(box 18: Box); check_type!(@19: @int); - check_type!("foo".to_strbuf(): String); + check_type!("foo".to_string(): String); check_type!(vec!(20, 22): Vec ); let mint: uint = unsafe { mem::transmute(main) }; check_type!(main: fn(), |pthing| { diff --git a/src/test/run-pass/process-spawn-with-unicode-params.rs b/src/test/run-pass/process-spawn-with-unicode-params.rs index cdbb1fe84dc5a..0bfa2a75cf51f 100644 --- a/src/test/run-pass/process-spawn-with-unicode-params.rs +++ b/src/test/run-pass/process-spawn-with-unicode-params.rs @@ -42,7 +42,7 @@ fn main() { // parameters sent to child / expected to be received from parent let arg = blah; let cwd = my_dir.join(Path::new(child_dir.clone())); - let env = ("RUST_TEST_PROC_SPAWN_UNICODE".to_strbuf(), blah.to_strbuf()); + let env = ("RUST_TEST_PROC_SPAWN_UNICODE".to_string(), blah.to_string()); // am I the parent or the child? if my_args.len() == 1 { // parent diff --git a/src/test/run-pass/rec-align-u32.rs b/src/test/run-pass/rec-align-u32.rs index 0edb0a9670ee1..16755190a1405 100644 --- a/src/test/run-pass/rec-align-u32.rs +++ b/src/test/run-pass/rec-align-u32.rs @@ -64,6 +64,6 @@ pub fn main() { // because `inner`s alignment was 4. assert_eq!(mem::size_of::(), m::size()); - assert_eq!(y, "Outer{c8: 22u8, t: Inner{c64: 44u32}}".to_strbuf()); + assert_eq!(y, "Outer{c8: 22u8, t: Inner{c64: 44u32}}".to_string()); } } diff --git a/src/test/run-pass/rec-align-u64.rs b/src/test/run-pass/rec-align-u64.rs index aeb6adddcac53..f96794b0b8867 100644 --- a/src/test/run-pass/rec-align-u64.rs +++ b/src/test/run-pass/rec-align-u64.rs @@ -86,6 +86,6 @@ pub fn main() { // because `Inner`s alignment was 4. assert_eq!(mem::size_of::(), m::m::size()); - assert_eq!(y, "Outer{c8: 22u8, t: Inner{c64: 44u64}}".to_strbuf()); + assert_eq!(y, "Outer{c8: 22u8, t: Inner{c64: 44u64}}".to_string()); } } diff --git a/src/test/run-pass/rec-auto.rs b/src/test/run-pass/rec-auto.rs index 70458824e0abe..18431bc53794c 100644 --- a/src/test/run-pass/rec-auto.rs +++ b/src/test/run-pass/rec-auto.rs @@ -17,7 +17,7 @@ struct X { foo: String, bar: String } pub fn main() { - let x = X {foo: "hello".to_strbuf(), bar: "world".to_strbuf()}; + let x = X {foo: "hello".to_string(), bar: "world".to_string()}; println!("{}", x.foo.clone()); println!("{}", x.bar.clone()); } diff --git a/src/test/run-pass/reexported-static-methods-cross-crate.rs b/src/test/run-pass/reexported-static-methods-cross-crate.rs index 17ed80da03c97..5399f3cfd3597 100644 --- a/src/test/run-pass/reexported-static-methods-cross-crate.rs +++ b/src/test/run-pass/reexported-static-methods-cross-crate.rs @@ -20,5 +20,5 @@ pub fn main() { assert_eq!(42, Foo::foo()); assert_eq!(84, Baz::bar()); assert!(Boz::boz(1)); - assert_eq!("bort()".to_strbuf(), Bort::bort()); + assert_eq!("bort()".to_string(), Bort::bort()); } diff --git a/src/test/run-pass/reflect-visit-type.rs b/src/test/run-pass/reflect-visit-type.rs index d45c22c34f68b..6fbb311593bfa 100644 --- a/src/test/run-pass/reflect-visit-type.rs +++ b/src/test/run-pass/reflect-visit-type.rs @@ -18,32 +18,32 @@ struct MyVisitor { impl TyVisitor for MyVisitor { fn visit_bot(&mut self) -> bool { - self.types.push("bot".to_strbuf()); + self.types.push("bot".to_string()); println!("visited bot type"); true } fn visit_nil(&mut self) -> bool { - self.types.push("nil".to_strbuf()); + self.types.push("nil".to_string()); println!("visited nil type"); true } fn visit_bool(&mut self) -> bool { - self.types.push("bool".to_strbuf()); + self.types.push("bool".to_string()); println!("visited bool type"); true } fn visit_int(&mut self) -> bool { - self.types.push("int".to_strbuf()); + self.types.push("int".to_string()); println!("visited int type"); true } fn visit_i8(&mut self) -> bool { - self.types.push("i8".to_strbuf()); + self.types.push("i8".to_string()); println!("visited i8 type"); true } fn visit_i16(&mut self) -> bool { - self.types.push("i16".to_strbuf()); + self.types.push("i16".to_string()); println!("visited i16 type"); true } @@ -76,9 +76,9 @@ impl TyVisitor for MyVisitor { fn visit_evec_box(&mut self, _mtbl: uint, _inner: *TyDesc) -> bool { true } fn visit_evec_uniq(&mut self, _mtbl: uint, inner: *TyDesc) -> bool { - self.types.push("[".to_strbuf()); + self.types.push("[".to_string()); unsafe { visit_tydesc(inner, &mut *self as &mut TyVisitor); } - self.types.push("]".to_strbuf()); + self.types.push("]".to_string()); true } fn visit_evec_slice(&mut self, _mtbl: uint, _inner: *TyDesc) -> bool { true } @@ -156,6 +156,6 @@ pub fn main() { } let vec_types: Vec = v.types.clone().move_iter().collect(); - assert_eq!(vec_types, vec!("bool".to_strbuf(), "int".to_strbuf(), - "i8".to_strbuf(), "i16".to_strbuf())); + assert_eq!(vec_types, vec!("bool".to_string(), "int".to_string(), + "i8".to_string(), "i16".to_string())); } diff --git a/src/test/run-pass/ret-bang.rs b/src/test/run-pass/ret-bang.rs index 5c5b1d27797b7..42e5c8731e269 100644 --- a/src/test/run-pass/ret-bang.rs +++ b/src/test/run-pass/ret-bang.rs @@ -15,7 +15,7 @@ fn my_err(s: String) -> ! { println!("{}", s); fail!(); } fn okay(i: uint) -> int { if i == 3u { - my_err("I don't like three".to_strbuf()); + my_err("I don't like three".to_string()); } else { return 42; } diff --git a/src/test/run-pass/shape_intrinsic_tag_then_rec.rs b/src/test/run-pass/shape_intrinsic_tag_then_rec.rs index f6df904340278..96fd75c5156f0 100644 --- a/src/test/run-pass/shape_intrinsic_tag_then_rec.rs +++ b/src/test/run-pass/shape_intrinsic_tag_then_rec.rs @@ -59,7 +59,7 @@ pub fn main() { let t: @ty = @Spanned { data: 3u, span: sp }; let p_: Path_ = Path_ { global: true, - idents: vec!("hi".to_strbuf()), + idents: vec!("hi".to_string()), types: vec!(t), }; let p: path = Spanned { data: p_, span: sp }; diff --git a/src/test/run-pass/spawn-fn.rs b/src/test/run-pass/spawn-fn.rs index 34a7b6ac4b675..34ae825c0d2c9 100644 --- a/src/test/run-pass/spawn-fn.rs +++ b/src/test/run-pass/spawn-fn.rs @@ -16,9 +16,9 @@ fn x(s: String, n: int) { } pub fn main() { - task::spawn(proc() x("hello from first spawned fn".to_strbuf(), 65) ); - task::spawn(proc() x("hello from second spawned fn".to_strbuf(), 66) ); - task::spawn(proc() x("hello from third spawned fn".to_strbuf(), 67) ); + task::spawn(proc() x("hello from first spawned fn".to_string(), 65) ); + task::spawn(proc() x("hello from second spawned fn".to_string(), 66) ); + task::spawn(proc() x("hello from third spawned fn".to_string(), 67) ); let mut i: int = 30; while i > 0 { i = i - 1; diff --git a/src/test/run-pass/spawn-types.rs b/src/test/run-pass/spawn-types.rs index 905069bec8d12..1418ab86174f3 100644 --- a/src/test/run-pass/spawn-types.rs +++ b/src/test/run-pass/spawn-types.rs @@ -19,10 +19,10 @@ use std::task; type ctx = Sender; fn iotask(_tx: &ctx, ip: String) { - assert_eq!(ip, "localhost".to_strbuf()); + assert_eq!(ip, "localhost".to_string()); } pub fn main() { let (tx, _rx) = channel::(); - task::spawn(proc() iotask(&tx, "localhost".to_strbuf()) ); + task::spawn(proc() iotask(&tx, "localhost".to_string()) ); } diff --git a/src/test/run-pass/static-impl.rs b/src/test/run-pass/static-impl.rs index dc39ebbcd031e..1545de93786ee 100644 --- a/src/test/run-pass/static-impl.rs +++ b/src/test/run-pass/static-impl.rs @@ -31,7 +31,7 @@ trait uint_utils { impl uint_utils for uint { fn str(&self) -> String { - self.to_str().to_strbuf() + self.to_str().to_string() } fn multi(&self, f: |uint|) { let mut c = 0u; @@ -59,9 +59,9 @@ impl vec_utils for Vec { pub fn main() { assert_eq!(10u.plus(), 30); - assert_eq!(("hi".to_strbuf()).plus(), 200); + assert_eq!(("hi".to_string()).plus(), 200); - assert_eq!((vec!(1)).length_().str(), "1".to_strbuf()); + assert_eq!((vec!(1)).length_().str(), "1".to_string()); let vect = vec!(3, 4).map_(|a| *a + 4); assert_eq!(*vect.get(0), 7); let vect = (vec!(3, 4)).map_::(|a| *a as uint + 4u); diff --git a/src/test/run-pass/static-method-xcrate.rs b/src/test/run-pass/static-method-xcrate.rs index 7cf1a15ab3ec3..076c56bcc4d2a 100644 --- a/src/test/run-pass/static-method-xcrate.rs +++ b/src/test/run-pass/static-method-xcrate.rs @@ -15,8 +15,8 @@ extern crate static_methods_crate; use static_methods_crate::read; pub fn main() { - let result: int = read("5".to_strbuf()); + let result: int = read("5".to_string()); assert_eq!(result, 5); - assert_eq!(read::readMaybe("false".to_strbuf()), Some(false)); - assert_eq!(read::readMaybe("foo".to_strbuf()), None::); + assert_eq!(read::readMaybe("false".to_string()), Some(false)); + assert_eq!(read::readMaybe("foo".to_string()), None::); } diff --git a/src/test/run-pass/str-concat.rs b/src/test/run-pass/str-concat.rs index 27eb30740e2de..51831a7b1cd03 100644 --- a/src/test/run-pass/str-concat.rs +++ b/src/test/run-pass/str-concat.rs @@ -12,8 +12,8 @@ pub fn main() { - let a: String = "hello".to_strbuf(); - let b: String = "world".to_strbuf(); + let a: String = "hello".to_string(); + let b: String = "world".to_string(); let s: String = format_strbuf!("{}{}", a, b); println!("{}", s.clone()); assert_eq!(s.as_slice()[9], 'd' as u8); diff --git a/src/test/run-pass/str-multiline.rs b/src/test/run-pass/str-multiline.rs index 1da0341199806..918715f81e85a 100644 --- a/src/test/run-pass/str-multiline.rs +++ b/src/test/run-pass/str-multiline.rs @@ -10,12 +10,12 @@ pub fn main() { let a: String = "this \ -is a test".to_strbuf(); +is a test".to_string(); let b: String = "this \ is \ another \ - test".to_strbuf(); - assert_eq!(a, "this is a test".to_strbuf()); - assert_eq!(b, "this is another test".to_strbuf()); + test".to_string(); + assert_eq!(a, "this is a test".to_string()); + assert_eq!(b, "this is another test".to_string()); } diff --git a/src/test/run-pass/string-self-append.rs b/src/test/run-pass/string-self-append.rs index 4d1b67e7dfb80..4610d1ccfcc4a 100644 --- a/src/test/run-pass/string-self-append.rs +++ b/src/test/run-pass/string-self-append.rs @@ -10,7 +10,7 @@ pub fn main() { // Make sure we properly handle repeated self-appends. - let mut a: String = "A".to_strbuf(); + let mut a: String = "A".to_string(); let mut i = 20; let mut expected_len = 1u; while i > 0 { diff --git a/src/test/run-pass/struct-literal-dtor.rs b/src/test/run-pass/struct-literal-dtor.rs index 9a02bd6b974e4..61607cffc47fc 100644 --- a/src/test/run-pass/struct-literal-dtor.rs +++ b/src/test/run-pass/struct-literal-dtor.rs @@ -20,6 +20,6 @@ impl Drop for foo { pub fn main() { let _z = foo { - x: "Hello".to_strbuf() + x: "Hello".to_string() }; } diff --git a/src/test/run-pass/struct-order-of-eval-1.rs b/src/test/run-pass/struct-order-of-eval-1.rs index 078c43c469123..6cebd17496a52 100644 --- a/src/test/run-pass/struct-order-of-eval-1.rs +++ b/src/test/run-pass/struct-order-of-eval-1.rs @@ -11,9 +11,9 @@ struct S { f0: String, f1: int } pub fn main() { - let s = "Hello, world!".to_strbuf(); + let s = "Hello, world!".to_string(); let _s = S { - f0: s.to_strbuf(), + f0: s.to_string(), ..S { f0: s, f1: 23 diff --git a/src/test/run-pass/struct-order-of-eval-2.rs b/src/test/run-pass/struct-order-of-eval-2.rs index a1861e0c1fea7..786f080bb9ee3 100644 --- a/src/test/run-pass/struct-order-of-eval-2.rs +++ b/src/test/run-pass/struct-order-of-eval-2.rs @@ -14,9 +14,9 @@ struct S { } pub fn main() { - let s = "Hello, world!".to_strbuf(); + let s = "Hello, world!".to_string(); let _s = S { - f1: s.to_strbuf(), + f1: s.to_string(), f0: s }; } diff --git a/src/test/run-pass/swap-overlapping.rs b/src/test/run-pass/swap-overlapping.rs index afb1847e7f1b7..1a96af43d235f 100644 --- a/src/test/run-pass/swap-overlapping.rs +++ b/src/test/run-pass/swap-overlapping.rs @@ -15,7 +15,7 @@ use std::ptr; pub fn main() { let mut test = TestDescAndFn { desc: TestDesc { - name: DynTestName("test".to_strbuf()), + name: DynTestName("test".to_string()), should_fail: false }, testfn: DynTestFn(proc() ()), diff --git a/src/test/run-pass/syntax-extension-source-utils.rs b/src/test/run-pass/syntax-extension-source-utils.rs index b8f3e72652a4b..e4679a486e91d 100644 --- a/src/test/run-pass/syntax-extension-source-utils.rs +++ b/src/test/run-pass/syntax-extension-source-utils.rs @@ -16,7 +16,7 @@ pub mod m1 { pub mod m2 { pub fn where_am_i() -> String { - (module_path!()).to_strbuf() + (module_path!()).to_string() } } } @@ -28,14 +28,14 @@ pub fn main() { //assert!((col!() == 11)); assert_eq!(indirect_line!(), 29); assert!((file!().ends_with("syntax-extension-source-utils.rs"))); - assert_eq!(stringify!((2*3) + 5).to_strbuf(), "( 2 * 3 ) + 5".to_strbuf()); + assert_eq!(stringify!((2*3) + 5).to_string(), "( 2 * 3 ) + 5".to_string()); assert!(include!("syntax-extension-source-utils-files/includeme.\ - fragment").to_strbuf() - == "victory robot 6".to_strbuf()); + fragment").to_string() + == "victory robot 6".to_string()); assert!( include_str!("syntax-extension-source-utils-files/includeme.\ - fragment").to_strbuf() + fragment").to_string() .as_slice() .starts_with("/* this is for ")); assert!( diff --git a/src/test/run-pass/tag-align-shape.rs b/src/test/run-pass/tag-align-shape.rs index 700cfacb85604..c07ca9cae76b6 100644 --- a/src/test/run-pass/tag-align-shape.rs +++ b/src/test/run-pass/tag-align-shape.rs @@ -22,5 +22,5 @@ pub fn main() { let x = t_rec {c8: 22u8, t: a_tag(44u64)}; let y = format!("{:?}", x); println!("y = {}", y); - assert_eq!(y, "t_rec{c8: 22u8, t: a_tag(44u64)}".to_strbuf()); + assert_eq!(y, "t_rec{c8: 22u8, t: a_tag(44u64)}".to_string()); } diff --git a/src/test/run-pass/tag-disr-val-shape.rs b/src/test/run-pass/tag-disr-val-shape.rs index a795881cd6de2..beb0c5dbe815a 100644 --- a/src/test/run-pass/tag-disr-val-shape.rs +++ b/src/test/run-pass/tag-disr-val-shape.rs @@ -19,7 +19,7 @@ enum color { pub fn main() { let act = format!("{:?}", red); println!("{}", act); - assert_eq!("red".to_strbuf(), act); - assert_eq!("green".to_strbuf(), format!("{:?}", green)); - assert_eq!("white".to_strbuf(), format!("{:?}", white)); + assert_eq!("red".to_string(), act); + assert_eq!("green".to_string(), format!("{:?}", green)); + assert_eq!("white".to_string(), format!("{:?}", white)); } diff --git a/src/test/run-pass/tag-variant-disr-val.rs b/src/test/run-pass/tag-variant-disr-val.rs index 906001fefb441..914904f2070e0 100644 --- a/src/test/run-pass/tag-variant-disr-val.rs +++ b/src/test/run-pass/tag-variant-disr-val.rs @@ -27,14 +27,14 @@ impl Eq for color { } pub fn main() { - test_color(red, 0xff0000, "red".to_strbuf()); - test_color(green, 0x00ff00, "green".to_strbuf()); - test_color(blue, 0x0000ff, "blue".to_strbuf()); - test_color(black, 0x000000, "black".to_strbuf()); - test_color(white, 0xFFFFFF, "white".to_strbuf()); - test_color(imaginary, -1, "imaginary".to_strbuf()); - test_color(purple, 2, "purple".to_strbuf()); - test_color(orange, 4, "orange".to_strbuf()); + test_color(red, 0xff0000, "red".to_string()); + test_color(green, 0x00ff00, "green".to_string()); + test_color(blue, 0x0000ff, "blue".to_string()); + test_color(black, 0x000000, "black".to_string()); + test_color(white, 0xFFFFFF, "white".to_string()); + test_color(imaginary, -1, "imaginary".to_string()); + test_color(purple, 2, "purple".to_string()); + test_color(orange, 4, "orange".to_string()); } fn test_color(color: color, val: int, name: String) { @@ -47,25 +47,25 @@ fn test_color(color: color, val: int, name: String) { fn get_color_alt(color: color) -> String { match color { - red => {"red".to_strbuf()} - green => {"green".to_strbuf()} - blue => {"blue".to_strbuf()} - black => {"black".to_strbuf()} - white => {"white".to_strbuf()} - imaginary => {"imaginary".to_strbuf()} - purple => {"purple".to_strbuf()} - orange => {"orange".to_strbuf()} + red => {"red".to_string()} + green => {"green".to_string()} + blue => {"blue".to_string()} + black => {"black".to_string()} + white => {"white".to_string()} + imaginary => {"imaginary".to_string()} + purple => {"purple".to_string()} + orange => {"orange".to_string()} } } fn get_color_if(color: color) -> String { - if color == red {"red".to_strbuf()} - else if color == green {"green".to_strbuf()} - else if color == blue {"blue".to_strbuf()} - else if color == black {"black".to_strbuf()} - else if color == white {"white".to_strbuf()} - else if color == imaginary {"imaginary".to_strbuf()} - else if color == purple {"purple".to_strbuf()} - else if color == orange {"orange".to_strbuf()} - else {"unknown".to_strbuf()} + if color == red {"red".to_string()} + else if color == green {"green".to_string()} + else if color == blue {"blue".to_string()} + else if color == black {"black".to_string()} + else if color == white {"white".to_string()} + else if color == imaginary {"imaginary".to_string()} + else if color == purple {"purple".to_string()} + else if color == orange {"orange".to_string()} + else {"unknown".to_string()} } diff --git a/src/test/run-pass/tail-call-arg-leak.rs b/src/test/run-pass/tail-call-arg-leak.rs index 3229cdf50574e..a5447606d87c8 100644 --- a/src/test/run-pass/tail-call-arg-leak.rs +++ b/src/test/run-pass/tail-call-arg-leak.rs @@ -15,5 +15,5 @@ fn inner(dummy: String, b: bool) { if b { return inner(dummy, false); } } pub fn main() { - inner("hi".to_strbuf(), true); + inner("hi".to_string(), true); } diff --git a/src/test/run-pass/task-comm-10.rs b/src/test/run-pass/task-comm-10.rs index 459d8c2ea0fe5..8054fb0f43b91 100644 --- a/src/test/run-pass/task-comm-10.rs +++ b/src/test/run-pass/task-comm-10.rs @@ -18,10 +18,10 @@ fn start(tx: &Sender>) { let mut a; let mut b; a = rx.recv(); - assert!(a == "A".to_strbuf()); + assert!(a == "A".to_string()); println!("{}", a); b = rx.recv(); - assert!(b == "B".to_strbuf()); + assert!(b == "B".to_string()); println!("{}", b); } @@ -30,7 +30,7 @@ pub fn main() { let _child = task::spawn(proc() { start(&tx) }); let mut c = rx.recv(); - c.send("A".to_strbuf()); - c.send("B".to_strbuf()); + c.send("A".to_string()); + c.send("B".to_string()); task::deschedule(); } diff --git a/src/test/run-pass/task-life-0.rs b/src/test/run-pass/task-life-0.rs index 1cd8b911bf73c..5e0d184683129 100644 --- a/src/test/run-pass/task-life-0.rs +++ b/src/test/run-pass/task-life-0.rs @@ -11,7 +11,7 @@ use std::task; pub fn main() { - task::spawn(proc() child("Hello".to_strbuf()) ); + task::spawn(proc() child("Hello".to_string()) ); } fn child(_s: String) { diff --git a/src/test/run-pass/trait-bounds-in-arc.rs b/src/test/run-pass/trait-bounds-in-arc.rs index d7e53084e2feb..2028ef1714c63 100644 --- a/src/test/run-pass/trait-bounds-in-arc.rs +++ b/src/test/run-pass/trait-bounds-in-arc.rs @@ -58,20 +58,20 @@ impl Pet for Goldfyshe { } pub fn main() { - let catte = Catte { num_whiskers: 7, name: "alonzo_church".to_strbuf() }; + let catte = Catte { num_whiskers: 7, name: "alonzo_church".to_string() }; let dogge1 = Dogge { bark_decibels: 100, tricks_known: 42, - name: "alan_turing".to_strbuf(), + name: "alan_turing".to_string(), }; let dogge2 = Dogge { bark_decibels: 55, tricks_known: 11, - name: "albert_einstein".to_strbuf(), + name: "albert_einstein".to_string(), }; let fishe = Goldfyshe { swim_speed: 998, - name: "alec_guinness".to_strbuf(), + name: "alec_guinness".to_string(), }; let arc = Arc::new(vec!(box catte as Box, box dogge1 as Box, diff --git a/src/test/run-pass/trait-cast.rs b/src/test/run-pass/trait-cast.rs index fc5df846e93c9..7f0f857090fca 100644 --- a/src/test/run-pass/trait-cast.rs +++ b/src/test/run-pass/trait-cast.rs @@ -28,7 +28,7 @@ trait to_str { impl to_str for Option { fn to_str_(&self) -> String { match *self { - None => { "none".to_strbuf() } + None => { "none".to_string() } Some(ref t) => format_strbuf!("some({})", t.to_str_()), } } @@ -36,7 +36,7 @@ impl to_str for Option { impl to_str for int { fn to_str_(&self) -> String { - self.to_str().to_strbuf() + self.to_str().to_string() } } @@ -63,7 +63,7 @@ pub fn main() { right: Some(t1), val: box 2 as Box})); let expected = - "[2, some([1, none, none]), some([1, none, none])]".to_strbuf(); + "[2, some([1, none, none]), some([1, none, none])]".to_string(); assert!(t2.to_str_() == expected); assert!(foo(t2) == expected); diff --git a/src/test/run-pass/trait-generic.rs b/src/test/run-pass/trait-generic.rs index 77b84e8372751..78e1e100bd65f 100644 --- a/src/test/run-pass/trait-generic.rs +++ b/src/test/run-pass/trait-generic.rs @@ -14,13 +14,13 @@ trait to_str { fn to_string(&self) -> String; } impl to_str for int { - fn to_string(&self) -> String { self.to_str().to_strbuf() } + fn to_string(&self) -> String { self.to_str() } } impl to_str for String { fn to_string(&self) -> String { self.clone() } } impl to_str for () { - fn to_string(&self) -> String { "()".to_strbuf() } + fn to_string(&self) -> String { "()".to_string() } } trait map { @@ -38,16 +38,16 @@ impl map for Vec { } fn foo>(x: T) -> Vec { - x.map(|_e| "hi".to_strbuf() ) + x.map(|_e| "hi".to_string() ) } fn bar>(x: T) -> Vec { x.map(|_e| _e.to_string() ) } pub fn main() { - assert_eq!(foo(vec!(1)), vec!("hi".to_strbuf())); - assert_eq!(bar:: >(vec!(4, 5)), vec!("4".to_strbuf(), "5".to_strbuf())); - assert_eq!(bar:: >(vec!("x".to_strbuf(), "y".to_strbuf())), - vec!("x".to_strbuf(), "y".to_strbuf())); - assert_eq!(bar::<(), Vec<()>>(vec!(())), vec!("()".to_strbuf())); + assert_eq!(foo(vec!(1)), vec!("hi".to_string())); + assert_eq!(bar:: >(vec!(4, 5)), vec!("4".to_string(), "5".to_string())); + assert_eq!(bar:: >(vec!("x".to_string(), "y".to_string())), + vec!("x".to_string(), "y".to_string())); + assert_eq!(bar::<(), Vec<()>>(vec!(())), vec!("()".to_string())); } diff --git a/src/test/run-pass/trait-to-str.rs b/src/test/run-pass/trait-to-str.rs index f3937de47056d..7fe5b327f2f88 100644 --- a/src/test/run-pass/trait-to-str.rs +++ b/src/test/run-pass/trait-to-str.rs @@ -15,7 +15,7 @@ trait to_str { } impl to_str for int { - fn to_string(&self) -> String { self.to_str().to_strbuf() } + fn to_string(&self) -> String { self.to_str().to_string() } } impl to_str for Vec { @@ -29,16 +29,16 @@ impl to_str for Vec { } pub fn main() { - assert!(1.to_string() == "1".to_strbuf()); - assert!((vec!(2, 3, 4)).to_string() == "[2, 3, 4]".to_strbuf()); + assert!(1.to_string() == "1".to_string()); + assert!((vec!(2, 3, 4)).to_string() == "[2, 3, 4]".to_string()); fn indirect(x: T) -> String { format_strbuf!("{}!", x.to_string()) } - assert!(indirect(vec!(10, 20)) == "[10, 20]!".to_strbuf()); + assert!(indirect(vec!(10, 20)) == "[10, 20]!".to_string()); fn indirect2(x: T) -> String { indirect(x) } - assert!(indirect2(vec!(1)) == "[1]!".to_strbuf()); + assert!(indirect2(vec!(1)) == "[1]!".to_string()); } diff --git a/src/test/run-pass/traits-default-method-macro.rs b/src/test/run-pass/traits-default-method-macro.rs index f9b8d273c66fb..8b0d8533c5640 100644 --- a/src/test/run-pass/traits-default-method-macro.rs +++ b/src/test/run-pass/traits-default-method-macro.rs @@ -24,5 +24,5 @@ impl Foo for Baz { pub fn main() { let q = Quux; - assert_eq!(q.bar(), "test".to_strbuf()); + assert_eq!(q.bar(), "test".to_string()); } diff --git a/src/test/run-pass/utf8.rs b/src/test/run-pass/utf8.rs index 66511168946ec..d59ed3a4b6259 100644 --- a/src/test/run-pass/utf8.rs +++ b/src/test/run-pass/utf8.rs @@ -24,17 +24,17 @@ pub fn main() { assert_eq!(pi as int, '\u03a0' as int); assert_eq!('\x0a' as int, '\n' as int); - let bhutan: String = "འབྲུག་ཡུལ།".to_strbuf(); - let japan: String = "日本".to_strbuf(); - let uzbekistan: String = "Ўзбекистон".to_strbuf(); - let austria: String = "Österreich".to_strbuf(); + let bhutan: String = "འབྲུག་ཡུལ།".to_string(); + let japan: String = "日本".to_string(); + let uzbekistan: String = "Ўзбекистон".to_string(); + let austria: String = "Österreich".to_string(); let bhutan_e: String = - "\u0f60\u0f56\u0fb2\u0f74\u0f42\u0f0b\u0f61\u0f74\u0f63\u0f0d".to_strbuf(); - let japan_e: String = "\u65e5\u672c".to_strbuf(); + "\u0f60\u0f56\u0fb2\u0f74\u0f42\u0f0b\u0f61\u0f74\u0f63\u0f0d".to_string(); + let japan_e: String = "\u65e5\u672c".to_string(); let uzbekistan_e: String = - "\u040e\u0437\u0431\u0435\u043a\u0438\u0441\u0442\u043e\u043d".to_strbuf(); - let austria_e: String = "\u00d6sterreich".to_strbuf(); + "\u040e\u0437\u0431\u0435\u043a\u0438\u0441\u0442\u043e\u043d".to_string(); + let austria_e: String = "\u00d6sterreich".to_string(); let oo: char = 'Ö'; assert_eq!(oo as int, 0xd6); diff --git a/src/test/run-pass/utf8_chars.rs b/src/test/run-pass/utf8_chars.rs index c9551c87e8727..93c8111ad2d1f 100644 --- a/src/test/run-pass/utf8_chars.rs +++ b/src/test/run-pass/utf8_chars.rs @@ -13,13 +13,13 @@ use std::str; pub fn main() { // Chars of 1, 2, 3, and 4 bytes let chs: Vec = vec!('e', 'é', '€', '\U00010000'); - let s: String = str::from_chars(chs.as_slice()).to_strbuf(); + let s: String = str::from_chars(chs.as_slice()).to_string(); let schs: Vec = s.as_slice().chars().collect(); assert!(s.len() == 10u); assert!(s.as_slice().char_len() == 4u); assert!(schs.len() == 4u); - assert!(str::from_chars(schs.as_slice()).to_strbuf() == s); + assert!(str::from_chars(schs.as_slice()).to_string() == s); assert!(s.as_slice().char_at(0u) == 'e'); assert!(s.as_slice().char_at(1u) == 'é'); diff --git a/src/test/run-pass/variant-attributes.rs b/src/test/run-pass/variant-attributes.rs index ca8550bed9cab..43ce1082b2b82 100644 --- a/src/test/run-pass/variant-attributes.rs +++ b/src/test/run-pass/variant-attributes.rs @@ -36,4 +36,4 @@ enum crew_of_enterprise_d { fn boldly_go(_crew_member: crew_of_enterprise_d, _where: String) { } -pub fn main() { boldly_go(worf, "where no one has gone before".to_strbuf()); } +pub fn main() { boldly_go(worf, "where no one has gone before".to_string()); } diff --git a/src/test/run-pass/vec-tail-matching.rs b/src/test/run-pass/vec-tail-matching.rs index 278c36d0adecf..e58aebcddfe0e 100644 --- a/src/test/run-pass/vec-tail-matching.rs +++ b/src/test/run-pass/vec-tail-matching.rs @@ -15,16 +15,16 @@ struct Foo { pub fn main() { let x = [ - Foo { string: "foo".to_strbuf() }, - Foo { string: "bar".to_strbuf() }, - Foo { string: "baz".to_strbuf() } + Foo { string: "foo".to_string() }, + Foo { string: "bar".to_string() }, + Foo { string: "baz".to_string() } ]; match x { [ref first, ..tail] => { - assert!(first.string == "foo".to_strbuf()); + assert!(first.string == "foo".to_string()); assert_eq!(tail.len(), 2); - assert!(tail[0].string == "bar".to_strbuf()); - assert!(tail[1].string == "baz".to_strbuf()); + assert!(tail[0].string == "bar".to_string()); + assert!(tail[1].string == "baz".to_string()); match tail { [Foo { .. }, _, Foo { .. }, .. _tail] => { diff --git a/src/test/run-pass/vec-to_str.rs b/src/test/run-pass/vec-to_str.rs index 190007a781164..2eadd2fc3c893 100644 --- a/src/test/run-pass/vec-to_str.rs +++ b/src/test/run-pass/vec-to_str.rs @@ -9,12 +9,12 @@ // except according to those terms. pub fn main() { - assert_eq!((vec!(0, 1)).to_str(), "[0, 1]".to_strbuf()); - assert_eq!((&[1, 2]).to_str(), "[1, 2]".to_strbuf()); + assert_eq!((vec!(0, 1)).to_str(), "[0, 1]".to_string()); + assert_eq!((&[1, 2]).to_str(), "[1, 2]".to_string()); let foo = vec!(3, 4); let bar = &[4, 5]; - assert_eq!(foo.to_str(), "[3, 4]".to_strbuf()); - assert_eq!(bar.to_str(), "[4, 5]".to_strbuf()); + assert_eq!(foo.to_str(), "[3, 4]".to_string()); + assert_eq!(bar.to_str(), "[4, 5]".to_string()); }