Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
fe588d89
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,发现更多精彩内容 >>
提交
fe588d89
编写于
7月 23, 2018
作者:
L
ljedrz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Replace a few expect+format combos with unwrap_or_else+panic
上级
210d61f0
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
8 addition
and
8 deletion
+8
-8
src/bootstrap/bin/rustc.rs
src/bootstrap/bin/rustc.rs
+2
-2
src/bootstrap/install.rs
src/bootstrap/install.rs
+1
-1
src/librustc_codegen_llvm/back/rpath.rs
src/librustc_codegen_llvm/back/rpath.rs
+2
-2
src/librustc_codegen_llvm/base.rs
src/librustc_codegen_llvm/base.rs
+1
-1
src/libsyntax_ext/format_foreign.rs
src/libsyntax_ext/format_foreign.rs
+2
-2
未找到文件。
src/bootstrap/bin/rustc.rs
浏览文件 @
fe588d89
...
...
@@ -326,7 +326,7 @@ fn main() {
let
start
=
Instant
::
now
();
let
status
=
cmd
.status
()
.
expect
(
&
format
!
(
"
\n\n
failed to run {:?}"
,
cmd
));
.
unwrap_or_else
(|
_
|
panic
!
(
"
\n\n
failed to run {:?}"
,
cmd
));
let
dur
=
start
.elapsed
();
let
is_test
=
args
.iter
()
.any
(|
a
|
a
==
"--test"
);
...
...
@@ -346,7 +346,7 @@ fn main() {
}
}
let
code
=
exec_cmd
(
&
mut
cmd
)
.
expect
(
&
format
!
(
"
\n\n
failed to run {:?}"
,
cmd
));
let
code
=
exec_cmd
(
&
mut
cmd
)
.
unwrap_or_else
(|
_
|
panic
!
(
"
\n\n
failed to run {:?}"
,
cmd
));
std
::
process
::
exit
(
code
);
}
...
...
src/bootstrap/install.rs
浏览文件 @
fe588d89
...
...
@@ -75,7 +75,7 @@ fn install_sh(
let
libdir_default
=
PathBuf
::
from
(
"lib"
);
let
mandir_default
=
datadir_default
.join
(
"man"
);
let
prefix
=
builder
.config.prefix
.as_ref
()
.map_or
(
prefix_default
,
|
p
|
{
fs
::
canonicalize
(
p
)
.
expect
(
&
format
!
(
"could not canonicalize {}"
,
p
.display
()))
fs
::
canonicalize
(
p
)
.
unwrap_or_else
(|
_
|
panic
!
(
"could not canonicalize {}"
,
p
.display
()))
});
let
sysconfdir
=
builder
.config.sysconfdir
.as_ref
()
.unwrap_or
(
&
sysconfdir_default
);
let
datadir
=
builder
.config.datadir
.as_ref
()
.unwrap_or
(
&
datadir_default
);
...
...
src/librustc_codegen_llvm/back/rpath.rs
浏览文件 @
fe588d89
...
...
@@ -114,8 +114,8 @@ fn get_rpath_relative_to_output(config: &mut RPathConfig, lib: &Path) -> String
let
mut
output
=
cwd
.join
(
&
config
.out_filename
);
output
.pop
();
let
output
=
fs
::
canonicalize
(
&
output
)
.unwrap_or
(
output
);
let
relative
=
path_relative_from
(
&
lib
,
&
output
)
.expect
(
&
format
!
(
"couldn't create relative path from {:?} to {:?}"
,
output
,
lib
));
let
relative
=
path_relative_from
(
&
lib
,
&
output
)
.unwrap_or_else
(||
panic
!
(
"couldn't create relative path from {:?} to {:?}"
,
output
,
lib
));
// FIXME (#9639): This needs to handle non-utf8 paths
format!
(
"{}/{}"
,
prefix
,
relative
.to_str
()
.expect
(
"non-utf8 component in path"
))
...
...
src/librustc_codegen_llvm/base.rs
浏览文件 @
fe588d89
...
...
@@ -1277,7 +1277,7 @@ pub fn provide(providers: &mut Providers) {
all
.iter
()
.find
(|
cgu
|
*
cgu
.name
()
==
name
)
.cloned
()
.
expect
(
&
format
!
(
"failed to find cgu with name {:?}"
,
name
))
.
unwrap_or_else
(||
panic
!
(
"failed to find cgu with name {:?}"
,
name
))
};
providers
.compile_codegen_unit
=
compile_codegen_unit
;
...
...
src/libsyntax_ext/format_foreign.rs
浏览文件 @
fe588d89
...
...
@@ -232,11 +232,11 @@ pub enum Num {
impl
Num
{
fn
from_str
(
s
:
&
str
,
arg
:
Option
<&
str
>
)
->
Self
{
if
let
Some
(
arg
)
=
arg
{
Num
::
Arg
(
arg
.parse
()
.
expect
(
&
format
!
(
"invalid format arg `{:?}`"
,
arg
)))
Num
::
Arg
(
arg
.parse
()
.
unwrap_or_else
(|
_
|
panic
!
(
"invalid format arg `{:?}`"
,
arg
)))
}
else
if
s
==
"*"
{
Num
::
Next
}
else
{
Num
::
Num
(
s
.parse
()
.
expect
(
&
format
!
(
"invalid format num `{:?}`"
,
s
)))
Num
::
Num
(
s
.parse
()
.
unwrap_or_else
(|
_
|
panic
!
(
"invalid format num `{:?}`"
,
s
)))
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录