Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
c4d577be
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,发现更多精彩内容 >>
提交
c4d577be
编写于
8月 12, 2016
作者:
J
Jeffrey Seyfried
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor away variant `hir::PathListItem_::Mod`
and refacotor `hir::PathListItem_::Ident` -> `hir::PathListItem_`.
上级
98ce875b
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
25 addition
and
72 deletion
+25
-72
src/librustc/hir/fold.rs
src/librustc/hir/fold.rs
+4
-10
src/librustc/hir/intravisit.rs
src/librustc/hir/intravisit.rs
+6
-6
src/librustc/hir/lowering.rs
src/librustc/hir/lowering.rs
+1
-1
src/librustc/hir/map/collector.rs
src/librustc/hir/map/collector.rs
+1
-1
src/librustc/hir/mod.rs
src/librustc/hir/mod.rs
+5
-34
src/librustc/hir/print.rs
src/librustc/hir/print.rs
+1
-10
src/librustc/middle/dead.rs
src/librustc/middle/dead.rs
+1
-1
src/librustc/middle/stability.rs
src/librustc/middle/stability.rs
+1
-1
src/librustc_lint/unused.rs
src/librustc_lint/unused.rs
+4
-7
src/librustc_typeck/check_unused.rs
src/librustc_typeck/check_unused.rs
+1
-1
未找到文件。
src/librustc/hir/fold.rs
浏览文件 @
c4d577be
...
...
@@ -271,16 +271,10 @@ pub fn noop_fold_view_path<T: Folder>(view_path: P<ViewPath>, fld: &mut T) -> P<
ViewPathList
(
fld
.fold_path
(
path
),
path_list_idents
.move_map
(|
path_list_ident
|
{
Spanned
{
node
:
match
path_list_ident
.node
{
PathListIdent
{
id
,
name
,
rename
}
=>
PathListIdent
{
id
:
fld
.new_id
(
id
),
name
:
name
,
rename
:
rename
,
},
PathListMod
{
id
,
rename
}
=>
PathListMod
{
id
:
fld
.new_id
(
id
),
rename
:
rename
,
},
node
:
PathListItem_
{
id
:
fld
.new_id
(
path_list_ident
.node.id
),
name
:
path_list_ident
.node.name
,
rename
:
path_list_ident
.node.rename
,
},
span
:
fld
.new_span
(
path_list_ident
.span
),
}
...
...
src/librustc/hir/intravisit.rs
浏览文件 @
c4d577be
...
...
@@ -444,12 +444,12 @@ pub fn walk_path<'v, V: Visitor<'v>>(visitor: &mut V, path: &'v Path) {
}
}
pub
fn
walk_path_list_item
<
'v
,
V
:
Visitor
<
'v
>>
(
visitor
:
&
mut
V
,
_
prefix
:
&
'v
Path
,
item
:
&
'v
PathListItem
)
{
visitor
.visit_id
(
item
.node
.id
()
);
walk_opt_name
(
visitor
,
item
.span
,
item
.node
.name
()
);
walk_opt_name
(
visitor
,
item
.span
,
item
.node
.rename
()
);
pub
fn
walk_path_list_item
<
'v
,
V
>
(
visitor
:
&
mut
V
,
_
prefix
:
&
'v
Path
,
item
:
&
'v
PathListItem
)
where
V
:
Visitor
<
'v
>
,
{
visitor
.visit_id
(
item
.node.id
);
visitor
.visit_name
(
item
.span
,
item
.node.name
);
walk_opt_name
(
visitor
,
item
.span
,
item
.node.rename
);
}
pub
fn
walk_path_segment
<
'v
,
V
:
Visitor
<
'v
>>
(
visitor
:
&
mut
V
,
...
...
src/librustc/hir/lowering.rs
浏览文件 @
c4d577be
...
...
@@ -218,7 +218,7 @@ fn lower_view_path(&mut self, view_path: &ViewPath) -> P<hir::ViewPath> {
fn
lower_path_list_item
(
&
mut
self
,
path_list_ident
:
&
PathListItem
)
->
hir
::
PathListItem
{
Spanned
{
node
:
hir
::
PathListI
dent
{
node
:
hir
::
PathListI
tem_
{
id
:
path_list_ident
.node.id
,
name
:
path_list_ident
.node.name.name
,
rename
:
path_list_ident
.node.rename
.map
(|
rename
|
rename
.name
),
...
...
src/librustc/hir/map/collector.rs
浏览文件 @
c4d577be
...
...
@@ -120,7 +120,7 @@ fn visit_item(&mut self, i: &'ast Item) {
match
view_path
.node
{
ViewPathList
(
_
,
ref
paths
)
=>
{
for
path
in
paths
{
this
.insert
(
path
.node
.id
()
,
NodeItem
(
i
));
this
.insert
(
path
.node.id
,
NodeItem
(
i
));
}
}
_
=>
()
...
...
src/librustc/hir/mod.rs
浏览文件 @
c4d577be
...
...
@@ -20,7 +20,6 @@
pub
use
self
::
ForeignItem_
::
*
;
pub
use
self
::
Item_
::
*
;
pub
use
self
::
Mutability
::
*
;
pub
use
self
::
PathListItem_
::
*
;
pub
use
self
::
PrimTy
::
*
;
pub
use
self
::
Stmt_
::
*
;
pub
use
self
::
TraitItem_
::
*
;
...
...
@@ -1337,39 +1336,11 @@ pub struct Variant_ {
pub
type
Variant
=
Spanned
<
Variant_
>
;
#[derive(Clone,
PartialEq,
Eq,
RustcEncodable,
RustcDecodable,
Hash,
Debug,
Copy)]
pub
enum
PathListItem_
{
PathListIdent
{
name
:
Name
,
/// renamed in list, eg `use foo::{bar as baz};`
rename
:
Option
<
Name
>
,
id
:
NodeId
,
},
PathListMod
{
/// renamed in list, eg `use foo::{self as baz};`
rename
:
Option
<
Name
>
,
id
:
NodeId
,
},
}
impl
PathListItem_
{
pub
fn
id
(
&
self
)
->
NodeId
{
match
*
self
{
PathListIdent
{
id
,
..
}
|
PathListMod
{
id
,
..
}
=>
id
,
}
}
pub
fn
name
(
&
self
)
->
Option
<
Name
>
{
match
*
self
{
PathListIdent
{
name
,
..
}
=>
Some
(
name
),
PathListMod
{
..
}
=>
None
,
}
}
pub
fn
rename
(
&
self
)
->
Option
<
Name
>
{
match
*
self
{
PathListIdent
{
rename
,
..
}
|
PathListMod
{
rename
,
..
}
=>
rename
,
}
}
pub
struct
PathListItem_
{
pub
name
:
Name
,
/// renamed in list, eg `use foo::{bar as baz};`
pub
rename
:
Option
<
Name
>
,
pub
id
:
NodeId
,
}
pub
type
PathListItem
=
Spanned
<
PathListItem_
>
;
...
...
src/librustc/hir/print.rs
浏览文件 @
c4d577be
...
...
@@ -2133,16 +2133,7 @@ pub fn print_view_path(&mut self, vp: &hir::ViewPath) -> io::Result<()> {
self
.print_path
(
path
,
false
,
0
)
?
;
word
(
&
mut
self
.s
,
"::{"
)
?
;
}
self
.commasep
(
Inconsistent
,
&
segments
[
..
],
|
s
,
w
|
{
match
w
.node
{
hir
::
PathListIdent
{
name
,
..
}
=>
{
s
.print_name
(
name
)
}
hir
::
PathListMod
{
..
}
=>
{
word
(
&
mut
s
.s
,
"self"
)
}
}
})
?
;
self
.commasep
(
Inconsistent
,
&
segments
[
..
],
|
s
,
w
|
s
.print_name
(
w
.node.name
))
?
;
word
(
&
mut
self
.s
,
"}"
)
}
}
...
...
src/librustc/middle/dead.rs
浏览文件 @
c4d577be
...
...
@@ -294,7 +294,7 @@ fn visit_path(&mut self, path: &hir::Path, id: ast::NodeId) {
}
fn
visit_path_list_item
(
&
mut
self
,
path
:
&
hir
::
Path
,
item
:
&
hir
::
PathListItem
)
{
self
.lookup_and_handle_definition
(
item
.node
.id
()
);
self
.lookup_and_handle_definition
(
item
.node.id
);
intravisit
::
walk_path_list_item
(
self
,
path
,
item
);
}
}
...
...
src/librustc/middle/stability.rs
浏览文件 @
c4d577be
...
...
@@ -631,7 +631,7 @@ pub fn check_path_list_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
cb
:
&
mut
FnMut
(
DefId
,
Span
,
&
Option
<&
Stability
>
,
&
Option
<
DeprecationEntry
>
))
{
match
tcx
.expect_def
(
item
.node
.id
()
)
{
match
tcx
.expect_def
(
item
.node.id
)
{
Def
::
PrimTy
(
..
)
=>
{}
def
=>
{
maybe_do_stability_check
(
tcx
,
def
.def_id
(),
item
.span
,
cb
);
...
...
src/librustc_lint/unused.rs
浏览文件 @
c4d577be
...
...
@@ -20,6 +20,7 @@
use
syntax
::
ast
;
use
syntax
::
attr
::{
self
,
AttrMetaMethods
};
use
syntax
::
feature_gate
::{
KNOWN_ATTRIBUTES
,
AttributeType
};
use
syntax
::
parse
::
token
::
keywords
;
use
syntax
::
ptr
::
P
;
use
syntax_pos
::
Span
;
...
...
@@ -392,13 +393,9 @@ impl LateLintPass for UnusedImportBraces {
fn
check_item
(
&
mut
self
,
cx
:
&
LateContext
,
item
:
&
hir
::
Item
)
{
if
let
hir
::
ItemUse
(
ref
view_path
)
=
item
.node
{
if
let
hir
::
ViewPathList
(
_
,
ref
items
)
=
view_path
.node
{
if
items
.len
()
==
1
{
if
let
hir
::
PathListIdent
{
ref
name
,
..
}
=
items
[
0
]
.node
{
let
m
=
format!
(
"braces around {} is unnecessary"
,
name
);
cx
.span_lint
(
UNUSED_IMPORT_BRACES
,
item
.span
,
&
m
[
..
]);
}
if
items
.len
()
==
1
&&
items
[
0
]
.node.name
!=
keywords
::
SelfValue
.name
()
{
let
msg
=
format!
(
"braces around {} is unnecessary"
,
items
[
0
]
.node.name
);
cx
.span_lint
(
UNUSED_IMPORT_BRACES
,
item
.span
,
&
msg
);
}
}
}
...
...
src/librustc_typeck/check_unused.rs
浏览文件 @
c4d577be
...
...
@@ -49,7 +49,7 @@ fn visit_item(&mut self, item: &hir::Item) {
}
hir
::
ViewPathList
(
_
,
ref
path_list
)
=>
{
for
path_item
in
path_list
{
self
.check_import
(
path_item
.node
.id
()
,
path_item
.span
);
self
.check_import
(
path_item
.node.id
,
path_item
.span
);
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录