Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
821b8366
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,发现更多精彩内容 >>
提交
821b8366
编写于
12月 09, 2014
作者:
J
Jorge Aparicio
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
librustc: use tuple indexing
上级
c434954b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
13 addition
and
14 deletion
+13
-14
src/librustc/lint/context.rs
src/librustc/lint/context.rs
+7
-8
src/librustc/metadata/loader.rs
src/librustc/metadata/loader.rs
+3
-3
src/librustc/middle/check_match.rs
src/librustc/middle/check_match.rs
+1
-1
src/librustc_borrowck/graphviz.rs
src/librustc_borrowck/graphviz.rs
+2
-2
未找到文件。
src/librustc/lint/context.rs
浏览文件 @
821b8366
...
@@ -34,7 +34,6 @@
...
@@ -34,7 +34,6 @@
use
util
::
nodemap
::
FnvHashMap
;
use
util
::
nodemap
::
FnvHashMap
;
use
std
::
cell
::
RefCell
;
use
std
::
cell
::
RefCell
;
use
std
::
tuple
::
Tuple2
;
use
std
::
mem
;
use
std
::
mem
;
use
syntax
::
ast_util
::
IdVisitingOperation
;
use
syntax
::
ast_util
::
IdVisitingOperation
;
use
syntax
::
attr
::
AttrMetaMethods
;
use
syntax
::
attr
::
AttrMetaMethods
;
...
@@ -87,7 +86,7 @@ fn get_level_source(&self, lint: LintId) -> LevelSource {
...
@@ -87,7 +86,7 @@ fn get_level_source(&self, lint: LintId) -> LevelSource {
}
}
fn
set_level
(
&
mut
self
,
lint
:
LintId
,
lvlsrc
:
LevelSource
)
{
fn
set_level
(
&
mut
self
,
lint
:
LintId
,
lvlsrc
:
LevelSource
)
{
if
lvlsrc
.
val0
()
==
Allow
{
if
lvlsrc
.
0
==
Allow
{
self
.levels
.remove
(
&
lint
);
self
.levels
.remove
(
&
lint
);
}
else
{
}
else
{
self
.levels
.insert
(
lint
,
lvlsrc
);
self
.levels
.insert
(
lint
,
lvlsrc
);
...
@@ -110,8 +109,8 @@ pub fn get_lints<'t>(&'t self) -> &'t [(&'static Lint, bool)] {
...
@@ -110,8 +109,8 @@ pub fn get_lints<'t>(&'t self) -> &'t [(&'static Lint, bool)] {
pub
fn
get_lint_groups
<
't
>
(
&
't
self
)
->
Vec
<
(
&
'static
str
,
Vec
<
LintId
>
,
bool
)
>
{
pub
fn
get_lint_groups
<
't
>
(
&
't
self
)
->
Vec
<
(
&
'static
str
,
Vec
<
LintId
>
,
bool
)
>
{
self
.lint_groups
.iter
()
.map
(|(
k
,
v
)|
(
*
k
,
self
.lint_groups
.iter
()
.map
(|(
k
,
v
)|
(
*
k
,
v
.
ref0
()
.clone
(),
v
.
0
.clone
(),
*
v
.ref1
()
))
.collect
()
v
.1
))
.collect
()
}
}
pub
fn
register_pass
(
&
mut
self
,
sess
:
Option
<&
Session
>
,
pub
fn
register_pass
(
&
mut
self
,
sess
:
Option
<&
Session
>
,
...
@@ -275,7 +274,7 @@ pub fn process_command_line(&mut self, sess: &Session) {
...
@@ -275,7 +274,7 @@ pub fn process_command_line(&mut self, sess: &Session) {
match
self
.find_lint
(
lint_name
.as_slice
(),
sess
,
None
)
{
match
self
.find_lint
(
lint_name
.as_slice
(),
sess
,
None
)
{
Some
(
lint_id
)
=>
self
.set_level
(
lint_id
,
(
level
,
CommandLine
)),
Some
(
lint_id
)
=>
self
.set_level
(
lint_id
,
(
level
,
CommandLine
)),
None
=>
{
None
=>
{
match
self
.lint_groups
.iter
()
.map
(|(
&
x
,
pair
)|
(
x
,
pair
.
ref0
()
.clone
()))
match
self
.lint_groups
.iter
()
.map
(|(
&
x
,
pair
)|
(
x
,
pair
.
0
.clone
()))
.collect
::
<
FnvHashMap
<&
'static
str
,
.collect
::
<
FnvHashMap
<&
'static
str
,
Vec
<
LintId
>>>
()
Vec
<
LintId
>>>
()
.get
(
lint_name
.as_slice
())
{
.get
(
lint_name
.as_slice
())
{
...
@@ -443,7 +442,7 @@ fn lookup_and_emit(&self, lint: &'static Lint, span: Option<Span>, msg: &str) {
...
@@ -443,7 +442,7 @@ fn lookup_and_emit(&self, lint: &'static Lint, span: Option<Span>, msg: &str) {
None
=>
return
,
None
=>
return
,
Some
(
&
(
Warn
,
src
))
=>
{
Some
(
&
(
Warn
,
src
))
=>
{
let
lint_id
=
LintId
::
of
(
builtin
::
WARNINGS
);
let
lint_id
=
LintId
::
of
(
builtin
::
WARNINGS
);
(
self
.lints
.get_level_source
(
lint_id
)
.
val0
()
,
src
)
(
self
.lints
.get_level_source
(
lint_id
)
.
0
,
src
)
}
}
Some
(
&
pair
)
=>
pair
,
Some
(
&
pair
)
=>
pair
,
};
};
...
@@ -503,7 +502,7 @@ fn with_lint_attrs<F>(&mut self,
...
@@ -503,7 +502,7 @@ fn with_lint_attrs<F>(&mut self,
};
};
for
(
lint_id
,
level
,
span
)
in
v
.into_iter
()
{
for
(
lint_id
,
level
,
span
)
in
v
.into_iter
()
{
let
now
=
self
.lints
.get_level_source
(
lint_id
)
.
val0
()
;
let
now
=
self
.lints
.get_level_source
(
lint_id
)
.
0
;
if
now
==
Forbid
&&
level
!=
Forbid
{
if
now
==
Forbid
&&
level
!=
Forbid
{
let
lint_name
=
lint_id
.as_str
();
let
lint_name
=
lint_id
.as_str
();
self
.tcx.sess
.span_err
(
span
,
self
.tcx.sess
.span_err
(
span
,
...
@@ -511,7 +510,7 @@ fn with_lint_attrs<F>(&mut self,
...
@@ -511,7 +510,7 @@ fn with_lint_attrs<F>(&mut self,
level
.as_str
(),
lint_name
,
level
.as_str
(),
lint_name
,
lint_name
)
.as_slice
());
lint_name
)
.as_slice
());
}
else
if
now
!=
level
{
}
else
if
now
!=
level
{
let
src
=
self
.lints
.get_level_source
(
lint_id
)
.
val1
()
;
let
src
=
self
.lints
.get_level_source
(
lint_id
)
.
1
;
self
.level_stack
.push
((
lint_id
,
(
now
,
src
)));
self
.level_stack
.push
((
lint_id
,
(
now
,
src
)));
pushed
+=
1
;
pushed
+=
1
;
self
.lints
.set_level
(
lint_id
,
(
level
,
Node
(
span
)));
self
.lints
.set_level
(
lint_id
,
(
level
,
Node
(
span
)));
...
...
src/librustc/metadata/loader.rs
浏览文件 @
821b8366
...
@@ -364,7 +364,7 @@ fn find_library_crate(&mut self) -> Option<Library> {
...
@@ -364,7 +364,7 @@ fn find_library_crate(&mut self) -> Option<Library> {
let
dypair
=
self
.dylibname
();
let
dypair
=
self
.dylibname
();
// want: crate_name.dir_part() + prefix + crate_name.file_part + "-"
// want: crate_name.dir_part() + prefix + crate_name.file_part + "-"
let
dylib_prefix
=
format!
(
"{}{}"
,
dypair
.
ref0
()
,
self
.crate_name
);
let
dylib_prefix
=
format!
(
"{}{}"
,
dypair
.
0
,
self
.crate_name
);
let
rlib_prefix
=
format!
(
"lib{}"
,
self
.crate_name
);
let
rlib_prefix
=
format!
(
"lib{}"
,
self
.crate_name
);
let
mut
candidates
=
HashMap
::
new
();
let
mut
candidates
=
HashMap
::
new
();
...
@@ -392,8 +392,8 @@ fn find_library_crate(&mut self) -> Option<Library> {
...
@@ -392,8 +392,8 @@ fn find_library_crate(&mut self) -> Option<Library> {
(
file
.slice
(
rlib_prefix
.len
(),
file
.len
()
-
".rlib"
.len
()),
(
file
.slice
(
rlib_prefix
.len
(),
file
.len
()
-
".rlib"
.len
()),
true
)
true
)
}
else
if
file
.starts_with
(
dylib_prefix
.as_slice
())
&&
}
else
if
file
.starts_with
(
dylib_prefix
.as_slice
())
&&
file
.ends_with
(
dypair
.
ref1
()
.as_slice
())
{
file
.ends_with
(
dypair
.
1
.as_slice
())
{
(
file
.slice
(
dylib_prefix
.len
(),
file
.len
()
-
dypair
.
ref1
()
.len
()),
(
file
.slice
(
dylib_prefix
.len
(),
file
.len
()
-
dypair
.
1
.len
()),
false
)
false
)
}
else
{
}
else
{
return
FileDoesntMatch
return
FileDoesntMatch
...
...
src/librustc/middle/check_match.rs
浏览文件 @
821b8366
...
@@ -220,7 +220,7 @@ fn check_expr(cx: &mut MatchCheckCtxt, ex: &ast::Expr) {
...
@@ -220,7 +220,7 @@ fn check_expr(cx: &mut MatchCheckCtxt, ex: &ast::Expr) {
let
matrix
:
Matrix
=
inlined_arms
let
matrix
:
Matrix
=
inlined_arms
.iter
()
.iter
()
.filter
(|
&&
(
_
,
guard
)|
guard
.is_none
())
.filter
(|
&&
(
_
,
guard
)|
guard
.is_none
())
.flat_map
(|
arm
|
arm
.
ref0
()
.iter
())
.flat_map
(|
arm
|
arm
.
0
.iter
())
.map
(|
pat
|
vec!
[
&**
pat
])
.map
(|
pat
|
vec!
[
&**
pat
])
.collect
();
.collect
();
check_exhaustive
(
cx
,
ex
.span
,
&
matrix
);
check_exhaustive
(
cx
,
ex
.span
,
&
matrix
);
...
...
src/librustc_borrowck/graphviz.rs
浏览文件 @
821b8366
...
@@ -53,7 +53,7 @@ pub struct DataflowLabeller<'a, 'tcx: 'a> {
...
@@ -53,7 +53,7 @@ pub struct DataflowLabeller<'a, 'tcx: 'a> {
impl
<
'a
,
'tcx
>
DataflowLabeller
<
'a
,
'tcx
>
{
impl
<
'a
,
'tcx
>
DataflowLabeller
<
'a
,
'tcx
>
{
fn
dataflow_for
(
&
self
,
e
:
EntryOrExit
,
n
:
&
Node
<
'a
>
)
->
String
{
fn
dataflow_for
(
&
self
,
e
:
EntryOrExit
,
n
:
&
Node
<
'a
>
)
->
String
{
let
id
=
n
.
val1
()
.data.id
;
let
id
=
n
.
1
.data.id
;
debug!
(
"dataflow_for({}, id={}) {}"
,
e
,
id
,
self
.variants
);
debug!
(
"dataflow_for({}, id={}) {}"
,
e
,
id
,
self
.variants
);
let
mut
sets
=
""
.to_string
();
let
mut
sets
=
""
.to_string
();
let
mut
seen_one
=
false
;
let
mut
seen_one
=
false
;
...
@@ -67,7 +67,7 @@ fn dataflow_for(&self, e: EntryOrExit, n: &Node<'a>) -> String {
...
@@ -67,7 +67,7 @@ fn dataflow_for(&self, e: EntryOrExit, n: &Node<'a>) -> String {
}
}
fn
dataflow_for_variant
(
&
self
,
e
:
EntryOrExit
,
n
:
&
Node
,
v
:
Variant
)
->
String
{
fn
dataflow_for_variant
(
&
self
,
e
:
EntryOrExit
,
n
:
&
Node
,
v
:
Variant
)
->
String
{
let
cfgidx
=
n
.
val0
()
;
let
cfgidx
=
n
.
0
;
match
v
{
match
v
{
Loans
=>
self
.dataflow_loans_for
(
e
,
cfgidx
),
Loans
=>
self
.dataflow_loans_for
(
e
,
cfgidx
),
Moves
=>
self
.dataflow_moves_for
(
e
,
cfgidx
),
Moves
=>
self
.dataflow_moves_for
(
e
,
cfgidx
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录