Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
c09ca940
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,发现更多精彩内容 >>
提交
c09ca940
编写于
2月 03, 2014
作者:
A
Arcterus
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
getopts: replaced base functions with those from group
上级
9752c630
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
463 addition
and
505 deletion
+463
-505
src/compiletest/compiletest.rs
src/compiletest/compiletest.rs
+5
-5
src/libextra/test.rs
src/libextra/test.rs
+12
-13
src/libgetopts/lib.rs
src/libgetopts/lib.rs
+435
-473
src/librustc/driver/driver.rs
src/librustc/driver/driver.rs
+3
-3
src/librustc/lib.rs
src/librustc/lib.rs
+2
-3
src/librustc/middle/typeck/infer/test.rs
src/librustc/middle/typeck/infer/test.rs
+1
-2
src/librustdoc/lib.rs
src/librustdoc/lib.rs
+4
-5
src/test/run-pass/getopts_ref.rs
src/test/run-pass/getopts_ref.rs
+1
-1
未找到文件。
src/compiletest/compiletest.rs
浏览文件 @
c09ca940
...
...
@@ -20,7 +20,7 @@
use
std
::
io
;
use
std
::
io
::
fs
;
use
getopts
::
groups
::
{
optopt
,
optflag
,
reqopt
};
use
getopts
::{
optopt
,
optflag
,
reqopt
};
use
extra
::
test
;
use
common
::
config
;
...
...
@@ -49,7 +49,7 @@ pub fn main() {
pub
fn
parse_config
(
args
:
~
[
~
str
])
->
config
{
let
groups
:
~
[
getopts
::
groups
::
OptGroup
]
=
let
groups
:
~
[
getopts
::
OptGroup
]
=
~
[
reqopt
(
""
,
"compile-lib-path"
,
"path to host shared libraries"
,
"PATH"
),
reqopt
(
""
,
"run-lib-path"
,
"path to target shared libraries"
,
"PATH"
),
reqopt
(
""
,
"rustc-path"
,
"path to rustc to use for compiling"
,
"PATH"
),
...
...
@@ -85,20 +85,20 @@ pub fn parse_config(args: ~[~str]) -> config {
let
args_
=
args
.tail
();
if
args
[
1
]
==
~
"-h"
||
args
[
1
]
==
~
"--help"
{
let
message
=
format!
(
"Usage: {} [OPTIONS] [TESTNAME...]"
,
argv0
);
println!
(
"{}"
,
getopts
::
groups
::
usage
(
message
,
groups
));
println!
(
"{}"
,
getopts
::
usage
(
message
,
groups
));
println!
(
""
);
fail
!
()
}
let
matches
=
&
match
getopts
::
g
roups
::
g
etopts
(
args_
,
groups
)
{
&
match
getopts
::
getopts
(
args_
,
groups
)
{
Ok
(
m
)
=>
m
,
Err
(
f
)
=>
fail
!
(
"{}"
,
f
.to_err_msg
())
};
if
matches
.opt_present
(
"h"
)
||
matches
.opt_present
(
"help"
)
{
let
message
=
format!
(
"Usage: {} [OPTIONS] [TESTNAME...]"
,
argv0
);
println!
(
"{}"
,
getopts
::
groups
::
usage
(
message
,
groups
));
println!
(
"{}"
,
getopts
::
usage
(
message
,
groups
));
println!
(
""
);
fail
!
()
}
...
...
src/libextra/test.rs
浏览文件 @
c09ca940
...
...
@@ -17,7 +17,6 @@
extern
mod
term
;
use
getopts
::
groups
;
use
getopts
;
use
json
::
ToJson
;
use
json
;
...
...
@@ -209,29 +208,29 @@ pub struct TestOpts {
/// Result of parsing the options.
pub
type
OptRes
=
Result
<
TestOpts
,
~
str
>
;
fn
optgroups
()
->
~
[
getopts
::
groups
::
OptGroup
]
{
~
[
g
roup
s
::
optflag
(
""
,
"ignored"
,
"Run ignored tests"
),
g
roup
s
::
optflag
(
""
,
"test"
,
"Run tests and not benchmarks"
),
g
roup
s
::
optflag
(
""
,
"bench"
,
"Run benchmarks instead of tests"
),
g
roup
s
::
optflag
(
"h"
,
"help"
,
"Display this message (longer with --help)"
),
g
roup
s
::
optopt
(
""
,
"save-metrics"
,
"Location to save bench metrics"
,
fn
optgroups
()
->
~
[
getopts
::
OptGroup
]
{
~
[
g
etopt
s
::
optflag
(
""
,
"ignored"
,
"Run ignored tests"
),
g
etopt
s
::
optflag
(
""
,
"test"
,
"Run tests and not benchmarks"
),
g
etopt
s
::
optflag
(
""
,
"bench"
,
"Run benchmarks instead of tests"
),
g
etopt
s
::
optflag
(
"h"
,
"help"
,
"Display this message (longer with --help)"
),
g
etopt
s
::
optopt
(
""
,
"save-metrics"
,
"Location to save bench metrics"
,
"PATH"
),
g
roup
s
::
optopt
(
""
,
"ratchet-metrics"
,
g
etopt
s
::
optopt
(
""
,
"ratchet-metrics"
,
"Location to load and save metrics from. The metrics
\
loaded are cause benchmarks to fail if they run too
\
slowly"
,
"PATH"
),
g
roup
s
::
optopt
(
""
,
"ratchet-noise-percent"
,
g
etopt
s
::
optopt
(
""
,
"ratchet-noise-percent"
,
"Tests within N% of the recorded metrics will be
\
considered as passing"
,
"PERCENTAGE"
),
g
roup
s
::
optopt
(
""
,
"logfile"
,
"Write logs to the specified file instead
\
g
etopt
s
::
optopt
(
""
,
"logfile"
,
"Write logs to the specified file instead
\
of stdout"
,
"PATH"
),
g
roup
s
::
optopt
(
""
,
"test-shard"
,
"run shard A, of B shards, worth of the testsuite"
,
g
etopt
s
::
optopt
(
""
,
"test-shard"
,
"run shard A, of B shards, worth of the testsuite"
,
"A.B"
)]
}
fn
usage
(
binary
:
&
str
,
helpstr
:
&
str
)
{
let
message
=
format!
(
"Usage: {} [OPTIONS] [FILTER]"
,
binary
);
println!
(
"{}"
,
g
roup
s
::
usage
(
message
,
optgroups
()));
println!
(
"{}"
,
g
etopt
s
::
usage
(
message
,
optgroups
()));
println!
(
""
);
if
helpstr
==
"help"
{
println!
(
"{}"
,
"
\
...
...
@@ -261,7 +260,7 @@ fn usage(binary: &str, helpstr: &str) {
pub
fn
parse_opts
(
args
:
&
[
~
str
])
->
Option
<
OptRes
>
{
let
args_
=
args
.tail
();
let
matches
=
match
g
roup
s
::
getopts
(
args_
,
optgroups
())
{
match
g
etopt
s
::
getopts
(
args_
,
optgroups
())
{
Ok
(
m
)
=>
m
,
Err
(
f
)
=>
return
Some
(
Err
(
f
.to_err_msg
()))
};
...
...
src/libgetopts/lib.rs
浏览文件 @
c09ca940
此差异已折叠。
点击以展开。
src/librustc/driver/driver.rs
浏览文件 @
c09ca940
...
...
@@ -34,7 +34,7 @@
use
std
::
io
::
MemReader
;
use
std
::
os
;
use
std
::
vec
;
use
getopts
::
groups
::
{
optopt
,
optmulti
,
optflag
,
optflagopt
};
use
getopts
::{
optopt
,
optmulti
,
optflag
,
optflagopt
};
use
getopts
;
use
syntax
::
ast
;
use
syntax
::
abi
;
...
...
@@ -992,7 +992,7 @@ pub fn parse_pretty(sess: Session, name: &str) -> PpMode {
}
// rustc command line options
pub
fn
optgroups
()
->
~
[
getopts
::
groups
::
OptGroup
]
{
pub
fn
optgroups
()
->
~
[
getopts
::
OptGroup
]
{
~
[
optflag
(
"c"
,
""
,
"Compile and assemble, but do not link"
),
optmulti
(
""
,
"cfg"
,
"Configure the compilation
...
...
@@ -1188,7 +1188,7 @@ mod test {
use
driver
::
driver
::{
build_configuration
,
build_session
};
use
driver
::
driver
::{
build_session_options
,
optgroups
};
use
getopts
::
g
roups
::
g
etopts
;
use
getopts
::
getopts
;
use
syntax
::
attr
;
use
syntax
::
attr
::
AttrMetaMethods
;
use
syntax
::
diagnostic
;
...
...
src/librustc/lib.rs
浏览文件 @
c09ca940
...
...
@@ -51,7 +51,6 @@
use
std
::
str
;
use
std
::
task
;
use
std
::
vec
;
use
getopts
::
groups
;
use
syntax
::
ast
;
use
syntax
::
attr
;
use
syntax
::
diagnostic
::
Emitter
;
...
...
@@ -142,7 +141,7 @@ pub fn usage(argv0: &str) {
Additional help:
-W help Print 'lint' options and default settings
-Z help Print internal options for debugging rustc
\n
"
,
g
roup
s
::
usage
(
message
,
d
::
optgroups
()));
g
etopt
s
::
usage
(
message
,
d
::
optgroups
()));
}
pub
fn
describe_warnings
()
{
...
...
@@ -201,7 +200,7 @@ pub fn run_compiler(args: &[~str], demitter: @diagnostic::Emitter) {
if
args
.is_empty
()
{
usage
(
binary
);
return
;
}
let
matches
=
&
match
getopts
::
g
roups
::
g
etopts
(
args
,
d
::
optgroups
())
{
&
match
getopts
::
getopts
(
args
,
d
::
optgroups
())
{
Ok
(
m
)
=>
m
,
Err
(
f
)
=>
{
d
::
early_error
(
demitter
,
f
.to_err_msg
());
...
...
src/librustc/middle/typeck/infer/test.rs
浏览文件 @
c09ca940
...
...
@@ -24,8 +24,7 @@
use
util
::
ppaux
::
ty_to_str
;
use
extra
::
oldmap
::
HashMap
;
use
getopts
::
groups
::{
optopt
,
optmulti
,
optflag
,
optflagopt
,
getopts
};
use
getopts
::
groups
;
use
getopts
::{
optopt
,
optmulti
,
optflag
,
optflagopt
,
getopts
};
use
getopts
::
opt_present
;
use
syntax
::
codemap
::
DUMMY_SP
;
use
syntax
::
parse
::
parse_crate_from_source_str
;
...
...
src/librustdoc/lib.rs
浏览文件 @
c09ca940
...
...
@@ -29,7 +29,6 @@
use
extra
::
json
;
use
serialize
::{
Decodable
,
Encodable
};
use
extra
::
time
;
use
getopts
::
groups
;
pub
mod
clean
;
pub
mod
core
;
...
...
@@ -80,8 +79,8 @@ pub fn main() {
std
::
os
::
set_exit_status
(
main_args
(
std
::
os
::
args
()));
}
pub
fn
opts
()
->
~
[
g
roup
s
::
OptGroup
]
{
use
getopts
::
groups
::
*
;
pub
fn
opts
()
->
~
[
g
etopt
s
::
OptGroup
]
{
use
getopts
::
*
;
~
[
optflag
(
"h"
,
"help"
,
"show this help message"
),
optflag
(
""
,
"version"
,
"print rustdoc's version"
),
...
...
@@ -107,11 +106,11 @@ pub fn opts() -> ~[groups::OptGroup] {
}
pub
fn
usage
(
argv0
:
&
str
)
{
println!
(
"{}"
,
g
roup
s
::
usage
(
format!
(
"{} [options] <input>"
,
argv0
),
opts
()));
println!
(
"{}"
,
g
etopt
s
::
usage
(
format!
(
"{} [options] <input>"
,
argv0
),
opts
()));
}
pub
fn
main_args
(
args
:
&
[
~
str
])
->
int
{
let
matches
=
match
g
roup
s
::
getopts
(
args
.tail
(),
opts
())
{
let
matches
=
match
g
etopt
s
::
getopts
(
args
.tail
(),
opts
())
{
Ok
(
m
)
=>
m
,
Err
(
err
)
=>
{
println!
(
"{}"
,
err
.to_err_msg
());
...
...
src/test/run-pass/getopts_ref.rs
浏览文件 @
c09ca940
...
...
@@ -16,7 +16,7 @@
pub
fn
main
()
{
let
args
=
~
[];
let
opts
=
~
[
optopt
(
"b"
)];
let
opts
=
~
[
optopt
(
"b"
,
""
,
"something"
,
"SMTHNG"
)];
match
getopts
(
args
,
opts
)
{
Ok
(
ref
m
)
=>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录