Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
86500fbb
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,发现更多精彩内容 >>
提交
86500fbb
编写于
5月 07, 2013
作者:
B
bors
浏览文件
操作
浏览文件
下载
差异文件
auto merge of #6297 : sammykim/rust/static-lint-table, r=luqmana
上级
5a1afaf5
356ebe87
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
145 addition
and
144 deletion
+145
-144
src/librustc/middle/lint.rs
src/librustc/middle/lint.rs
+145
-144
未找到文件。
src/librustc/middle/lint.rs
浏览文件 @
86500fbb
...
...
@@ -90,156 +90,157 @@ struct LintSpec {
pub
type
LintDict
=
@
HashMap
<~
str
,
LintSpec
>
;
static
lint_table
:
&
'static
[(
&
'static
str
,
LintSpec
)]
=
&
[
(
"ctypes"
,
LintSpec
{
lint
:
ctypes
,
desc
:
"proper use of core::libc types in foreign modules"
,
default
:
warn
}),
(
"unused_imports"
,
LintSpec
{
lint
:
unused_imports
,
desc
:
"imports that are never used"
,
default
:
warn
}),
(
"while_true"
,
LintSpec
{
lint
:
while_true
,
desc
:
"suggest using loop { } instead of while(true) { }"
,
default
:
warn
}),
(
"path_statement"
,
LintSpec
{
lint
:
path_statement
,
desc
:
"path statements with no effect"
,
default
:
warn
}),
(
"unrecognized_lint"
,
LintSpec
{
lint
:
unrecognized_lint
,
desc
:
"unrecognized lint attribute"
,
default
:
warn
}),
(
"non_implicitly_copyable_typarams"
,
LintSpec
{
lint
:
non_implicitly_copyable_typarams
,
desc
:
"passing non implicitly copyable types as copy type params"
,
default
:
warn
}),
(
"vecs_implicitly_copyable"
,
LintSpec
{
lint
:
vecs_implicitly_copyable
,
desc
:
"make vecs and strs not implicitly copyable
\
(only checked at top level)"
,
default
:
warn
}),
(
"implicit_copies"
,
LintSpec
{
lint
:
implicit_copies
,
desc
:
"implicit copies of non implicitly copyable data"
,
default
:
warn
}),
(
"deprecated_pattern"
,
LintSpec
{
lint
:
deprecated_pattern
,
desc
:
"warn about deprecated uses of pattern bindings"
,
default
:
allow
}),
(
"non_camel_case_types"
,
LintSpec
{
lint
:
non_camel_case_types
,
desc
:
"types, variants and traits should have camel case names"
,
default
:
allow
}),
(
"managed_heap_memory"
,
LintSpec
{
lint
:
managed_heap_memory
,
desc
:
"use of managed (@ type) heap memory"
,
default
:
allow
}),
(
"owned_heap_memory"
,
LintSpec
{
lint
:
owned_heap_memory
,
desc
:
"use of owned (~ type) heap memory"
,
default
:
allow
}),
(
"heap_memory"
,
LintSpec
{
lint
:
heap_memory
,
desc
:
"use of any (~ type or @ type) heap memory"
,
default
:
allow
}),
(
"type_limits"
,
LintSpec
{
lint
:
type_limits
,
desc
:
"comparisons made useless by limits of the types involved"
,
default
:
warn
}),
(
"default_methods"
,
LintSpec
{
lint
:
default_methods
,
desc
:
"allow default methods"
,
default
:
deny
}),
(
"deprecated_mutable_fields"
,
LintSpec
{
lint
:
deprecated_mutable_fields
,
desc
:
"deprecated mutable fields in structures"
,
default
:
deny
}),
(
"unused_unsafe"
,
LintSpec
{
lint
:
unused_unsafe
,
desc
:
"unnecessary use of an `unsafe` block"
,
default
:
warn
}),
(
"unused_variable"
,
LintSpec
{
lint
:
unused_variable
,
desc
:
"detect variables which are not used in any way"
,
default
:
warn
}),
(
"dead_assignment"
,
LintSpec
{
lint
:
dead_assignment
,
desc
:
"detect assignments that will never be read"
,
default
:
warn
}),
(
"unused_mut"
,
LintSpec
{
lint
:
unused_mut
,
desc
:
"detect mut variables which don't need to be mutable"
,
default
:
warn
}),
];
/*
Pass names should not contain a '-', as the compiler normalizes
'-' to '_' in command-line flags
*/
pub
fn
get_lint_dict
()
->
LintDict
{
let
v
=
~
[
(
~
"ctypes"
,
LintSpec
{
lint
:
ctypes
,
desc
:
"proper use of core::libc types in foreign modules"
,
default
:
warn
}),
(
~
"unused_imports"
,
LintSpec
{
lint
:
unused_imports
,
desc
:
"imports that are never used"
,
default
:
warn
}),
(
~
"while_true"
,
LintSpec
{
lint
:
while_true
,
desc
:
"suggest using loop { } instead of while(true) { }"
,
default
:
warn
}),
(
~
"path_statement"
,
LintSpec
{
lint
:
path_statement
,
desc
:
"path statements with no effect"
,
default
:
warn
}),
(
~
"unrecognized_lint"
,
LintSpec
{
lint
:
unrecognized_lint
,
desc
:
"unrecognized lint attribute"
,
default
:
warn
}),
(
~
"non_implicitly_copyable_typarams"
,
LintSpec
{
lint
:
non_implicitly_copyable_typarams
,
desc
:
"passing non implicitly copyable types as copy type params"
,
default
:
warn
}),
(
~
"vecs_implicitly_copyable"
,
LintSpec
{
lint
:
vecs_implicitly_copyable
,
desc
:
"make vecs and strs not implicitly copyable
\
(only checked at top level)"
,
default
:
warn
}),
(
~
"implicit_copies"
,
LintSpec
{
lint
:
implicit_copies
,
desc
:
"implicit copies of non implicitly copyable data"
,
default
:
warn
}),
(
~
"deprecated_pattern"
,
LintSpec
{
lint
:
deprecated_pattern
,
desc
:
"warn about deprecated uses of pattern bindings"
,
default
:
allow
}),
(
~
"non_camel_case_types"
,
LintSpec
{
lint
:
non_camel_case_types
,
desc
:
"types, variants and traits should have camel case names"
,
default
:
allow
}),
(
~
"managed_heap_memory"
,
LintSpec
{
lint
:
managed_heap_memory
,
desc
:
"use of managed (@ type) heap memory"
,
default
:
allow
}),
(
~
"owned_heap_memory"
,
LintSpec
{
lint
:
owned_heap_memory
,
desc
:
"use of owned (~ type) heap memory"
,
default
:
allow
}),
(
~
"heap_memory"
,
LintSpec
{
lint
:
heap_memory
,
desc
:
"use of any (~ type or @ type) heap memory"
,
default
:
allow
}),
(
~
"type_limits"
,
LintSpec
{
lint
:
type_limits
,
desc
:
"comparisons made useless by limits of the types involved"
,
default
:
warn
}),
(
~
"default_methods"
,
LintSpec
{
lint
:
default_methods
,
desc
:
"allow default methods"
,
default
:
deny
}),
(
~
"deprecated_mutable_fields"
,
LintSpec
{
lint
:
deprecated_mutable_fields
,
desc
:
"deprecated mutable fields in structures"
,
default
:
deny
}),
(
~
"unused_unsafe"
,
LintSpec
{
lint
:
unused_unsafe
,
desc
:
"unnecessary use of an `unsafe` block"
,
default
:
warn
}),
(
~
"unused_variable"
,
LintSpec
{
lint
:
unused_variable
,
desc
:
"detect variables which are not used in any way"
,
default
:
warn
}),
(
~
"dead_assignment"
,
LintSpec
{
lint
:
dead_assignment
,
desc
:
"detect assignments that will never be read"
,
default
:
warn
}),
(
~
"unused_mut"
,
LintSpec
{
lint
:
unused_mut
,
desc
:
"detect mut variables which don't need to be mutable"
,
default
:
warn
}),
];
let
mut
map
=
HashMap
::
new
();
do
vec
::
consume
(
v
)
|
_
,
(
k
,
v
)|
{
map
.insert
(
k
,
v
);
for
lint_table
.each
|
&
(
k
,
v
)|
{
map
.insert
(
k
.to_str
()
,
v
);
}
return
@
map
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录