Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
4d537141
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,发现更多精彩内容 >>
提交
4d537141
编写于
6月 23, 2019
作者:
M
Mazdak Farrokhzad
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove redundant syntax::ast::Guard.
上级
a96ba969
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
14 addition
and
36 deletion
+14
-36
src/librustc/hir/lowering.rs
src/librustc/hir/lowering.rs
+1
-1
src/librustc_resolve/lib.rs
src/librustc_resolve/lib.rs
+1
-1
src/librustc_save_analysis/dump_visitor.rs
src/librustc_save_analysis/dump_visitor.rs
+2
-3
src/libsyntax/ast.rs
src/libsyntax/ast.rs
+1
-6
src/libsyntax/mut_visit.rs
src/libsyntax/mut_visit.rs
+1
-11
src/libsyntax/parse/parser.rs
src/libsyntax/parse/parser.rs
+2
-2
src/libsyntax/print/pprust.rs
src/libsyntax/print/pprust.rs
+4
-8
src/libsyntax/visit.rs
src/libsyntax/visit.rs
+2
-4
未找到文件。
src/librustc/hir/lowering.rs
浏览文件 @
4d537141
...
...
@@ -1382,7 +1382,7 @@ fn lower_arm(&mut self, arm: &Arm) -> hir::Arm {
attrs
:
self
.lower_attrs
(
&
arm
.attrs
),
pats
:
arm
.pats
.iter
()
.map
(|
x
|
self
.lower_pat
(
x
))
.collect
(),
guard
:
match
arm
.guard
{
Some
(
Guard
::
If
(
ref
x
)
)
=>
Some
(
hir
::
Guard
::
If
(
P
(
self
.lower_expr
(
x
)))),
Some
(
ref
x
)
=>
Some
(
hir
::
Guard
::
If
(
P
(
self
.lower_expr
(
x
)))),
_
=>
None
,
},
body
:
P
(
self
.lower_expr
(
&
arm
.body
)),
...
...
src/librustc_resolve/lib.rs
浏览文件 @
4d537141
...
...
@@ -3065,7 +3065,7 @@ fn resolve_arm(&mut self, arm: &Arm) {
// This has to happen *after* we determine which pat_idents are variants.
self
.check_consistent_bindings
(
&
arm
.pats
);
if
let
Some
(
ast
::
Guard
::
If
(
ref
expr
)
)
=
arm
.guard
{
if
let
Some
(
ref
expr
)
=
arm
.guard
{
self
.visit_expr
(
expr
)
}
self
.visit_expr
(
&
arm
.body
);
...
...
src/librustc_save_analysis/dump_visitor.rs
浏览文件 @
4d537141
...
...
@@ -1617,9 +1617,8 @@ fn visit_pat(&mut self, p: &'l ast::Pat) {
fn
visit_arm
(
&
mut
self
,
arm
:
&
'l
ast
::
Arm
)
{
self
.process_var_decl_multi
(
&
arm
.pats
);
match
arm
.guard
{
Some
(
ast
::
Guard
::
If
(
ref
expr
))
=>
self
.visit_expr
(
expr
),
_
=>
{}
if
let
Some
(
expr
)
=
&
arm
.guard
{
self
.visit_expr
(
expr
);
}
self
.visit_expr
(
&
arm
.body
);
}
...
...
src/libsyntax/ast.rs
浏览文件 @
4d537141
...
...
@@ -893,16 +893,11 @@ pub struct Local {
pub
struct
Arm
{
pub
attrs
:
Vec
<
Attribute
>
,
pub
pats
:
Vec
<
P
<
Pat
>>
,
pub
guard
:
Option
<
Guard
>
,
pub
guard
:
Option
<
P
<
Expr
>
>
,
pub
body
:
P
<
Expr
>
,
pub
span
:
Span
,
}
#[derive(Clone,
RustcEncodable,
RustcDecodable,
Debug)]
pub
enum
Guard
{
If
(
P
<
Expr
>
),
}
#[derive(Clone,
RustcEncodable,
RustcDecodable,
Debug)]
pub
struct
Field
{
pub
ident
:
Ident
,
...
...
src/libsyntax/mut_visit.rs
浏览文件 @
4d537141
...
...
@@ -131,10 +131,6 @@ fn visit_arm(&mut self, a: &mut Arm) {
noop_visit_arm
(
a
,
self
);
}
fn
visit_guard
(
&
mut
self
,
g
:
&
mut
Guard
)
{
noop_visit_guard
(
g
,
self
);
}
fn
visit_pat
(
&
mut
self
,
p
:
&
mut
P
<
Pat
>
)
{
noop_visit_pat
(
p
,
self
);
}
...
...
@@ -389,17 +385,11 @@ pub fn noop_visit_arm<T: MutVisitor>(
)
{
visit_attrs
(
attrs
,
vis
);
visit_vec
(
pats
,
|
pat
|
vis
.visit_pat
(
pat
));
visit_opt
(
guard
,
|
guard
|
vis
.visit_
guard
(
guard
));
visit_opt
(
guard
,
|
guard
|
vis
.visit_
expr
(
guard
));
vis
.visit_expr
(
body
);
vis
.visit_span
(
span
);
}
pub
fn
noop_visit_guard
<
T
:
MutVisitor
>
(
g
:
&
mut
Guard
,
vis
:
&
mut
T
)
{
match
g
{
Guard
::
If
(
e
)
=>
vis
.visit_expr
(
e
),
}
}
pub
fn
noop_visit_ty_constraint
<
T
:
MutVisitor
>
(
AssocTyConstraint
{
id
,
ident
,
kind
,
span
}:
&
mut
AssocTyConstraint
,
vis
:
&
mut
T
...
...
src/libsyntax/parse/parser.rs
浏览文件 @
4d537141
...
...
@@ -3,7 +3,7 @@
use
crate
::
ast
::{
AngleBracketedArgs
,
ParenthesizedArgs
,
AttrStyle
,
BareFnTy
};
use
crate
::
ast
::{
GenericBound
,
TraitBoundModifier
};
use
crate
::
ast
::
Unsafety
;
use
crate
::
ast
::{
Mod
,
AnonConst
,
Arg
,
Arm
,
Guard
,
Attribute
,
BindingMode
,
TraitItemKind
};
use
crate
::
ast
::{
Mod
,
AnonConst
,
Arg
,
Arm
,
Attribute
,
BindingMode
,
TraitItemKind
};
use
crate
::
ast
::
Block
;
use
crate
::
ast
::{
BlockCheckMode
,
CaptureBy
,
Movability
};
use
crate
::
ast
::{
Constness
,
Crate
};
...
...
@@ -3413,7 +3413,7 @@ fn parse_match_expr(&mut self, mut attrs: ThinVec<Attribute>) -> PResult<'a, P<E
let
lo
=
self
.token.span
;
let
pats
=
self
.parse_pats
()
?
;
let
guard
=
if
self
.eat_keyword
(
kw
::
If
)
{
Some
(
Guard
::
If
(
self
.parse_expr
()
?
)
)
Some
(
self
.parse_expr
()
?
)
}
else
{
None
};
...
...
src/libsyntax/print/pprust.rs
浏览文件 @
4d537141
...
...
@@ -2663,14 +2663,10 @@ fn print_arm(&mut self, arm: &ast::Arm) -> io::Result<()> {
self
.print_outer_attributes
(
&
arm
.attrs
)
?
;
self
.print_pats
(
&
arm
.pats
)
?
;
self
.s
.space
()
?
;
if
let
Some
(
ref
g
)
=
arm
.guard
{
match
g
{
ast
::
Guard
::
If
(
ref
e
)
=>
{
self
.word_space
(
"if"
)
?
;
self
.print_expr
(
e
)
?
;
self
.s
.space
()
?
;
}
}
if
let
Some
(
ref
e
)
=
arm
.guard
{
self
.word_space
(
"if"
)
?
;
self
.print_expr
(
e
)
?
;
self
.s
.space
()
?
;
}
self
.word_space
(
"=>"
)
?
;
...
...
src/libsyntax/visit.rs
浏览文件 @
4d537141
...
...
@@ -834,10 +834,8 @@ pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) {
pub
fn
walk_arm
<
'a
,
V
:
Visitor
<
'a
>>
(
visitor
:
&
mut
V
,
arm
:
&
'a
Arm
)
{
walk_list!
(
visitor
,
visit_pat
,
&
arm
.pats
);
if
let
Some
(
ref
g
)
=
&
arm
.guard
{
match
g
{
Guard
::
If
(
ref
e
)
=>
visitor
.visit_expr
(
e
),
}
if
let
Some
(
ref
e
)
=
&
arm
.guard
{
visitor
.visit_expr
(
e
);
}
visitor
.visit_expr
(
&
arm
.body
);
walk_list!
(
visitor
,
visit_attribute
,
&
arm
.attrs
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录