Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
53951afe
R
Rust
项目概览
int
/
Rust
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
53951afe
编写于
2月 15, 2013
作者:
E
Erick Tryzelaar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
librustc: convert lint_dict to take @~strs as keys
上级
04334c1a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
33 addition
and
28 deletion
+33
-28
src/librustc/driver/driver.rs
src/librustc/driver/driver.rs
+2
-2
src/librustc/middle/lint.rs
src/librustc/middle/lint.rs
+30
-25
src/librustc/rustc.rc
src/librustc/rustc.rc
+1
-1
未找到文件。
src/librustc/driver/driver.rs
浏览文件 @
53951afe
...
...
@@ -541,11 +541,11 @@ pub fn build_session_options(+binary: ~str,
let
flags
=
vec
::
append
(
getopts
::
opt_strs
(
matches
,
level_short
),
getopts
::
opt_strs
(
matches
,
level_name
));
for
flags
.each
|
lint_name
|
{
let
lint_name
=
str
::
replace
(
*
lint_name
,
~
"-"
,
~
"_"
);
let
lint_name
=
@
str
::
replace
(
*
lint_name
,
~
"-"
,
~
"_"
);
match
lint_dict
.find
(
&
lint_name
)
{
None
=>
{
early_error
(
demitter
,
fmt!
(
"unknown %s flag: %s"
,
level_name
,
lint_name
));
level_name
,
*
lint_name
));
}
Some
(
lint
)
=>
{
lint_opts
.push
((
lint
.lint
,
*
level
));
...
...
src/librustc/middle/lint.rs
浏览文件 @
53951afe
...
...
@@ -117,7 +117,7 @@ impl cmp::Eq for level {
desc
:
&
static
/
str
,
default
:
level
};
pub
type
lint_dict
=
HashMap
<
~
str
,
lint_spec
>
;
pub
type
lint_dict
=
HashMap
<
@~
str
,
lint_spec
>
;
/*
Pass names should not contain a '-', as the compiler normalizes
...
...
@@ -125,109 +125,109 @@ impl cmp::Eq for level {
*/
pub
fn
get_lint_dict
()
->
lint_dict
{
let
v
=
~
[
(
~
"ctypes"
,
(
@
~
"ctypes"
,
@
{
lint
:
ctypes
,
desc
:
"proper use of core::libc types in foreign modules"
,
default
:
warn
}),
(
~
"unused_imports"
,
(
@
~
"unused_imports"
,
@
{
lint
:
unused_imports
,
desc
:
"imports that are never used"
,
default
:
allow
}),
(
~
"while_true"
,
(
@
~
"while_true"
,
@
{
lint
:
while_true
,
desc
:
"suggest using loop { } instead of while(true) { }"
,
default
:
warn
}),
(
~
"path_statement"
,
(
@
~
"path_statement"
,
@
{
lint
:
path_statement
,
desc
:
"path statements with no effect"
,
default
:
warn
}),
(
~
"unrecognized_lint"
,
(
@
~
"unrecognized_lint"
,
@
{
lint
:
unrecognized_lint
,
desc
:
"unrecognized lint attribute"
,
default
:
warn
}),
(
~
"non_implicitly_copyable_typarams"
,
(
@
~
"non_implicitly_copyable_typarams"
,
@
{
lint
:
non_implicitly_copyable_typarams
,
desc
:
"passing non implicitly copyable types as copy type params"
,
default
:
warn
}),
(
~
"vecs_implicitly_copyable"
,
(
@
~
"vecs_implicitly_copyable"
,
@
{
lint
:
vecs_implicitly_copyable
,
desc
:
"make vecs and strs not implicitly copyable
\
(only checked at top level)"
,
default
:
warn
}),
(
~
"implicit_copies"
,
(
@
~
"implicit_copies"
,
@
{
lint
:
implicit_copies
,
desc
:
"implicit copies of non implicitly copyable data"
,
default
:
warn
}),
(
~
"deprecated_mode"
,
(
@
~
"deprecated_mode"
,
@
{
lint
:
deprecated_mode
,
desc
:
"warn about deprecated uses of modes"
,
default
:
warn
}),
(
~
"deprecated_pattern"
,
(
@
~
"deprecated_pattern"
,
@
{
lint
:
deprecated_pattern
,
desc
:
"warn about deprecated uses of pattern bindings"
,
default
:
allow
}),
(
~
"non_camel_case_types"
,
(
@
~
"non_camel_case_types"
,
@
{
lint
:
non_camel_case_types
,
desc
:
"types, variants and traits should have camel case names"
,
default
:
allow
}),
(
~
"managed_heap_memory"
,
(
@
~
"managed_heap_memory"
,
@
{
lint
:
managed_heap_memory
,
desc
:
"use of managed (@ type) heap memory"
,
default
:
allow
}),
(
~
"owned_heap_memory"
,
(
@
~
"owned_heap_memory"
,
@
{
lint
:
owned_heap_memory
,
desc
:
"use of owned (~ type) heap memory"
,
default
:
allow
}),
(
~
"heap_memory"
,
(
@
~
"heap_memory"
,
@
{
lint
:
heap_memory
,
desc
:
"use of any (~ type or @ type) heap memory"
,
default
:
allow
}),
(
~
"structural_records"
,
(
@
~
"structural_records"
,
@
{
lint
:
structural_records
,
desc
:
"use of any structural records"
,
default
:
deny
}),
(
~
"legacy modes"
,
(
@
~
"legacy modes"
,
@
{
lint
:
legacy_modes
,
desc
:
"allow legacy modes"
,
default
:
forbid
}),
(
~
"type_limits"
,
(
@
~
"type_limits"
,
@
{
lint
:
type_limits
,
desc
:
"comparisons made useless by limits of the types involved"
,
default
:
warn
}),
(
~
"default_methods"
,
(
@
~
"default_methods"
,
@
{
lint
:
default_methods
,
desc
:
"allow default methods"
,
default
:
deny
}),
(
~
"deprecated_self"
,
(
@
~
"deprecated_self"
,
@
{
lint
:
deprecated_self
,
desc
:
"warn about deprecated uses of `self`"
,
default
:
warn
}),
/* FIXME(#3266)--make liveness warnings lintable
(~"unused_variable",
(
@
~"unused_variable",
@{lint: unused_variable,
desc: "detect variables which are not used in any way",
default: warn}),
(~"dead_assignment",
(
@
~"dead_assignment",
@{lint: dead_assignment,
desc: "detect assignments that will never be read",
default: warn}),
...
...
@@ -344,9 +344,14 @@ fn with_lint_attrs(attrs: ~[ast::attribute], f: fn(ctxt)) {
}
}
for
triples
.each
|
pair
|
{
let
(
meta
,
level
,
lintname
)
=
/*bad*/
copy
*
pair
;
match
self
.dict
.find
(
&*
lintname
)
{
for
triples
.each
|
triple
|
{
// FIXME(#3874): it would be nicer to write this...
// let (meta, level, lintname) = /*bad*/copy *pair;
let
(
meta
,
level
,
lintname
)
=
match
*
triple
{
(
ref
meta
,
level
,
lintname
)
=>
(
meta
,
level
,
lintname
)
};
match
self
.dict
.find
(
&
lintname
)
{
None
=>
{
self
.span_lint
(
new_ctxt
.get_level
(
unrecognized_lint
),
...
...
src/librustc/rustc.rc
浏览文件 @
53951afe
...
...
@@ -187,7 +187,7 @@ Available lint options:
io::println(fmt!(" %s %7.7s %s\n",
padded(max_key, ~"----"), ~"-------", ~"-------"));
for lint_dict.each |&k, &v| {
let k = str::replace(k, ~"_", ~"-");
let k = str::replace(
*
k, ~"_", ~"-");
io::println(fmt!(" %s %7.7s %s",
padded(max_key, k),
match v.default {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录