Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
732e0578
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
732e0578
编写于
6月 06, 2014
作者:
B
bors
浏览文件
操作
浏览文件
下载
差异文件
auto merge of #14667 : aochagavia/rust/pr2, r=huonw
上级
100ff4cf
501b904b
变更
31
隐藏空白更改
内联
并排
Showing
31 changed file
with
54 addition
and
51 deletion
+54
-51
src/compiletest/errors.rs
src/compiletest/errors.rs
+1
-1
src/compiletest/util.rs
src/compiletest/util.rs
+1
-1
src/doc/complement-cheatsheet.md
src/doc/complement-cheatsheet.md
+1
-1
src/doc/guide-tasks.md
src/doc/guide-tasks.md
+2
-2
src/doc/rust.md
src/doc/rust.md
+1
-1
src/libgetopts/lib.rs
src/libgetopts/lib.rs
+1
-1
src/libnum/complex.rs
src/libnum/complex.rs
+1
-1
src/libnum/rational.rs
src/libnum/rational.rs
+1
-1
src/libregex_macros/lib.rs
src/libregex_macros/lib.rs
+1
-1
src/librustc/driver/driver.rs
src/librustc/driver/driver.rs
+2
-2
src/librustc/middle/liveness.rs
src/librustc/middle/liveness.rs
+1
-1
src/librustc/middle/mem_categorization.rs
src/librustc/middle/mem_categorization.rs
+1
-1
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/base.rs
+1
-1
src/librustc/middle/typeck/infer/to_str.rs
src/librustc/middle/typeck/infer/to_str.rs
+2
-2
src/librustc/util/ppaux.rs
src/librustc/util/ppaux.rs
+7
-4
src/librustdoc/clean/inline.rs
src/librustdoc/clean/inline.rs
+1
-1
src/librustdoc/clean/mod.rs
src/librustdoc/clean/mod.rs
+8
-8
src/librustdoc/html/format.rs
src/librustdoc/html/format.rs
+1
-1
src/librustdoc/html/markdown.rs
src/librustdoc/html/markdown.rs
+1
-1
src/librustdoc/lib.rs
src/librustdoc/lib.rs
+1
-1
src/libsyntax/ext/source_util.rs
src/libsyntax/ext/source_util.rs
+1
-1
src/libsyntax/ext/tt/macro_rules.rs
src/libsyntax/ext/tt/macro_rules.rs
+1
-1
src/libsyntax/parse/token.rs
src/libsyntax/parse/token.rs
+1
-1
src/libtest/lib.rs
src/libtest/lib.rs
+2
-2
src/libtime/lib.rs
src/libtime/lib.rs
+3
-3
src/liburl/lib.rs
src/liburl/lib.rs
+1
-1
src/test/bench/core-set.rs
src/test/bench/core-set.rs
+5
-5
src/test/run-pass/monad.rs
src/test/run-pass/monad.rs
+1
-1
src/test/run-pass/static-impl.rs
src/test/run-pass/static-impl.rs
+1
-1
src/test/run-pass/trait-cast.rs
src/test/run-pass/trait-cast.rs
+1
-1
src/test/run-pass/trait-to-str.rs
src/test/run-pass/trait-to-str.rs
+1
-1
未找到文件。
src/compiletest/errors.rs
浏览文件 @
732e0578
...
...
@@ -31,7 +31,7 @@ pub fn load_errors(re: &Regex, testfile: &Path) -> Vec<ExpectedError> {
fn
parse_expected
(
line_num
:
uint
,
line
:
&
str
,
re
:
&
Regex
)
->
Option
<
ExpectedError
>
{
re
.captures
(
line
)
.and_then
(|
caps
|
{
let
adjusts
=
caps
.name
(
"adjusts"
)
.len
();
let
kind
=
caps
.name
(
"kind"
)
.to_ascii
()
.to_lower
()
.into_str
()
.to_string
()
;
let
kind
=
caps
.name
(
"kind"
)
.to_ascii
()
.to_lower
()
.into_str
();
let
msg
=
caps
.name
(
"msg"
)
.trim
()
.to_string
();
debug!
(
"line={} kind={} msg={}"
,
line_num
,
kind
,
msg
);
...
...
src/compiletest/util.rs
浏览文件 @
732e0578
...
...
@@ -41,7 +41,7 @@ pub fn make_new_path(path: &str) -> String {
Some
(
curr
)
=>
{
format!
(
"{}{}{}"
,
path
,
path_div
(),
curr
)
}
None
=>
path
.to_str
()
.to_string
()
None
=>
path
.to_str
()
}
}
...
...
src/doc/complement-cheatsheet.md
浏览文件 @
732e0578
...
...
@@ -8,7 +8,7 @@ Use [`ToStr`](std/to_str/trait.ToStr.html).
~~~
let x: int = 42;
let y: String = x.to_str()
.to_string()
;
let y: String = x.to_str();
~~~
**String to int**
...
...
src/doc/guide-tasks.md
浏览文件 @
732e0578
...
...
@@ -467,7 +467,7 @@ fn stringifier(channel: &sync::DuplexStream<String, uint>) {
let mut value: uint;
loop {
value = channel.recv();
channel.send(value.to_str()
.to_string()
);
channel.send(value.to_str());
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_string()
);
# channel.send(value.to_str());
# if value == 0u { break; }
# }
# }
...
...
src/doc/rust.md
浏览文件 @
732e0578
...
...
@@ -3579,7 +3579,7 @@ trait Printable {
}
impl Printable for int {
fn to_string(&self) -> String { self.to_str()
.to_string()
}
fn to_string(&self) -> String { self.to_str() }
}
fn print(a: Box<Printable>) {
...
...
src/libgetopts/lib.rs
浏览文件 @
732e0578
...
...
@@ -222,7 +222,7 @@ fn from_str(nm: &str) -> Name {
fn
to_str
(
&
self
)
->
String
{
match
*
self
{
Short
(
ch
)
=>
ch
.to_str
()
.to_string
()
,
Short
(
ch
)
=>
ch
.to_str
(),
Long
(
ref
s
)
=>
s
.to_string
()
}
}
...
...
src/libnum/complex.rs
浏览文件 @
732e0578
...
...
@@ -349,7 +349,7 @@ fn test_neg() {
#[test]
fn
test_to_str
()
{
fn
test
(
c
:
Complex64
,
s
:
String
)
{
assert_eq!
(
c
.to_str
()
.to_string
()
,
s
);
assert_eq!
(
c
.to_str
(),
s
);
}
test
(
_0_0
i
,
"0+0i"
.to_string
());
test
(
_1_0
i
,
"1+0i"
.to_string
());
...
...
src/libnum/rational.rs
浏览文件 @
732e0578
...
...
@@ -559,7 +559,7 @@ fn test_recip() {
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_string
()
,
s
);
assert_eq!
(
r
.to_str
(),
s
);
}
test
(
_1
,
"1/1"
.to_string
());
test
(
_0
,
"0/1"
.to_string
());
...
...
src/libregex_macros/lib.rs
浏览文件 @
732e0578
...
...
@@ -620,7 +620,7 @@ fn parse(cx: &mut ExtCtxt, tts: &[ast::TokenTree]) -> Option<String> {
let
regex
=
match
entry
.node
{
ast
::
ExprLit
(
lit
)
=>
{
match
lit
.node
{
ast
::
LitStr
(
ref
s
,
_
)
=>
s
.to_str
()
.to_string
()
,
ast
::
LitStr
(
ref
s
,
_
)
=>
s
.to_str
(),
_
=>
{
cx
.span_err
(
entry
.span
,
format!
(
"expected string literal but got `{}`"
,
...
...
src/librustc/driver/driver.rs
浏览文件 @
732e0578
...
...
@@ -533,7 +533,7 @@ fn post(&self,
match
node
{
pprust
::
NodeItem
(
item
)
=>
{
try!
(
pp
::
space
(
&
mut
s
.s
));
s
.synth_comment
(
item
.id
.to_str
()
.to_string
()
)
s
.synth_comment
(
item
.id
.to_str
())
}
pprust
::
NodeBlock
(
blk
)
=>
{
try!
(
pp
::
space
(
&
mut
s
.s
));
...
...
@@ -541,7 +541,7 @@ fn post(&self,
}
pprust
::
NodeExpr
(
expr
)
=>
{
try!
(
pp
::
space
(
&
mut
s
.s
));
try!
(
s
.synth_comment
(
expr
.id
.to_str
()
.to_string
()
));
try!
(
s
.synth_comment
(
expr
.id
.to_str
()));
s
.pclose
()
}
pprust
::
NodePat
(
pat
)
=>
{
...
...
src/librustc/middle/liveness.rs
浏览文件 @
732e0578
...
...
@@ -324,7 +324,7 @@ fn variable(&self, node_id: NodeId, span: Span) -> Variable {
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_string
()
token
::
get_ident
(
nm
)
.get
()
.to_str
()
},
&
ImplicitRet
=>
"<implicit-ret>"
.to_string
()
}
...
...
src/librustc/middle/mem_categorization.rs
浏览文件 @
732e0578
...
...
@@ -1303,7 +1303,7 @@ impl Repr for InteriorKind {
fn
repr
(
&
self
,
_
tcx
:
&
ty
::
ctxt
)
->
String
{
match
*
self
{
InteriorField
(
NamedField
(
fld
))
=>
{
token
::
get_name
(
fld
)
.get
()
.to_str
()
.to_string
()
token
::
get_name
(
fld
)
.get
()
.to_str
()
}
InteriorField
(
PositionalField
(
i
))
=>
format!
(
"
\\
#{:?}"
,
i
),
InteriorElement
(
_
)
=>
"[]"
.to_string
(),
...
...
src/librustc/middle/trans/base.rs
浏览文件 @
732e0578
...
...
@@ -1927,7 +1927,7 @@ fn exported_name(ccx: &CrateContext, id: ast::NodeId,
_
=>
ccx
.tcx.map
.with_path
(
id
,
|
mut
path
|
{
if
attr
::
contains_name
(
attrs
,
"no_mangle"
)
{
// Don't mangle
path
.last
()
.unwrap
()
.to_str
()
.to_string
()
path
.last
()
.unwrap
()
.to_str
()
}
else
{
match
weak_lang_items
::
link_name
(
attrs
)
{
Some
(
name
)
=>
name
.get
()
.to_string
(),
...
...
src/librustc/middle/typeck/infer/to_str.rs
浏览文件 @
732e0578
...
...
@@ -79,13 +79,13 @@ fn inf_str(&self, cx: &InferCtxt) -> String {
impl
InferStr
for
IntVarValue
{
fn
inf_str
(
&
self
,
_
cx
:
&
InferCtxt
)
->
String
{
self
.to_str
()
.to_string
()
self
.to_str
()
}
}
impl
InferStr
for
ast
::
FloatTy
{
fn
inf_str
(
&
self
,
_
cx
:
&
InferCtxt
)
->
String
{
self
.to_str
()
.to_string
()
self
.to_str
()
}
}
...
...
src/librustc/util/ppaux.rs
浏览文件 @
732e0578
...
...
@@ -366,7 +366,7 @@ fn push_sig_to_str(cx: &ctxt,
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_string
()
,
ty_infer
(
infer_ty
)
=>
infer_ty
.to_str
(),
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
)
{
...
...
@@ -753,7 +753,10 @@ fn repr(&self, tcx: &ctxt) -> String {
impl
Repr
for
ty
::
Variance
{
fn
repr
(
&
self
,
_
:
&
ctxt
)
->
String
{
self
.to_str
()
.to_string
()
// The first `.to_str()` returns a &'static str (it is not an implementation
// of the ToStr trait). Because of that, we need to call `.to_str()` again
// if we want to have a `String`.
self
.to_str
()
.to_str
()
}
}
...
...
@@ -950,13 +953,13 @@ fn user_string(&self, _tcx: &ctxt) -> String {
impl
Repr
for
abi
::
Abi
{
fn
repr
(
&
self
,
_
tcx
:
&
ctxt
)
->
String
{
self
.to_str
()
.to_string
()
self
.to_str
()
}
}
impl
UserString
for
abi
::
Abi
{
fn
user_string
(
&
self
,
_
tcx
:
&
ctxt
)
->
String
{
self
.to_str
()
.to_string
()
self
.to_str
()
}
}
...
...
src/librustdoc/clean/inline.rs
浏览文件 @
732e0578
...
...
@@ -93,7 +93,7 @@ fn try_inline_def(cx: &core::DocContext,
cx
.inlined
.borrow_mut
()
.get_mut_ref
()
.insert
(
did
);
ret
.push
(
clean
::
Item
{
source
:
clean
::
Span
::
empty
(),
name
:
Some
(
fqn
.last
()
.unwrap
()
.to_str
()
.to_string
()
),
name
:
Some
(
fqn
.last
()
.unwrap
()
.to_str
()),
attrs
:
load_attrs
(
tcx
,
did
),
inner
:
inner
,
visibility
:
Some
(
ast
::
Public
),
...
...
src/librustdoc/clean/mod.rs
浏览文件 @
732e0578
...
...
@@ -526,7 +526,7 @@ fn clean(&self) -> TyParamBound {
external_path
(
"Share"
,
&
empty
)),
};
let
fqn
=
csearch
::
get_item_path
(
tcx
,
did
);
let
fqn
=
fqn
.move_iter
()
.map
(|
i
|
i
.to_str
()
.to_string
()
)
.collect
();
let
fqn
=
fqn
.move_iter
()
.map
(|
i
|
i
.to_str
())
.collect
();
cx
.external_paths
.borrow_mut
()
.get_mut_ref
()
.insert
(
did
,
(
fqn
,
TypeTrait
));
TraitBound
(
ResolvedPath
{
...
...
@@ -545,7 +545,7 @@ fn clean(&self) -> TyParamBound {
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_string
()
)
let
fqn
=
fqn
.move_iter
()
.map
(|
i
|
i
.to_str
())
.collect
::
<
Vec
<
String
>>
();
let
path
=
external_path
(
fqn
.last
()
.unwrap
()
.as_slice
(),
&
self
.substs
);
...
...
@@ -1239,7 +1239,7 @@ fn clean(&self) -> Type {
};
let
fqn
=
csearch
::
get_item_path
(
tcx
,
did
);
let
fqn
:
Vec
<
String
>
=
fqn
.move_iter
()
.map
(|
i
|
{
i
.to_str
()
.to_string
()
i
.to_str
()
})
.collect
();
let
kind
=
match
ty
::
get
(
*
self
)
.sty
{
ty
::
ty_struct
(
..
)
=>
TypeStruct
,
...
...
@@ -1617,7 +1617,7 @@ fn clean(&self) -> BareFunctionDecl {
type_params
:
Vec
::
new
(),
},
decl
:
self
.decl
.clean
(),
abi
:
self
.abi
.to_str
()
.to_string
()
,
abi
:
self
.abi
.to_str
(),
}
}
}
...
...
@@ -1891,12 +1891,12 @@ fn lit_to_str(lit: &ast::Lit) -> String {
ast
::
LitStr
(
ref
st
,
_
)
=>
st
.get
()
.to_string
(),
ast
::
LitBinary
(
ref
data
)
=>
format!
(
"{:?}"
,
data
.as_slice
()),
ast
::
LitChar
(
c
)
=>
format!
(
"'{}'"
,
c
),
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
::
LitInt
(
i
,
_
t
)
=>
i
.to_str
(),
ast
::
LitUint
(
u
,
_
t
)
=>
u
.to_str
(),
ast
::
LitIntUnsuffixed
(
i
)
=>
i
.to_str
(),
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
::
LitBool
(
b
)
=>
b
.to_str
(),
ast
::
LitNil
=>
""
.to_string
(),
}
}
...
...
src/librustdoc/html/format.rs
浏览文件 @
732e0578
...
...
@@ -401,7 +401,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
}
else
{
let
mut
m
=
decl
.bounds
.iter
()
.map
(|
s
|
s
.to_str
()
.to_string
()
);
.map
(|
s
|
s
.to_str
());
format!
(
": {}"
,
m
.collect
::
<
Vec
<
String
>>
()
.connect
(
" + "
))
...
...
src/librustdoc/html/markdown.rs
浏览文件 @
732e0578
...
...
@@ -208,7 +208,7 @@ 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_string
()
,
Some
(
s
)
=>
s
.to_lower
()
.into_str
(),
None
=>
s
.to_string
()
}
})
.collect
::
<
Vec
<
String
>>
()
.connect
(
"-"
))
.to_string
();
...
...
src/librustdoc/lib.rs
浏览文件 @
732e0578
...
...
@@ -359,7 +359,7 @@ fn json_input(input: &str) -> Result<Output, String> {
}
};
match
json
::
from_reader
(
&
mut
input
)
{
Err
(
s
)
=>
Err
(
s
.to_str
()
.to_string
()
),
Err
(
s
)
=>
Err
(
s
.to_str
()),
Ok
(
json
::
Object
(
obj
))
=>
{
let
mut
obj
=
obj
;
// Make sure the schema is what we expect
...
...
src/libsyntax/ext/source_util.rs
浏览文件 @
732e0578
...
...
@@ -125,7 +125,7 @@ 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_string
()
;
let
filename
=
file
.display
()
.to_str
();
let
interned
=
token
::
intern_and_get_ident
(
src
);
cx
.codemap
()
.new_filemap
(
filename
,
src
.to_string
());
...
...
src/libsyntax/ext/tt/macro_rules.rs
浏览文件 @
732e0578
...
...
@@ -252,7 +252,7 @@ fn ms(m: Matcher_) -> Matcher {
box
MacroRulesDefiner
{
def
:
RefCell
::
new
(
Some
(
MacroDef
{
name
:
token
::
get_ident
(
name
)
.to_str
()
.to_string
()
,
name
:
token
::
get_ident
(
name
)
.to_str
(),
ext
:
NormalTT
(
exp
,
Some
(
sp
))
}))
}
as
Box
<
MacResult
>
...
...
src/libsyntax/parse/token.rs
浏览文件 @
732e0578
...
...
@@ -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_string
()
}
LIT_INT_UNSUFFIXED
(
i
)
=>
{
(
i
as
u64
)
.to_str
()
}
LIT_FLOAT
(
s
,
t
)
=>
{
let
mut
body
=
String
::
from_str
(
get_ident
(
s
)
.get
());
if
body
.as_slice
()
.ends_with
(
"."
)
{
...
...
src/libtest/lib.rs
浏览文件 @
732e0578
...
...
@@ -1502,7 +1502,7 @@ pub fn filter_for_ignored_option() {
let
filtered
=
filter_tests
(
&
opts
,
tests
);
assert_eq!
(
filtered
.len
(),
1
);
assert_eq!
(
filtered
.get
(
0
)
.desc.name
.to_str
()
.to_string
()
,
assert_eq!
(
filtered
.get
(
0
)
.desc.name
.to_str
(),
"1"
.to_string
());
assert
!
(
filtered
.get
(
0
)
.desc.ignore
==
false
);
}
...
...
@@ -1553,7 +1553,7 @@ fn testfn() { }
"test::sort_tests"
.to_string
());
for
(
a
,
b
)
in
expected
.iter
()
.zip
(
filtered
.iter
())
{
assert
!
(
*
a
==
b
.desc.name
.to_str
()
.to_string
()
);
assert
!
(
*
a
==
b
.desc.name
.to_str
());
}
}
...
...
src/libtime/lib.rs
浏览文件 @
732e0578
...
...
@@ -1020,7 +1020,7 @@ fn parse_type(ch: char, tm: &Tm) -> String {
'U'
=>
format!
(
"{: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_string
()
(
if
i
==
0
{
7
}
else
{
i
})
.to_str
()
}
'V'
=>
iso_week
(
'V'
,
tm
),
'v'
=>
{
...
...
@@ -1033,8 +1033,8 @@ fn parse_type(ch: char, tm: &Tm) -> String {
format!
(
"{:02d}"
,
(
tm
.tm_yday
-
(
tm
.tm_wday
-
1
+
7
)
%
7
+
7
)
/
7
)
}
'w'
=>
(
tm
.tm_wday
as
int
)
.to_str
()
.to_string
()
,
'Y'
=>
(
tm
.tm_year
as
int
+
1900
)
.to_str
()
.to_string
()
,
'w'
=>
(
tm
.tm_wday
as
int
)
.to_str
(),
'Y'
=>
(
tm
.tm_year
as
int
+
1900
)
.to_str
(),
'y'
=>
format!
(
"{:02d}"
,
(
tm
.tm_year
as
int
+
1900
)
%
100
),
'Z'
=>
""
.to_string
(),
// FIXME(pcwalton): Implement this.
'z'
=>
{
...
...
src/liburl/lib.rs
浏览文件 @
732e0578
...
...
@@ -524,7 +524,7 @@ fn get_authority(rawurl: &str) ->
Result
<
(
Option
<
UserInfo
>
,
String
,
Option
<
String
>
,
String
),
String
>
{
if
!
rawurl
.starts_with
(
"//"
)
{
// there is no authority.
return
Ok
((
None
,
""
.to_string
(),
None
,
rawurl
.to_str
()
.to_string
()
));
return
Ok
((
None
,
""
.to_string
(),
None
,
rawurl
.to_str
()));
}
enum
State
{
...
...
src/test/bench/core-set.rs
浏览文件 @
732e0578
...
...
@@ -90,11 +90,11 @@ pub fn bench_str<T:MutableSet<String>,
let
mut
set
=
f
();
timed
(
&
mut
self
.sequential_strings
,
||
{
for
i
in
range
(
0u
,
num_keys
)
{
set
.insert
(
i
.to_str
()
.to_string
()
);
set
.insert
(
i
.to_str
());
}
for
i
in
range
(
0u
,
num_keys
)
{
assert
!
(
set
.contains
(
&
i
.to_str
()
.to_string
()
));
assert
!
(
set
.contains
(
&
i
.to_str
()));
}
})
}
...
...
@@ -103,7 +103,7 @@ pub fn bench_str<T:MutableSet<String>,
let
mut
set
=
f
();
timed
(
&
mut
self
.random_strings
,
||
{
for
_
in
range
(
0
,
num_keys
)
{
let
s
=
rng
.gen
::
<
uint
>
()
.to_str
()
.to_string
()
;
let
s
=
rng
.gen
::
<
uint
>
()
.to_str
();
set
.insert
(
s
);
}
})
...
...
@@ -112,11 +112,11 @@ pub fn bench_str<T:MutableSet<String>,
{
let
mut
set
=
f
();
for
i
in
range
(
0u
,
num_keys
)
{
set
.insert
(
i
.to_str
()
.to_string
()
);
set
.insert
(
i
.to_str
());
}
timed
(
&
mut
self
.delete_strings
,
||
{
for
i
in
range
(
0u
,
num_keys
)
{
assert
!
(
set
.remove
(
&
i
.to_str
()
.to_string
()
));
assert
!
(
set
.remove
(
&
i
.to_str
()));
}
})
}
...
...
src/test/run-pass/monad.rs
浏览文件 @
732e0578
...
...
@@ -38,7 +38,7 @@ fn bind<B>(&self, f: |&A| -> Option<B>) -> Option<B> {
}
fn
transform
(
x
:
Option
<
int
>
)
->
Option
<
String
>
{
x
.bind
(|
n
|
Some
(
*
n
+
1
)
)
.bind
(|
n
|
Some
(
n
.to_str
()
.to_string
()
)
)
x
.bind
(|
n
|
Some
(
*
n
+
1
)
)
.bind
(|
n
|
Some
(
n
.to_str
())
)
}
pub
fn
main
()
{
...
...
src/test/run-pass/static-impl.rs
浏览文件 @
732e0578
...
...
@@ -31,7 +31,7 @@ trait uint_utils {
impl
uint_utils
for
uint
{
fn
str
(
&
self
)
->
String
{
self
.to_str
()
.to_string
()
self
.to_str
()
}
fn
multi
(
&
self
,
f
:
|
uint
|)
{
let
mut
c
=
0u
;
...
...
src/test/run-pass/trait-cast.rs
浏览文件 @
732e0578
...
...
@@ -36,7 +36,7 @@ fn to_str_(&self) -> String {
impl
to_str
for
int
{
fn
to_str_
(
&
self
)
->
String
{
self
.to_str
()
.to_string
()
self
.to_str
()
}
}
...
...
src/test/run-pass/trait-to-str.rs
浏览文件 @
732e0578
...
...
@@ -15,7 +15,7 @@ trait to_str {
}
impl
to_str
for
int
{
fn
to_string
(
&
self
)
->
String
{
self
.to_str
()
.to_string
()
}
fn
to_string
(
&
self
)
->
String
{
self
.to_str
()
}
}
impl
<
T
:
to_str
>
to_str
for
Vec
<
T
>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录