Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
d95c9cbe
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,发现更多精彩内容 >>
提交
d95c9cbe
编写于
1月 24, 2013
作者:
D
Daniel Micay
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
replace ConstVector trait with the Container trait
上级
c3f4f654
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
36 addition
and
42 deletion
+36
-42
src/compiletest/runtest.rs
src/compiletest/runtest.rs
+3
-3
src/libcore/core.rc
src/libcore/core.rc
+2
-1
src/libcore/float.rs
src/libcore/float.rs
+1
-1
src/libcore/prelude.rs
src/libcore/prelude.rs
+2
-1
src/libcore/vec.rs
src/libcore/vec.rs
+4
-12
src/librustc/front/test.rs
src/librustc/front/test.rs
+3
-3
src/librustc/lib/llvm.rs
src/librustc/lib/llvm.rs
+1
-1
src/librustc/metadata/creader.rs
src/librustc/metadata/creader.rs
+2
-2
src/librustc/middle/check_match.rs
src/librustc/middle/check_match.rs
+1
-1
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/base.rs
+1
-1
src/librustc/middle/typeck/check/mod.rs
src/librustc/middle/typeck/check/mod.rs
+1
-1
src/librustc/middle/typeck/mod.rs
src/librustc/middle/typeck/mod.rs
+1
-1
src/libstd/bigint.rs
src/libstd/bigint.rs
+1
-1
src/libstd/flatpipes.rs
src/libstd/flatpipes.rs
+2
-2
src/libstd/getopts.rs
src/libstd/getopts.rs
+3
-3
src/libsyntax/print/pprust.rs
src/libsyntax/print/pprust.rs
+8
-8
未找到文件。
src/compiletest/runtest.rs
浏览文件 @
d95c9cbe
...
...
@@ -59,8 +59,8 @@ fn run_cfail_test(config: config, props: test_props, testfile: &Path) {
check_correct_failure_status
(
procres
);
let
expected_errors
=
errors
::
load_errors
(
testfile
);
if
vec
::
is_not_empty
(
expected_errors
)
{
if
vec
::
is_not_empty
(
props
.error_patterns
)
{
if
!
expected_errors
.is_empty
(
)
{
if
!
props
.error_patterns
.is_empty
(
)
{
fatal
(
~
"both error pattern and expected errors specified"
);
}
check_expected_errors
(
expected_errors
,
testfile
,
procres
);
...
...
@@ -440,7 +440,7 @@ fn compose_and_run_compiler(
args
:
procargs
,
input
:
Option
<~
str
>
)
->
procres
{
if
props
.aux_builds
.is_not
_empty
()
{
if
!
props
.aux_builds
.is
_empty
()
{
ensure_dir
(
&
aux_output_dir_name
(
config
,
testfile
));
}
...
...
src/libcore/core.rc
浏览文件 @
d95c9cbe
...
...
@@ -190,7 +190,8 @@ pub use path::PosixPath;
pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps};
pub use str::{StrSlice, Trimmable};
pub use vec::{ConstVector, CopyableVector, ImmutableVector};
pub use container::Container;
pub use vec::{CopyableVector, ImmutableVector};
pub use vec::{ImmutableEqVector, ImmutableCopyableVector};
pub use vec::{OwnedVector, OwnedCopyableVector};
pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter};
...
...
src/libcore/float.rs
浏览文件 @
d95c9cbe
...
...
@@ -157,7 +157,7 @@ pub mod consts {
// turn digits into string
// using stack of digits
while
fractionalParts
.is_not
_empty
()
{
while
!
fractionalParts
.is
_empty
()
{
// Bleh; shouldn't need to be unsafe
let
mut
adjusted_digit
=
carry
+
unsafe
{
fractionalParts
.pop
()
};
...
...
src/libcore/prelude.rs
浏览文件 @
d95c9cbe
...
...
@@ -29,7 +29,8 @@
pub
use
tuple
::{
CopyableTuple
,
ImmutableTuple
,
ExtendedTupleOps
};
pub
use
str
::{
StrSlice
,
Trimmable
};
pub
use
vec
::{
ConstVector
,
CopyableVector
,
ImmutableVector
};
pub
use
container
::
Container
;
pub
use
vec
::{
CopyableVector
,
ImmutableVector
};
pub
use
vec
::{
ImmutableEqVector
,
ImmutableCopyableVector
};
pub
use
vec
::{
OwnedVector
,
OwnedCopyableVector
};
pub
use
iter
::{
BaseIter
,
ExtendedIter
,
EqIter
,
CopyableIter
};
...
...
src/libcore/vec.rs
浏览文件 @
d95c9cbe
...
...
@@ -14,6 +14,7 @@
#[forbid(deprecated_pattern)]
;
#[warn(non_camel_case_types)]
;
use
container
::
Container
;
use
cast
::
transmute
;
use
cast
;
use
cmp
::{
Eq
,
Ord
};
...
...
@@ -453,7 +454,7 @@ pub fn partition<T>(v: ~[T], f: fn(&T) -> bool) -> (~[T], ~[T]) {
/// Removes the first element from a vector and return it
pub
fn
shift
<
T
>
(
v
:
&
mut
~
[
T
])
->
T
{
unsafe
{
assert
v
.is_not
_empty
();
assert
!
v
.is
_empty
();
if
v
.len
()
==
1
{
return
v
.pop
()
}
...
...
@@ -1647,20 +1648,11 @@ impl<T: Copy> ~[mut T] : Add<&[const T],~[mut T]> {
}
}
pub
trait
ConstVector
{
pure
fn
is_empty
(
&
self
)
->
bool
;
pure
fn
is_not_empty
(
&
self
)
->
bool
;
pure
fn
len
(
&
self
)
->
uint
;
}
/// Extension methods for vectors
impl
<
T
>
&
[
const
T
]:
ConstVector
{
impl
<
T
>
&
[
const
T
]:
Container
{
/// Returns true if a vector contains no elements
#[inline]
pure
fn
is_empty
(
&
self
)
->
bool
{
is_empty
(
*
self
)
}
/// Returns true if a vector contains some elements
#[inline]
pure
fn
is_not_empty
(
&
self
)
->
bool
{
is_not_empty
(
*
self
)
}
/// Returns the length of a vector
#[inline]
pure
fn
len
(
&
self
)
->
uint
{
len
(
*
self
)
}
...
...
src/librustc/front/test.rs
浏览文件 @
d95c9cbe
...
...
@@ -147,8 +147,8 @@ fn fold_item(cx: test_ctxt, &&i: @ast::item, fld: fold::ast_fold) ->
}
fn
is_test_fn
(
i
:
@
ast
::
item
)
->
bool
{
let
has_test_attr
=
attr
::
find_attrs_by_name
(
i
.attrs
,
~
"test"
)
.is_not
_empty
();
let
has_test_attr
=
!
attr
::
find_attrs_by_name
(
i
.attrs
,
~
"test"
)
.is
_empty
();
fn
has_test_signature
(
i
:
@
ast
::
item
)
->
bool
{
match
&
i
.node
{
...
...
@@ -171,7 +171,7 @@ fn is_ignored(cx: test_ctxt, i: @ast::item) -> bool {
let
ignoreitems
=
attr
::
attr_metas
(
ignoreattrs
);
let
cfg_metas
=
vec
::
concat
(
vec
::
filter_map
(
ignoreitems
,
|
i
|
attr
::
get_meta_item_list
(
*
i
)));
return
if
vec
::
is_not_empty
(
ignoreitems
)
{
return
if
!
ignoreitems
.is_empty
(
)
{
config
::
metas_in_cfg
(
/*bad*/
copy
cx
.crate.node.config
,
cfg_metas
)
}
else
{
false
...
...
src/librustc/lib/llvm.rs
浏览文件 @
d95c9cbe
...
...
@@ -1331,7 +1331,7 @@ fn tys_str(names: type_names, outer: ~[TypeRef],
Struct
=>
{
let
n_elts
=
llvm
::
LLVMCountStructElementTypes
(
ty
)
as
uint
;
let
mut
elts
=
vec
::
from_elem
(
n_elts
,
0
as
TypeRef
);
if
elts
.is_not
_empty
()
{
if
!
elts
.is
_empty
()
{
llvm
::
LLVMGetStructElementTypes
(
ty
,
ptr
::
to_mut_unsafe_ptr
(
&
mut
elts
[
0
]));
}
...
...
src/librustc/metadata/creader.rs
浏览文件 @
d95c9cbe
...
...
@@ -95,7 +95,7 @@ fn warn_if_multiple_versions(e: env, diag: span_handler,
}
}));
assert
matches
.is_not
_empty
();
assert
!
matches
.is
_empty
();
if
matches
.len
()
!=
1u
{
diag
.handler
()
.warn
(
...
...
@@ -168,7 +168,7 @@ fn visit_item(e: env, i: @ast::item) {
already_added
=
!
cstore
::
add_used_library
(
cstore
,
foreign_name
);
}
if
link_args
.is_not
_empty
()
&&
already_added
{
if
!
link_args
.is
_empty
()
&&
already_added
{
e
.diag
.span_fatal
(
i
.span
,
~
"library '"
+
foreign_name
+
~
"' already added: can't specify link_args."
);
}
...
...
src/librustc/middle/check_match.rs
浏览文件 @
d95c9cbe
...
...
@@ -132,7 +132,7 @@ fn raw_pat(p: @pat) -> @pat {
}
fn
check_exhaustive
(
cx
:
@
MatchCheckCtxt
,
sp
:
span
,
pats
:
~
[
@
pat
])
{
assert
(
pats
.is_not
_empty
());
assert
(
!
pats
.is
_empty
());
let
ext
=
match
is_useful
(
cx
,
vec
::
map
(
pats
,
|
p
|
~
[
*
p
]),
~
[
wild
()])
{
not_useful
=>
return
,
// This is good, wildcard pattern isn't reachable
useful_
=>
None
,
...
...
src/librustc/middle/trans/base.rs
浏览文件 @
d95c9cbe
...
...
@@ -459,7 +459,7 @@ fn get_res_dtor(ccx: @crate_ctxt, did: ast::def_id,
parent_id
:
ast
::
def_id
,
substs
:
~
[
ty
::
t
])
->
ValueRef
{
let
_
icx
=
ccx
.insn_ctxt
(
"trans_res_dtor"
);
if
(
substs
.is_not_empty
()
)
{
if
!
substs
.is_empty
(
)
{
let
did
=
if
did
.crate
!=
ast
::
local_crate
{
inline
::
maybe_instantiate_inline
(
ccx
,
did
,
true
)
}
else
{
did
};
...
...
src/librustc/middle/typeck/check/mod.rs
浏览文件 @
d95c9cbe
...
...
@@ -635,7 +635,7 @@ fn check_item(ccx: @crate_ctxt, it: @ast::item) {
}
else
{
for
m
.items.each
|
item
|
{
let
tpt
=
ty
::
lookup_item_type
(
ccx
.tcx
,
local_def
(
item
.id
));
if
(
*
tpt
.bounds
)
.is_not
_empty
()
{
if
!
tpt
.bounds
.is
_empty
()
{
ccx
.tcx.sess
.span_err
(
item
.span
,
fmt!
(
"foreign items may not have type parameters"
));
...
...
src/librustc/middle/typeck/mod.rs
浏览文件 @
d95c9cbe
...
...
@@ -356,7 +356,7 @@ fn check_main_fn_ty(ccx: @crate_ctxt,
Some
(
ast_map
::
node_item
(
it
,
_
))
=>
{
match
it
.node
{
ast
::
item_fn
(
_
,
_
,
ref
ps
,
_
)
if
vec
::
is_not_empty
(
*
ps
)
=>
{
if
!
ps
.is_empty
(
)
=>
{
tcx
.sess
.span_err
(
main_span
,
~
"main function is not allowed
\
...
...
src/libstd/bigint.rs
浏览文件 @
d95c9cbe
...
...
@@ -402,7 +402,7 @@ pub impl BigUint {
}
pure
fn
is_zero
(
&
self
)
->
bool
{
self
.data
.is_empty
()
}
pure
fn
is_not_zero
(
&
self
)
->
bool
{
self
.data
.is_not
_empty
()
}
pure
fn
is_not_zero
(
&
self
)
->
bool
{
!
self
.data
.is
_empty
()
}
pure
fn
is_positive
(
&
self
)
->
bool
{
self
.is_not_zero
()
}
pure
fn
is_negative
(
&
self
)
->
bool
{
false
}
pure
fn
is_nonpositive
(
&
self
)
->
bool
{
self
.is_zero
()
}
...
...
src/libstd/flatpipes.rs
浏览文件 @
d95c9cbe
...
...
@@ -599,7 +599,7 @@ fn try_recv(&self, count: uint) -> Option<~[u8]> {
}
else
if
self
.buf
.is_empty
()
{
match
self
.port
.try_recv
()
{
Some
(
move
buf
)
=>
{
assert
buf
.is_not
_empty
();
assert
!
buf
.is
_empty
();
self
.buf
=
move
buf
;
return
self
.try_recv
(
count
);
}
...
...
@@ -904,7 +904,7 @@ fn reader_port_loader(bytes: ~[u8]
fn
pipe_port_loader
(
bytes
:
~
[
u8
]
)
->
pod
::
PipePort
<
int
>
{
let
(
port
,
chan
)
=
pipes
::
stream
();
if
bytes
.is_not
_empty
()
{
if
!
bytes
.is
_empty
()
{
chan
.send
(
move
bytes
);
}
pod
::
pipe_port
(
move
port
)
...
...
src/libstd/getopts.rs
浏览文件 @
d95c9cbe
...
...
@@ -45,7 +45,7 @@
* }
*
* fn main(args: ~[str]) {
* check
vec::is_not_empty(args);
* check
!args.is_empty()
*
* let program : str = vec::head(args);
*
...
...
@@ -63,7 +63,7 @@
* return;
* }
* let output = opt_maybe_str(matches, "o");
* let input = if
vec::is_not_empty(matches.free
) {
* let input = if
!matches.free.is_empty(
) {
* matches.free[0]
* } else {
* print_usage(program);
...
...
@@ -357,7 +357,7 @@ fn opt_vals(mm: &Matches, nm: &str) -> ~[Optval] {
/// Returns true if an option was matched
pub
fn
opt_present
(
mm
:
&
Matches
,
nm
:
&
str
)
->
bool
{
opt_vals
(
mm
,
nm
)
.is_not
_empty
()
!
opt_vals
(
mm
,
nm
)
.is
_empty
()
}
/// Returns the number of times an option was matched
...
...
src/libsyntax/print/pprust.rs
浏览文件 @
d95c9cbe
...
...
@@ -532,7 +532,7 @@ fn print_item(s: ps, &&item: @ast::item) {
ast
::
item_impl
(
tps
,
opt_trait
,
ty
,
methods
)
=>
{
head
(
s
,
visibility_qualified
(
item
.vis
,
~
"impl"
));
if
tps
.is_not
_empty
()
{
if
!
tps
.is
_empty
()
{
print_type_params
(
s
,
tps
);
space
(
s
.s
);
}
...
...
@@ -770,7 +770,7 @@ fn print_variant(s: ps, v: ast::variant) {
match
v
.node.kind
{
ast
::
tuple_variant_kind
(
args
)
=>
{
print_ident
(
s
,
v
.node.name
);
if
args
.is_not
_empty
()
{
if
!
args
.is
_empty
()
{
popen
(
s
);
fn
print_variant_arg
(
s
:
ps
,
arg
:
ast
::
variant_arg
)
{
print_type
(
s
,
arg
.ty
);
...
...
@@ -1054,7 +1054,7 @@ fn print_call_post(s: ps,
has_block
:
bool
,
blk
:
&
Option
<@
ast
::
expr
>
,
base_args
:
&
mut
~
[
@
ast
::
expr
])
{
if
!
has_block
||
base_args
.is_not
_empty
()
{
if
!
has_block
||
!
base_args
.is
_empty
()
{
popen
(
s
);
commasep_exprs
(
s
,
inconsistent
,
*
base_args
);
pclose
(
s
);
...
...
@@ -1564,7 +1564,7 @@ fn print_pat(s: ps, &&pat: @ast::pat, refutable: bool) {
match
args_
{
None
=>
word
(
s
.s
,
~
"(*)"
),
Some
(
args
)
=>
{
if
args
.is_not
_empty
()
{
if
!
args
.is
_empty
()
{
popen
(
s
);
commasep
(
s
,
inconsistent
,
args
,
|
s
,
p
|
print_pat
(
s
,
p
,
refutable
));
...
...
@@ -1762,7 +1762,7 @@ fn print_arg_mode(s: ps, m: ast::mode) {
}
fn
print_bounds
(
s
:
ps
,
bounds
:
@~
[
ast
::
ty_param_bound
])
{
if
bounds
.is_not
_empty
()
{
if
!
bounds
.is
_empty
()
{
word
(
s
.s
,
~
":"
);
let
mut
first
=
true
;
for
vec
::
each
(
*
bounds
)
|
&
bound
|
{
...
...
@@ -1855,7 +1855,7 @@ fn print_view_item(s: ps, item: @ast::view_item) {
ast
::
view_item_use
(
id
,
mta
,
_
)
=>
{
head
(
s
,
~
"extern mod"
);
print_ident
(
s
,
id
);
if
mta
.is_not
_empty
()
{
if
!
mta
.is
_empty
()
{
popen
(
s
);
commasep
(
s
,
consistent
,
mta
,
print_meta_item
);
pclose
(
s
);
...
...
@@ -2101,7 +2101,7 @@ fn print_comment(s: ps, cmnt: comments::cmnt) {
for
cmnt
.lines.each
|
line
|
{
// Don't print empty lines because they will end up as trailing
// whitespace
if
str
::
is_not_empty
(
*
line
)
{
word
(
s
.s
,
*
line
);
}
if
!
line
.is_empty
(
)
{
word
(
s
.s
,
*
line
);
}
hardbreak
(
s
.s
);
}
}
...
...
@@ -2113,7 +2113,7 @@ fn print_comment(s: ps, cmnt: comments::cmnt) {
}
else
{
ibox
(
s
,
0u
);
for
cmnt
.lines.each
|
line
|
{
if
str
::
is_not_empty
(
*
line
)
{
word
(
s
.s
,
*
line
);
}
if
!
line
.is_empty
(
)
{
word
(
s
.s
,
*
line
);
}
hardbreak
(
s
.s
);
}
end
(
s
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录