Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
44d32d44
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,发现更多精彩内容 >>
提交
44d32d44
编写于
7月 27, 2018
作者:
L
ljedrz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Avoid unnecessary pattern matching against Option and Result
上级
11a90243
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
21 addition
and
23 deletion
+21
-23
src/librustc/traits/auto_trait.rs
src/librustc/traits/auto_trait.rs
+1
-4
src/librustc/traits/error_reporting.rs
src/librustc/traits/error_reporting.rs
+1
-1
src/librustc/traits/query/outlives_bounds.rs
src/librustc/traits/query/outlives_bounds.rs
+1
-1
src/librustc/traits/select.rs
src/librustc/traits/select.rs
+2
-2
src/librustc/ty/instance.rs
src/librustc/ty/instance.rs
+1
-1
src/librustc_errors/emitter.rs
src/librustc_errors/emitter.rs
+1
-1
src/librustc_mir/borrow_check/error_reporting.rs
src/librustc_mir/borrow_check/error_reporting.rs
+2
-2
src/librustc_resolve/lib.rs
src/librustc_resolve/lib.rs
+2
-2
src/librustc_save_analysis/json_dumper.rs
src/librustc_save_analysis/json_dumper.rs
+1
-1
src/librustc_typeck/check/method/probe.rs
src/librustc_typeck/check/method/probe.rs
+3
-2
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/mod.rs
+1
-1
src/librustdoc/core.rs
src/librustdoc/core.rs
+1
-1
src/librustdoc/html/highlight.rs
src/librustdoc/html/highlight.rs
+1
-1
src/librustdoc/html/markdown.rs
src/librustdoc/html/markdown.rs
+1
-1
src/libsyntax/test.rs
src/libsyntax/test.rs
+1
-1
src/libsyntax_ext/env.rs
src/libsyntax_ext/env.rs
+1
-1
未找到文件。
src/librustc/traits/auto_trait.rs
浏览文件 @
44d32d44
...
...
@@ -681,10 +681,7 @@ pub fn evaluate_nested_obligations<
}
}
&
ty
::
Predicate
::
RegionOutlives
(
ref
binder
)
=>
{
if
let
Err
(
_
)
=
select
.infcx
()
.region_outlives_predicate
(
&
dummy_cause
,
binder
)
{
if
select
.infcx
()
.region_outlives_predicate
(
&
dummy_cause
,
binder
)
.is_err
()
{
return
false
;
}
}
...
...
src/librustc/traits/error_reporting.rs
浏览文件 @
44d32d44
...
...
@@ -143,7 +143,7 @@ fn error_implies(&self,
// Eventually I'll need to implement param-env-aware
// `Γ₁ ⊦ φ₁ => Γ₂ ⊦ φ₂` logic.
let
param_env
=
ty
::
ParamEnv
::
empty
();
if
let
Ok
(
_
)
=
self
.can_sub
(
param_env
,
error
,
implication
)
{
if
self
.can_sub
(
param_env
,
error
,
implication
)
.is_ok
(
)
{
debug!
(
"error_implies: {:?} -> {:?} -> {:?}"
,
cond
,
error
,
implication
);
return
true
}
...
...
src/librustc/traits/query/outlives_bounds.rs
浏览文件 @
44d32d44
...
...
@@ -137,7 +137,7 @@ pub fn implied_outlives_bounds(
// variables. Process these constraints.
let
mut
fulfill_cx
=
FulfillmentContext
::
new
();
fulfill_cx
.register_predicate_obligations
(
self
,
result
.obligations
);
if
let
Err
(
_
)
=
fulfill_cx
.select_all_or_error
(
self
)
{
if
fulfill_cx
.select_all_or_error
(
self
)
.is_err
(
)
{
self
.tcx.sess
.delay_span_bug
(
span
,
"implied_outlives_bounds failed to solve obligations from instantiation"
...
...
src/librustc/traits/select.rs
浏览文件 @
44d32d44
...
...
@@ -1587,8 +1587,8 @@ fn match_projection(&mut self,
->
bool
{
assert
!
(
!
skol_trait_ref
.has_escaping_regions
());
if
let
Err
(
_
)
=
self
.infcx
.at
(
&
obligation
.cause
,
obligation
.param_env
)
.sup
(
ty
::
Binder
::
dummy
(
skol_trait_ref
),
trait_bound
)
{
if
self
.infcx
.at
(
&
obligation
.cause
,
obligation
.param_env
)
.sup
(
ty
::
Binder
::
dummy
(
skol_trait_ref
),
trait_bound
)
.is_err
(
)
{
return
false
;
}
...
...
src/librustc/ty/instance.rs
浏览文件 @
44d32d44
...
...
@@ -294,7 +294,7 @@ fn resolve_associated_item<'a, 'tcx>(
})
}
traits
::
VtableBuiltin
(
..
)
=>
{
if
let
Some
(
_
)
=
tcx
.lang_items
()
.clone_trait
()
{
if
tcx
.lang_items
()
.clone_trait
()
.is_some
()
{
Some
(
Instance
{
def
:
ty
::
InstanceDef
::
CloneShim
(
def_id
,
trait_ref
.self_ty
()),
substs
:
rcvr_substs
...
...
src/librustc_errors/emitter.rs
浏览文件 @
44d32d44
...
...
@@ -1295,7 +1295,7 @@ fn emit_suggestion_default(&mut self,
}
// if we elided some lines, add an ellipsis
if
l
et
Some
(
_
)
=
lines
.next
()
{
if
l
ines
.next
()
.is_some
()
{
buffer
.puts
(
row_num
,
max_line_num_len
-
1
,
"..."
,
Style
::
LineNumber
);
}
else
if
!
show_underline
{
draw_col_separator_no_space
(
&
mut
buffer
,
row_num
,
max_line_num_len
+
1
);
...
...
src/librustc_mir/borrow_check/error_reporting.rs
浏览文件 @
44d32d44
...
...
@@ -138,7 +138,7 @@ pub(super) fn report_use_of_moved_or_uninitialized(
let
tables
=
self
.tcx
.typeck_tables_of
(
id
);
let
node_id
=
self
.tcx.hir
.as_local_node_id
(
id
)
.unwrap
();
let
hir_id
=
self
.tcx.hir
.node_to_hir_id
(
node_id
);
if
let
Some
(
_
)
=
tables
.closure_kind_origins
()
.get
(
hir_id
)
{
if
tables
.closure_kind_origins
()
.get
(
hir_id
)
.is_some
(
)
{
false
}
else
{
true
...
...
@@ -735,7 +735,7 @@ fn append_place_to_string(
&
including_downcast
,
)
?
;
buf
.push_str
(
"["
);
if
let
Err
(
_
)
=
self
.append_local_to_string
(
index
,
buf
)
{
if
self
.append_local_to_string
(
index
,
buf
)
.is_err
(
)
{
buf
.push_str
(
".."
);
}
buf
.push_str
(
"]"
);
...
...
src/librustc_resolve/lib.rs
浏览文件 @
44d32d44
...
...
@@ -2698,7 +2698,7 @@ fn resolve_block(&mut self, block: &Block) {
self
.label_ribs
.pop
();
}
self
.ribs
[
ValueNS
]
.pop
();
if
let
Some
(
_
)
=
anonymous_module
{
if
anonymous_module
.is_some
()
{
self
.ribs
[
TypeNS
]
.pop
();
}
debug!
(
"(resolving block) leaving block"
);
...
...
@@ -4254,7 +4254,7 @@ fn find_module(&mut self,
while
let
Some
((
in_module
,
path_segments
))
=
worklist
.pop
()
{
// abort if the module is already found
if
let
Some
(
_
)
=
result
{
break
;
}
if
result
.is_some
()
{
break
;
}
self
.populate_module_if_necessary
(
in_module
);
...
...
src/librustc_save_analysis/json_dumper.rs
浏览文件 @
44d32d44
...
...
@@ -39,7 +39,7 @@ pub struct WriteOutput<'b, W: Write + 'b> {
impl
<
'b
,
W
:
Write
>
DumpOutput
for
WriteOutput
<
'b
,
W
>
{
fn
dump
(
&
mut
self
,
result
:
&
Analysis
)
{
if
let
Err
(
_
)
=
write!
(
self
.output
,
"{}"
,
as_json
(
&
result
)
)
{
if
write!
(
self
.output
,
"{}"
,
as_json
(
&
result
))
.is_err
(
)
{
error!
(
"Error writing output"
);
}
}
...
...
src/librustc_typeck/check/method/probe.rs
浏览文件 @
44d32d44
...
...
@@ -758,8 +758,9 @@ pub fn matches_return_type(&self,
self
.span
,
infer
::
FnCall
,
&
fty
);
if
let
Some
(
self_ty
)
=
self_ty
{
if
let
Err
(
_
)
=
self
.at
(
&
ObligationCause
::
dummy
(),
self
.param_env
)
.sup
(
fty
.inputs
()[
0
],
self_ty
)
if
self
.at
(
&
ObligationCause
::
dummy
(),
self
.param_env
)
.sup
(
fty
.inputs
()[
0
],
self_ty
)
.is_err
()
{
return
false
}
...
...
src/librustc_typeck/check/mod.rs
浏览文件 @
44d32d44
...
...
@@ -3915,7 +3915,7 @@ fn check_expr_kind(&self,
}
hir
::
ExprKind
::
Continue
(
destination
)
=>
{
if
let
Ok
(
_
)
=
destination
.target_id
{
if
destination
.target_id
.is_ok
()
{
tcx
.types.never
}
else
{
// There was an error, make typecheck fail
...
...
src/librustdoc/core.rs
浏览文件 @
44d32d44
...
...
@@ -486,7 +486,7 @@ pub fn run_core(search_paths: SearchPaths,
&
name
,
&
output_filenames
,
|
tcx
,
analysis
,
_
,
result
|
{
if
let
Err
(
_
)
=
result
{
if
result
.is_err
()
{
sess
.fatal
(
"Compilation failed, aborting rustdoc"
);
}
...
...
src/librustdoc/html/highlight.rs
浏览文件 @
44d32d44
...
...
@@ -44,7 +44,7 @@ pub fn render_with_highlighting(src: &str, class: Option<&str>,
write_header
(
class
,
&
mut
out
)
.unwrap
();
let
mut
classifier
=
Classifier
::
new
(
lexer
::
StringReader
::
new
(
&
sess
,
fm
,
None
),
sess
.codemap
());
if
let
Err
(
_
)
=
classifier
.write_source
(
&
mut
out
)
{
if
classifier
.write_source
(
&
mut
out
)
.is_err
(
)
{
return
format!
(
"<pre>{}</pre>"
,
src
);
}
...
...
src/librustdoc/html/markdown.rs
浏览文件 @
44d32d44
...
...
@@ -625,7 +625,7 @@ fn parse(string: &str, allow_error_code_check: ErrorCodes) -> LangString {
data
.no_run
=
true
;
}
x
if
allow_error_code_check
&&
x
.starts_with
(
"E"
)
&&
x
.len
()
==
5
=>
{
if
let
Ok
(
_
)
=
x
[
1
..
]
.parse
::
<
u32
>
()
{
if
x
[
1
..
]
.parse
::
<
u32
>
()
.is_ok
()
{
data
.error_codes
.push
(
x
.to_owned
());
seen_rust_tags
=
!
seen_other_tags
||
seen_rust_tags
;
}
else
{
...
...
src/libsyntax/test.rs
浏览文件 @
44d32d44
...
...
@@ -631,7 +631,7 @@ fn path_name_i(idents: &[Ident]) -> String {
let
mut
idents_iter
=
idents
.iter
()
.peekable
();
while
let
Some
(
ident
)
=
idents_iter
.next
()
{
path_name
.push_str
(
&
ident
.as_str
());
if
let
Some
(
_
)
=
idents_iter
.peek
()
{
if
idents_iter
.peek
()
.is_some
()
{
path_name
.push_str
(
"::"
)
}
}
...
...
src/libsyntax_ext/env.rs
浏览文件 @
44d32d44
...
...
@@ -81,7 +81,7 @@ pub fn expand_env<'cx>(cx: &'cx mut ExtCtxt,
}
};
if
let
Some
(
_
)
=
exprs
.next
()
{
if
exprs
.next
()
.is_some
()
{
cx
.span_err
(
sp
,
"env! takes 1 or 2 arguments"
);
return
DummyResult
::
expr
(
sp
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录