Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
49684850
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,发现更多精彩内容 >>
提交
49684850
编写于
1月 19, 2015
作者:
J
Jorge Aparicio
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove unnecessary parentheses from range notation
上级
43f2c199
变更
38
隐藏空白更改
内联
并排
Showing
38 changed file
with
70 addition
and
70 deletion
+70
-70
src/libcollections/bit.rs
src/libcollections/bit.rs
+1
-1
src/libcollections/vec.rs
src/libcollections/vec.rs
+2
-2
src/libcore/slice.rs
src/libcore/slice.rs
+4
-4
src/libcore/str/mod.rs
src/libcore/str/mod.rs
+1
-1
src/libcoretest/iter.rs
src/libcoretest/iter.rs
+1
-1
src/libgetopts/lib.rs
src/libgetopts/lib.rs
+1
-1
src/libregex/parse.rs
src/libregex/parse.rs
+1
-1
src/librustc/metadata/decoder.rs
src/librustc/metadata/decoder.rs
+1
-1
src/librustc/metadata/tydecode.rs
src/librustc/metadata/tydecode.rs
+1
-1
src/librustc/middle/check_match.rs
src/librustc/middle/check_match.rs
+1
-1
src/librustc/util/ppaux.rs
src/librustc/util/ppaux.rs
+3
-3
src/librustc_back/sha2.rs
src/librustc_back/sha2.rs
+1
-1
src/librustc_resolve/lib.rs
src/librustc_resolve/lib.rs
+3
-3
src/librustc_trans/back/link.rs
src/librustc_trans/back/link.rs
+1
-1
src/librustc_trans/back/lto.rs
src/librustc_trans/back/lto.rs
+2
-2
src/librustc_trans/save/mod.rs
src/librustc_trans/save/mod.rs
+1
-1
src/librustc_trans/trans/_match.rs
src/librustc_trans/trans/_match.rs
+2
-2
src/librustc_trans/trans/cabi_x86_64.rs
src/librustc_trans/trans/cabi_x86_64.rs
+1
-1
src/librustc_trans/trans/debuginfo.rs
src/librustc_trans/trans/debuginfo.rs
+2
-2
src/librustdoc/html/format.rs
src/librustdoc/html/format.rs
+1
-1
src/librustdoc/html/render.rs
src/librustdoc/html/render.rs
+6
-6
src/libserialize/json.rs
src/libserialize/json.rs
+2
-2
src/libstd/io/buffered.rs
src/libstd/io/buffered.rs
+2
-2
src/libstd/io/mem.rs
src/libstd/io/mem.rs
+2
-2
src/libstd/io/mod.rs
src/libstd/io/mod.rs
+1
-1
src/libstd/path/mod.rs
src/libstd/path/mod.rs
+1
-1
src/libstd/path/posix.rs
src/libstd/path/posix.rs
+5
-5
src/libstd/path/windows.rs
src/libstd/path/windows.rs
+7
-7
src/libstd/sys/windows/backtrace.rs
src/libstd/sys/windows/backtrace.rs
+1
-1
src/libsyntax/ast_map/mod.rs
src/libsyntax/ast_map/mod.rs
+1
-1
src/libsyntax/diagnostic.rs
src/libsyntax/diagnostic.rs
+1
-1
src/libsyntax/parse/lexer/comments.rs
src/libsyntax/parse/lexer/comments.rs
+2
-2
src/libterm/terminfo/parser/compiled.rs
src/libterm/terminfo/parser/compiled.rs
+2
-2
src/test/bench/shootout-fannkuch-redux.rs
src/test/bench/shootout-fannkuch-redux.rs
+1
-1
src/test/bench/shootout-fasta.rs
src/test/bench/shootout-fasta.rs
+1
-1
src/test/bench/shootout-k-nucleotide-pipes.rs
src/test/bench/shootout-k-nucleotide-pipes.rs
+2
-2
src/test/compile-fail/range-1.rs
src/test/compile-fail/range-1.rs
+1
-1
src/test/compile-fail/range-2.rs
src/test/compile-fail/range-2.rs
+1
-1
未找到文件。
src/libcollections/bit.rs
浏览文件 @
49684850
...
...
@@ -330,7 +330,7 @@ pub fn from_bytes(bytes: &[u8]) -> Bitv {
if
extra_bytes
>
0
{
let
mut
last_word
=
0u32
;
for
(
i
,
&
byte
)
in
bytes
[
(
complete_words
*
4
)
..
]
.iter
()
.enumerate
()
{
for
(
i
,
&
byte
)
in
bytes
[
complete_words
*
4
..
]
.iter
()
.enumerate
()
{
last_word
|
=
(
reverse_bits
(
byte
)
as
u32
)
<<
(
i
*
8
);
}
bitv
.storage
.push
(
last_word
);
...
...
src/libcollections/vec.rs
浏览文件 @
49684850
...
...
@@ -2158,7 +2158,7 @@ fn test_index_out_of_bounds() {
#[should_fail]
fn
test_slice_out_of_bounds_1
()
{
let
x
:
Vec
<
int
>
=
vec!
[
1
,
2
,
3
,
4
,
5
];
&
x
[
(
-
1
)
..
];
&
x
[
-
1
..
];
}
#[test]
...
...
@@ -2172,7 +2172,7 @@ fn test_slice_out_of_bounds_2() {
#[should_fail]
fn
test_slice_out_of_bounds_3
()
{
let
x
:
Vec
<
int
>
=
vec!
[
1
,
2
,
3
,
4
,
5
];
&
x
[
(
-
1
)
..
4
];
&
x
[
-
1
..
4
];
}
#[test]
...
...
src/libcore/slice.rs
浏览文件 @
49684850
...
...
@@ -240,7 +240,7 @@ fn tail(&self) -> &[T] { &self[1..] }
#[inline]
fn
init
(
&
self
)
->
&
[
T
]
{
&
self
[
..
(
self
.len
()
-
1
)
]
&
self
[
..
self
.len
()
-
1
]
}
#[inline]
...
...
@@ -449,7 +449,7 @@ fn starts_with(&self, needle: &[T]) -> bool where T: PartialEq {
#[inline]
fn
ends_with
(
&
self
,
needle
:
&
[
T
])
->
bool
where
T
:
PartialEq
{
let
(
m
,
n
)
=
(
self
.len
(),
needle
.len
());
m
>=
n
&&
needle
==
&
self
[
(
m
-
n
)
..
]
m
>=
n
&&
needle
==
&
self
[
m
-
n
..
]
}
#[unstable]
...
...
@@ -973,7 +973,7 @@ fn next(&mut self) -> Option<&'a [T]> {
None
=>
self
.finish
(),
Some
(
idx
)
=>
{
let
ret
=
Some
(
&
self
.v
[
..
idx
]);
self
.v
=
&
self
.v
[
(
idx
+
1
)
..
];
self
.v
=
&
self
.v
[
idx
+
1
..
];
ret
}
}
...
...
@@ -998,7 +998,7 @@ fn next_back(&mut self) -> Option<&'a [T]> {
match
self
.v
.iter
()
.rposition
(|
x
|
(
self
.pred
)(
x
))
{
None
=>
self
.finish
(),
Some
(
idx
)
=>
{
let
ret
=
Some
(
&
self
.v
[
(
idx
+
1
)
..
]);
let
ret
=
Some
(
&
self
.v
[
idx
+
1
..
]);
self
.v
=
&
self
.v
[
..
idx
];
ret
}
...
...
src/libcore/str/mod.rs
浏览文件 @
49684850
...
...
@@ -1418,7 +1418,7 @@ fn starts_with(&self, needle: &str) -> bool {
#[inline]
fn
ends_with
(
&
self
,
needle
:
&
str
)
->
bool
{
let
(
m
,
n
)
=
(
self
.len
(),
needle
.len
());
m
>=
n
&&
needle
.as_bytes
()
==
&
self
.as_bytes
()[
(
m
-
n
)
..
]
m
>=
n
&&
needle
.as_bytes
()
==
&
self
.as_bytes
()[
m
-
n
..
]
}
#[inline]
...
...
src/libcoretest/iter.rs
浏览文件 @
49684850
...
...
@@ -585,7 +585,7 @@ fn check_randacc_iter<A, T>(a: T, len: uint) where
fn
test_double_ended_flat_map
()
{
let
u
=
[
0u
,
1
];
let
v
=
[
5u
,
6
,
7
,
8
];
let
mut
it
=
u
.iter
()
.flat_map
(|
x
|
v
[
(
*
x
)
..
v
.len
()]
.iter
());
let
mut
it
=
u
.iter
()
.flat_map
(|
x
|
v
[
*
x
..
v
.len
()]
.iter
());
assert_eq!
(
it
.next_back
()
.unwrap
(),
&
8
);
assert_eq!
(
it
.next
()
.unwrap
(),
&
5
);
assert_eq!
(
it
.next_back
()
.unwrap
(),
&
7
);
...
...
src/libgetopts/lib.rs
浏览文件 @
49684850
...
...
@@ -893,7 +893,7 @@ fn each_split_within<F>(ss: &str, lim: uint, mut it: F) -> bool where
(
B
,
Cr
,
UnderLim
)
=>
{
B
}
(
B
,
Cr
,
OverLim
)
if
(
i
-
last_start
+
1
)
>
lim
=>
panic!
(
"word starting with {} longer than limit!"
,
&
ss
[
last_start
..
(
i
+
1
)
]),
&
ss
[
last_start
..
i
+
1
]),
(
B
,
Cr
,
OverLim
)
=>
{
*
cont
=
it
(
&
ss
[
slice_start
..
last_end
]);
slice_start
=
last_start
;
...
...
src/libregex/parse.rs
浏览文件 @
49684850
...
...
@@ -518,7 +518,7 @@ fn parse_counted(&mut self) -> Result<(), Error> {
};
self
.chari
=
closer
;
let
greed
=
try!
(
self
.get_next_greedy
());
let
inner
=
self
.chars
[
(
start
+
1
)
..
closer
]
.iter
()
.cloned
()
let
inner
=
self
.chars
[
start
+
1
..
closer
]
.iter
()
.cloned
()
.collect
::
<
String
>
();
// Parse the min and max values from the regex.
...
...
src/librustc/metadata/decoder.rs
浏览文件 @
49684850
...
...
@@ -74,7 +74,7 @@ fn lookup_hash<'a, F>(d: rbml::Doc<'a>, mut eq_fn: F, hash: u64) -> Option<rbml:
let
mut
ret
=
None
;
reader
::
tagged_docs
(
tagged_doc
.doc
,
belt
,
|
elt
|
{
let
pos
=
u64_from_be_bytes
(
elt
.data
,
elt
.start
,
4
)
as
uint
;
if
eq_fn
(
&
elt
.data
[
(
elt
.start
+
4
)
..
elt
.end
])
{
if
eq_fn
(
&
elt
.data
[
elt
.start
+
4
..
elt
.end
])
{
ret
=
Some
(
reader
::
doc_at
(
d
.data
,
pos
)
.unwrap
()
.doc
);
false
}
else
{
...
...
src/librustc/metadata/tydecode.rs
浏览文件 @
49684850
...
...
@@ -734,7 +734,7 @@ pub fn parse_def_id(buf: &[u8]) -> ast::DefId {
}
let
crate_part
=
&
buf
[
0u
..
colon_idx
];
let
def_part
=
&
buf
[
(
colon_idx
+
1u
)
..
len
];
let
def_part
=
&
buf
[
colon_idx
+
1u
..
len
];
let
crate_num
=
match
str
::
from_utf8
(
crate_part
)
.ok
()
.and_then
(|
s
|
s
.parse
::
<
uint
>
())
{
Some
(
cn
)
=>
cn
as
ast
::
CrateNum
,
...
...
src/librustc/middle/check_match.rs
浏览文件 @
49684850
...
...
@@ -927,7 +927,7 @@ pub fn specialize<'a>(cx: &MatchCheckCtxt, r: &[&'a Pat],
};
head
.map
(|
mut
head
|
{
head
.push_all
(
&
r
[
..
col
]);
head
.push_all
(
&
r
[
(
col
+
1
)
..
]);
head
.push_all
(
&
r
[
col
+
1
..
]);
head
})
}
...
...
src/librustc/util/ppaux.rs
浏览文件 @
49684850
...
...
@@ -542,7 +542,7 @@ pub fn parameterized<'tcx>(cx: &ctxt<'tcx>,
0
};
for
t
in
tps
[
..
(
tps
.len
()
-
num_defaults
)
]
.iter
()
{
for
t
in
tps
[
..
tps
.len
()
-
num_defaults
]
.iter
()
{
strs
.push
(
ty_to_string
(
cx
,
*
t
))
}
...
...
@@ -550,9 +550,9 @@ pub fn parameterized<'tcx>(cx: &ctxt<'tcx>,
format!
(
"{}({}){}"
,
base
,
if
strs
[
0
]
.starts_with
(
"("
)
&&
strs
[
0
]
.ends_with
(
",)"
)
{
&
strs
[
0
][
1
..
(
strs
[
0
]
.len
()
-
2
)
]
// Remove '(' and ',)'
&
strs
[
0
][
1
..
strs
[
0
]
.len
()
-
2
]
// Remove '(' and ',)'
}
else
if
strs
[
0
]
.starts_with
(
"("
)
&&
strs
[
0
]
.ends_with
(
")"
)
{
&
strs
[
0
][
1
..
(
strs
[
0
]
.len
()
-
1
)
]
// Remove '(' and ')'
&
strs
[
0
][
1
..
strs
[
0
]
.len
()
-
1
]
// Remove '(' and ')'
}
else
{
&
strs
[
0
][]
},
...
...
src/librustc_back/sha2.rs
浏览文件 @
49684850
...
...
@@ -156,7 +156,7 @@ fn input<F>(&mut self, input: &[u8], mut func: F) where
// While we have at least a full buffer size chunk's worth of data, process that data
// without copying it into the buffer
while
input
.len
()
-
i
>=
size
{
func
(
&
input
[
i
..
(
i
+
size
)
]);
func
(
&
input
[
i
..
i
+
size
]);
i
+=
size
;
}
...
...
src/librustc_resolve/lib.rs
浏览文件 @
49684850
...
...
@@ -2082,8 +2082,8 @@ fn resolve_module_path(&mut self,
let
msg
=
format!
(
"Could not find `{}` in `{}`"
,
// idx +- 1 to account for the
// colons on either side
&
mpath
[
(
idx
+
1
)
..
],
&
mpath
[
..
(
idx
-
1
)
]);
&
mpath
[
idx
+
1
..
],
&
mpath
[
..
idx
-
1
]);
return
Failed
(
Some
((
span
,
msg
)));
},
None
=>
{
...
...
@@ -2756,7 +2756,7 @@ fn search_ribs(&self,
for
(
i
,
rib
)
in
ribs
.iter
()
.enumerate
()
.rev
()
{
match
rib
.bindings
.get
(
&
name
)
.cloned
()
{
Some
(
def_like
)
=>
{
return
self
.upvarify
(
&
ribs
[
(
i
+
1
)
..
],
def_like
,
span
);
return
self
.upvarify
(
&
ribs
[
i
+
1
..
],
def_like
,
span
);
}
None
=>
{
// Continue.
...
...
src/librustc_trans/back/link.rs
浏览文件 @
49684850
...
...
@@ -1183,7 +1183,7 @@ fn add_static_crate(cmd: &mut Command, sess: &Session, tmpdir: &Path,
// against the archive.
if
sess
.lto
()
{
let
name
=
cratepath
.filename_str
()
.unwrap
();
let
name
=
&
name
[
3
..
(
name
.len
()
-
5
)
];
// chop off lib/.rlib
let
name
=
&
name
[
3
..
name
.len
()
-
5
];
// chop off lib/.rlib
time
(
sess
.time_passes
(),
&
format!
(
"altering {}.rlib"
,
name
)[],
(),
|()|
{
...
...
src/librustc_trans/back/lto.rs
浏览文件 @
49684850
...
...
@@ -60,7 +60,7 @@ pub fn run(sess: &session::Session, llmod: ModuleRef,
let
archive
=
ArchiveRO
::
open
(
&
path
)
.expect
(
"wanted an rlib"
);
let
file
=
path
.filename_str
()
.unwrap
();
let
file
=
&
file
[
3
..
(
file
.len
()
-
5
)
];
// chop off lib/.rlib
let
file
=
&
file
[
3
..
file
.len
()
-
5
];
// chop off lib/.rlib
debug!
(
"reading {}"
,
file
);
for
i
in
iter
::
count
(
0u
,
1
)
{
let
bc_encoded
=
time
(
sess
.time_passes
(),
...
...
@@ -201,7 +201,7 @@ fn extract_compressed_bytecode_size_v1(bc: &[u8]) -> u64 {
}
fn
read_from_le_bytes
<
T
:
Int
>
(
bytes
:
&
[
u8
],
position_in_bytes
:
uint
)
->
T
{
let
byte_data
=
&
bytes
[
position_in_bytes
..
(
position_in_bytes
+
mem
::
size_of
::
<
T
>
()
)];
let
byte_data
=
&
bytes
[
position_in_bytes
..
position_in_bytes
+
mem
::
size_of
::
<
T
>
(
)];
let
data
=
unsafe
{
*
(
byte_data
.as_ptr
()
as
*
const
T
)
};
...
...
src/librustc_trans/save/mod.rs
浏览文件 @
49684850
...
...
@@ -186,7 +186,7 @@ fn write_sub_path_trait_truncated(&mut self, path: &ast::Path) {
if
len
<=
2
{
return
;
}
let
sub_paths
=
&
sub_paths
[
..
(
len
-
2
)
];
let
sub_paths
=
&
sub_paths
[
..
len
-
2
];
for
&
(
ref
span
,
ref
qualname
)
in
sub_paths
.iter
()
{
self
.fmt
.sub_mod_ref_str
(
path
.span
,
*
span
,
...
...
src/librustc_trans/trans/_match.rs
浏览文件 @
49684850
...
...
@@ -472,7 +472,7 @@ fn enter_default<'a, 'p, 'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
enter_match
(
bcx
,
dm
,
m
,
col
,
val
,
|
pats
|
{
if
pat_is_binding_or_wild
(
dm
,
&*
pats
[
col
])
{
let
mut
r
=
pats
[
..
col
]
.to_vec
();
r
.push_all
(
&
pats
[
(
col
+
1
)
..
]);
r
.push_all
(
&
pats
[
col
+
1
..
]);
Some
(
r
)
}
else
{
None
...
...
@@ -983,7 +983,7 @@ fn compile_submatch_continue<'a, 'p, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
let
dm
=
&
tcx
.def_map
;
let
mut
vals_left
=
vals
[
0u
..
col
]
.to_vec
();
vals_left
.push_all
(
&
vals
[
(
col
+
1u
)
..
]);
vals_left
.push_all
(
&
vals
[
col
+
1u
..
]);
let
ccx
=
bcx
.fcx.ccx
;
// Find a real id (we're adding placeholder wildcard patterns, but
...
...
src/librustc_trans/trans/cabi_x86_64.rs
浏览文件 @
49684850
...
...
@@ -361,7 +361,7 @@ fn llvec_len(cls: &[RegClass]) -> uint {
}
_
=>
unreachable!
(),
};
let
vec_len
=
llvec_len
(
&
cls
[
(
i
+
1u
)
..
]);
let
vec_len
=
llvec_len
(
&
cls
[
i
+
1u
..
]);
let
vec_ty
=
Type
::
vector
(
&
elt_ty
,
vec_len
as
u64
*
elts_per_word
);
tys
.push
(
vec_ty
);
i
+=
vec_len
;
...
...
src/librustc_trans/trans/debuginfo.rs
浏览文件 @
49684850
...
...
@@ -1163,7 +1163,7 @@ pub fn get_cleanup_debug_loc_for_ast_node<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
if
let
Some
(
code_snippet
)
=
code_snippet
{
let
bytes
=
code_snippet
.as_bytes
();
if
bytes
.len
()
>
0
&&
&
bytes
[
(
bytes
.len
()
-
1
)
..
]
==
b
"}"
{
if
bytes
.len
()
>
0
&&
&
bytes
[
bytes
.len
()
-
1
..
]
==
b
"}"
{
cleanup_span
=
Span
{
lo
:
node_span
.hi
-
codemap
::
BytePos
(
1
),
hi
:
node_span
.hi
,
...
...
@@ -1752,7 +1752,7 @@ fn file_metadata(cx: &CrateContext, full_path: &str) -> DIFile {
let
work_dir
=
cx
.sess
()
.working_dir
.as_str
()
.unwrap
();
let
file_name
=
if
full_path
.starts_with
(
work_dir
)
{
&
full_path
[
(
work_dir
.len
()
+
1u
)
..
full_path
.len
()]
&
full_path
[
work_dir
.len
()
+
1u
..
full_path
.len
()]
}
else
{
full_path
};
...
...
src/librustdoc/html/format.rs
浏览文件 @
49684850
...
...
@@ -358,7 +358,7 @@ fn path<F, G>(w: &mut fmt::Formatter,
// This is a documented path, link to it!
Some
((
ref
fqp
,
shortty
))
if
abs_root
.is_some
()
=>
{
let
mut
url
=
String
::
from_str
(
abs_root
.unwrap
()
.as_slice
());
let
to_link
=
&
fqp
[
..
(
fqp
.len
()
-
1
)
];
let
to_link
=
&
fqp
[
..
fqp
.len
()
-
1
];
for
component
in
to_link
.iter
()
{
url
.push_str
(
component
.as_slice
());
url
.push_str
(
"/"
);
...
...
src/librustdoc/html/render.rs
浏览文件 @
49684850
...
...
@@ -404,7 +404,7 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> io::IoResult<String>
search_index
.push
(
IndexItem
{
ty
:
shortty
(
item
),
name
:
item
.name
.clone
()
.unwrap
(),
path
:
fqp
[
..
(
fqp
.len
()
-
1
)
]
.connect
(
"::"
),
path
:
fqp
[
..
fqp
.len
()
-
1
]
.connect
(
"::"
),
desc
:
shorter
(
item
.doc_value
())
.to_string
(),
parent
:
Some
(
did
),
});
...
...
@@ -559,7 +559,7 @@ fn collect(path: &Path, krate: &str,
};
let
mut
mydst
=
dst
.clone
();
for
part
in
remote_path
[
..
(
remote_path
.len
()
-
1
)
]
.iter
()
{
for
part
in
remote_path
[
..
remote_path
.len
()
-
1
]
.iter
()
{
mydst
.push
(
part
.as_slice
());
try!
(
mkdir
(
&
mydst
));
}
...
...
@@ -842,7 +842,7 @@ fn fold_item(&mut self, item: clean::Item) -> Option<clean::Item> {
clean
::
StructFieldItem
(
..
)
|
clean
::
VariantItem
(
..
)
=>
{
((
Some
(
*
self
.parent_stack
.last
()
.unwrap
()),
Some
(
&
self
.stack
[
..
(
self
.stack
.len
()
-
1
)
])),
Some
(
&
self
.stack
[
..
self
.stack
.len
()
-
1
])),
false
)
}
clean
::
MethodItem
(
..
)
=>
{
...
...
@@ -853,13 +853,13 @@ fn fold_item(&mut self, item: clean::Item) -> Option<clean::Item> {
let
did
=
*
last
;
let
path
=
match
self
.paths
.get
(
&
did
)
{
Some
(
&
(
_
,
ItemType
::
Trait
))
=>
Some
(
&
self
.stack
[
..
(
self
.stack
.len
()
-
1
)
]),
Some
(
&
self
.stack
[
..
self
.stack
.len
()
-
1
]),
// The current stack not necessarily has correlation for
// where the type was defined. On the other hand,
// `paths` always has the right information if present.
Some
(
&
(
ref
fqp
,
ItemType
::
Struct
))
|
Some
(
&
(
ref
fqp
,
ItemType
::
Enum
))
=>
Some
(
&
fqp
[
..
(
fqp
.len
()
-
1
)
]),
Some
(
&
fqp
[
..
fqp
.len
()
-
1
]),
Some
(
..
)
=>
Some
(
self
.stack
.as_slice
()),
None
=>
None
};
...
...
@@ -1185,7 +1185,7 @@ fn render(w: io::File, cx: &Context, it: &clean::Item,
.collect
::
<
String
>
();
match
cache
()
.paths
.get
(
&
it
.def_id
)
{
Some
(
&
(
ref
names
,
_
))
=>
{
for
name
in
(
&
names
[
..
(
names
.len
()
-
1
)
])
.iter
()
{
for
name
in
(
&
names
[
..
names
.len
()
-
1
])
.iter
()
{
url
.push_str
(
name
.as_slice
());
url
.push_str
(
"/"
);
}
...
...
src/libserialize/json.rs
浏览文件 @
49684850
...
...
@@ -1222,7 +1222,7 @@ pub fn get<'l>(&'l self, idx: uint) -> StackElement<'l> {
InternalIndex
(
i
)
=>
StackElement
::
Index
(
i
),
InternalKey
(
start
,
size
)
=>
{
StackElement
::
Key
(
str
::
from_utf8
(
&
self
.str_buffer
[
(
start
as
uint
)
..
(
start
as
uint
+
size
as
uint
)
])
&
self
.str_buffer
[
start
as
uint
..
start
as
uint
+
size
as
uint
])
.unwrap
())
}
}
...
...
@@ -1265,7 +1265,7 @@ pub fn top<'l>(&'l self) -> Option<StackElement<'l>> {
Some
(
&
InternalIndex
(
i
))
=>
Some
(
StackElement
::
Index
(
i
)),
Some
(
&
InternalKey
(
start
,
size
))
=>
{
Some
(
StackElement
::
Key
(
str
::
from_utf8
(
&
self
.str_buffer
[
(
start
as
uint
)
..
(
start
+
size
)
as
uint
]
&
self
.str_buffer
[
start
as
uint
..
(
start
+
size
)
as
uint
]
)
.unwrap
()))
}
}
...
...
src/libstd/io/buffered.rs
浏览文件 @
49684850
...
...
@@ -281,9 +281,9 @@ impl<W: Writer> Writer for LineBufferedWriter<W> {
fn
write
(
&
mut
self
,
buf
:
&
[
u8
])
->
IoResult
<
()
>
{
match
buf
.iter
()
.rposition
(|
&
b
|
b
==
b
'\n'
)
{
Some
(
i
)
=>
{
try!
(
self
.inner
.write
(
&
buf
[
..
(
i
+
1
)
]));
try!
(
self
.inner
.write
(
&
buf
[
..
i
+
1
]));
try!
(
self
.inner
.flush
());
try!
(
self
.inner
.write
(
&
buf
[
(
i
+
1
)
..
]));
try!
(
self
.inner
.write
(
&
buf
[
i
+
1
..
]));
Ok
(())
}
None
=>
self
.inner
.write
(
buf
),
...
...
src/libstd/io/mem.rs
浏览文件 @
49684850
...
...
@@ -159,7 +159,7 @@ fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
let
write_len
=
min
(
buf
.len
(),
self
.buf
.len
()
-
self
.pos
);
{
let
input
=
&
self
.buf
[
self
.pos
..
(
self
.pos
+
write_len
)
];
let
input
=
&
self
.buf
[
self
.pos
..
self
.pos
+
write_len
];
let
output
=
buf
.slice_to_mut
(
write_len
);
assert_eq!
(
input
.len
(),
output
.len
());
slice
::
bytes
::
copy_memory
(
output
,
input
);
...
...
@@ -349,7 +349,7 @@ fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
let
write_len
=
min
(
buf
.len
(),
self
.buf
.len
()
-
self
.pos
);
{
let
input
=
&
self
.buf
[
self
.pos
..
(
self
.pos
+
write_len
)
];
let
input
=
&
self
.buf
[
self
.pos
..
self
.pos
+
write_len
];
let
output
=
buf
.slice_to_mut
(
write_len
);
assert_eq!
(
input
.len
(),
output
.len
());
slice
::
bytes
::
copy_memory
(
output
,
input
);
...
...
src/libstd/io/mod.rs
浏览文件 @
49684850
...
...
@@ -1449,7 +1449,7 @@ fn read_until(&mut self, byte: u8) -> IoResult<Vec<u8>> {
};
match
available
.iter
()
.position
(|
&
b
|
b
==
byte
)
{
Some
(
i
)
=>
{
res
.push_all
(
&
available
[
..
(
i
+
1
)
]);
res
.push_all
(
&
available
[
..
i
+
1
]);
used
=
i
+
1
;
break
}
...
...
src/libstd/path/mod.rs
浏览文件 @
49684850
...
...
@@ -399,7 +399,7 @@ fn extension<'a>(&'a self) -> Option<&'a [u8]> {
match
name
.rposition_elem
(
&
dot
)
{
None
|
Some
(
0
)
=>
None
,
Some
(
1
)
if
name
==
b
".."
=>
None
,
Some
(
pos
)
=>
Some
(
&
name
[
(
pos
+
1
)
..
])
Some
(
pos
)
=>
Some
(
&
name
[
pos
+
1
..
])
}
}
}
...
...
src/libstd/path/posix.rs
浏览文件 @
49684850
...
...
@@ -126,7 +126,7 @@ unsafe fn set_filename_unchecked<T: BytesContainer>(&mut self, filename: T) {
None
=>
{
self
.repr
=
Path
::
normalize
(
filename
);
}
Some
(
idx
)
if
&
self
.repr
[
(
idx
+
1
)
..
]
==
b
".."
=>
{
Some
(
idx
)
if
&
self
.repr
[
idx
+
1
..
]
==
b
".."
=>
{
let
mut
v
=
Vec
::
with_capacity
(
self
.repr
.len
()
+
1
+
filename
.len
());
v
.push_all
(
self
.repr
.as_slice
());
v
.push
(
SEP_BYTE
);
...
...
@@ -136,7 +136,7 @@ unsafe fn set_filename_unchecked<T: BytesContainer>(&mut self, filename: T) {
}
Some
(
idx
)
=>
{
let
mut
v
=
Vec
::
with_capacity
(
idx
+
1
+
filename
.len
());
v
.push_all
(
&
self
.repr
[
..
(
idx
+
1
)
]);
v
.push_all
(
&
self
.repr
[
..
idx
+
1
]);
v
.push_all
(
filename
);
// FIXME: this is slow
self
.repr
=
Path
::
normalize
(
v
.as_slice
());
...
...
@@ -178,7 +178,7 @@ fn dirname<'a>(&'a self) -> &'a [u8] {
None
if
b
".."
==
self
.repr
=>
self
.repr
.as_slice
(),
None
=>
dot_static
,
Some
(
0
)
=>
&
self
.repr
[
..
1
],
Some
(
idx
)
if
&
self
.repr
[
(
idx
+
1
)
..
]
==
b
".."
=>
self
.repr
.as_slice
(),
Some
(
idx
)
if
&
self
.repr
[
idx
+
1
..
]
==
b
".."
=>
self
.repr
.as_slice
(),
Some
(
idx
)
=>
&
self
.repr
[
..
idx
]
}
}
...
...
@@ -188,9 +188,9 @@ fn filename<'a>(&'a self) -> Option<&'a [u8]> {
None
if
b
"."
==
self
.repr
||
b
".."
==
self
.repr
=>
None
,
None
=>
Some
(
self
.repr
.as_slice
()),
Some
(
idx
)
if
&
self
.repr
[
(
idx
+
1
)
..
]
==
b
".."
=>
None
,
Some
(
idx
)
if
&
self
.repr
[
idx
+
1
..
]
==
b
".."
=>
None
,
Some
(
0
)
if
self
.repr
[
1
..
]
.is_empty
()
=>
None
,
Some
(
idx
)
=>
Some
(
&
self
.repr
[
(
idx
+
1
)
..
])
Some
(
idx
)
=>
Some
(
&
self
.repr
[
idx
+
1
..
])
}
}
...
...
src/libstd/path/windows.rs
浏览文件 @
49684850
...
...
@@ -428,10 +428,10 @@ fn root_path(&self) -> Option<Path> {
if
self
.prefix
.is_some
()
{
Some
(
Path
::
new
(
match
self
.prefix
{
Some
(
DiskPrefix
)
if
self
.is_absolute
()
=>
{
&
self
.repr
[
..
(
self
.prefix_len
()
+
1
)
]
&
self
.repr
[
..
self
.prefix_len
()
+
1
]
}
Some
(
VerbatimDiskPrefix
)
=>
{
&
self
.repr
[
..
(
self
.prefix_len
()
+
1
)
]
&
self
.repr
[
..
self
.prefix_len
()
+
1
]
}
_
=>
&
self
.repr
[
..
self
.prefix_len
()]
}))
...
...
@@ -635,7 +635,7 @@ pub fn str_components<'a>(&'a self) -> StrComponents<'a> {
Some
(
_
)
=>
{
let
plen
=
self
.prefix_len
();
if
repr
.len
()
>
plen
&&
repr
.as_bytes
()[
plen
]
==
SEP_BYTE
{
&
repr
[
(
plen
+
1
)
..
]
&
repr
[
plen
+
1
..
]
}
else
{
&
repr
[
plen
..
]
}
}
None
if
repr
.as_bytes
()[
0
]
==
SEP_BYTE
=>
&
repr
[
1
..
],
...
...
@@ -786,9 +786,9 @@ fn normalize__(s: &str, prefix: Option<PathPrefix>) -> Option<String> {
}
Some
(
UNCPrefix
(
a
,
b
))
=>
{
s
.push_str
(
"
\\\\
"
);
s
.push_str
(
&
prefix_
[
2
..
(
a
+
2
)
]);
s
.push_str
(
&
prefix_
[
2
..
a
+
2
]);
s
.push
(
SEP
);
s
.push_str
(
&
prefix_
[
(
3
+
a
)
..
(
3
+
a
+
b
)
]);
s
.push_str
(
&
prefix_
[
3
+
a
..
3
+
a
+
b
]);
}
Some
(
_
)
=>
s
.push_str
(
prefix_
),
None
=>
()
...
...
@@ -813,7 +813,7 @@ fn normalize__(s: &str, prefix: Option<PathPrefix>) -> Option<String> {
fn
update_sepidx
(
&
mut
self
)
{
let
s
=
if
self
.has_nonsemantic_trailing_slash
()
{
&
self
.repr
[
..
(
self
.repr
.len
()
-
1
)
]
&
self
.repr
[
..
self
.repr
.len
()
-
1
]
}
else
{
&
self
.repr
[]
};
let
sep_test
:
fn
(
char
)
->
bool
=
if
!
prefix_is_verbatim
(
self
.prefix
)
{
is_sep
...
...
@@ -1029,7 +1029,7 @@ fn parse_two_comps(mut path: &str, f: fn(char) -> bool) -> Option<(uint, uint)>
None
=>
return
None
,
Some
(
x
)
=>
x
};
path
=
&
path
[
(
idx_a
+
1
)
..
];
path
=
&
path
[
idx_a
+
1
..
];
let
idx_b
=
path
.find
(
f
)
.unwrap_or
(
path
.len
());
Some
((
idx_a
,
idx_b
))
}
...
...
src/libstd/sys/windows/backtrace.rs
浏览文件 @
49684850
...
...
@@ -362,7 +362,7 @@ pub fn write(w: &mut Writer) -> IoResult<()> {
let
bytes
=
unsafe
{
ffi
::
c_str_to_bytes
(
&
ptr
)
};
match
str
::
from_utf8
(
bytes
)
{
Ok
(
s
)
=>
try!
(
demangle
(
w
,
s
)),
Err
(
..
)
=>
try!
(
w
.write
(
&
bytes
[
..
(
bytes
.len
()
-
1
)
])),
Err
(
..
)
=>
try!
(
w
.write
(
&
bytes
[
..
bytes
.len
()
-
1
])),
}
}
try!
(
w
.write
(
&
[
'\n'
as
u8
]));
...
...
src/libsyntax/ast_map/mod.rs
浏览文件 @
49684850
...
...
@@ -525,7 +525,7 @@ pub fn nodes_matching_suffix<'a>(&'a self, parts: &'a [String])
NodesMatchingSuffix
{
map
:
self
,
item_name
:
parts
.last
()
.unwrap
(),
in_which
:
&
parts
[
..
(
parts
.len
()
-
1
)
],
in_which
:
&
parts
[
..
parts
.len
()
-
1
],
idx
:
0
,
}
}
...
...
src/libsyntax/diagnostic.rs
浏览文件 @
49684850
...
...
@@ -280,7 +280,7 @@ fn print_maybe_styled(w: &mut EmitterWriter,
// to be miscolored. We assume this is rare enough that we don't
// have to worry about it.
if
msg
.ends_with
(
"
\n
"
)
{
try!
(
t
.write_str
(
&
msg
[
..
(
msg
.len
()
-
1
)
]));
try!
(
t
.write_str
(
&
msg
[
..
msg
.len
()
-
1
]));
try!
(
t
.reset
());
try!
(
t
.write_str
(
"
\n
"
));
}
else
{
...
...
src/libsyntax/parse/lexer/comments.rs
浏览文件 @
49684850
...
...
@@ -116,7 +116,7 @@ fn horizontal_trim(lines: Vec<String> ) -> Vec<String> {
if
can_trim
{
lines
.iter
()
.map
(|
line
|
{
(
&
line
[
(
i
+
1
)
..
line
.len
()])
.to_string
()
(
&
line
[
i
+
1
..
line
.len
()])
.to_string
()
})
.collect
()
}
else
{
lines
...
...
@@ -132,7 +132,7 @@ fn horizontal_trim(lines: Vec<String> ) -> Vec<String> {
}
if
comment
.starts_with
(
"/*"
)
{
let
lines
=
comment
[
3u
..
(
comment
.len
()
-
2u
)
]
let
lines
=
comment
[
3u
..
comment
.len
()
-
2u
]
.lines_any
()
.map
(|
s
|
s
.to_string
())
.collect
::
<
Vec
<
String
>
>
();
...
...
src/libterm/terminfo/parser/compiled.rs
浏览文件 @
49684850
...
...
@@ -284,12 +284,12 @@ pub fn parse(file: &mut io::Reader, longnames: bool)
// Find the offset of the NUL we want to go to
let
nulpos
=
string_table
[
(
offset
as
uint
)
..
(
string_table_bytes
as
uint
)
]
let
nulpos
=
string_table
[
offset
as
uint
..
string_table_bytes
as
uint
]
.iter
()
.position
(|
&
b
|
b
==
0
);
match
nulpos
{
Some
(
len
)
=>
{
string_map
.insert
(
name
.to_string
(),
string_table
[
(
offset
as
uint
)
..
string_table
[
offset
as
uint
..
(
offset
as
uint
+
len
)]
.to_vec
())
},
None
=>
{
...
...
src/test/bench/shootout-fannkuch-redux.rs
浏览文件 @
49684850
...
...
@@ -103,7 +103,7 @@ fn get(&mut self, mut idx: i32) -> P {
let
d
=
idx
/
self
.fact
[
i
]
as
i32
;
self
.cnt
[
i
]
=
d
;
idx
%=
self
.fact
[
i
]
as
i32
;
for
(
place
,
val
)
in
pp
.iter_mut
()
.zip
(
self
.perm.p
[
..
(
i
+
1
)
]
.iter
())
{
for
(
place
,
val
)
in
pp
.iter_mut
()
.zip
(
self
.perm.p
[
..
i
+
1
]
.iter
())
{
*
place
=
(
*
val
)
as
u8
}
...
...
src/test/bench/shootout-fasta.rs
浏览文件 @
49684850
...
...
@@ -97,7 +97,7 @@ fn make_fasta<W: Writer, I: Iterator<Item=u8>>(
}
n
-=
nb
;
line
[
nb
]
=
'\n'
as
u8
;
try!
(
wr
.write
(
&
line
[
..
(
nb
+
1
)
]));
try!
(
wr
.write
(
&
line
[
..
nb
+
1
]));
}
Ok
(())
}
...
...
src/test/bench/shootout-k-nucleotide-pipes.rs
浏览文件 @
49684850
...
...
@@ -101,11 +101,11 @@ fn windows_with_carry<F>(bb: &[u8], nn: uint, mut it: F) -> Vec<u8> where
let
len
=
bb
.len
();
while
ii
<
len
-
(
nn
-
1u
)
{
it
(
&
bb
[
ii
..
(
ii
+
nn
)
]);
it
(
&
bb
[
ii
..
ii
+
nn
]);
ii
+=
1u
;
}
return
bb
[
(
len
-
(
nn
-
1u
)
)
..
len
]
.to_vec
();
return
bb
[
len
-
(
nn
-
1u
)
..
len
]
.to_vec
();
}
fn
make_sequence_processor
(
sz
:
uint
,
...
...
src/test/compile-fail/range-1.rs
浏览文件 @
49684850
...
...
@@ -21,6 +21,6 @@ pub fn main() {
// Unsized type.
let
arr
:
&
[
_
]
=
&
[
1u
s
,
2
,
3
];
let
range
=
(
*
arr
)
..
;
let
range
=
*
arr
..
;
//~^ ERROR the trait `core::marker::Sized` is not implemented
}
src/test/compile-fail/range-2.rs
浏览文件 @
49684850
...
...
@@ -12,7 +12,7 @@
pub
fn
main
()
{
let
r
=
{
(
&
42
is
)
..&
42
&
42
is
..&
42
//~^ ERROR borrowed value does not live long enough
//~^^ ERROR borrowed value does not live long enough
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录