Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
b5542f7f
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,发现更多精彩内容 >>
提交
b5542f7f
编写于
6月 13, 2014
作者:
K
Keegan McAllister
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Convert builtin lints to uppercase names for style consistency
上级
21e7b936
变更
11
展开全部
显示空白变更内容
内联
并排
Showing
11 changed file
with
126 addition
and
126 deletion
+126
-126
src/librustc/driver/driver.rs
src/librustc/driver/driver.rs
+2
-2
src/librustc/front/feature_gate.rs
src/librustc/front/feature_gate.rs
+1
-1
src/librustc/lint/builtin.rs
src/librustc/lint/builtin.rs
+107
-107
src/librustc/lint/context.rs
src/librustc/lint/context.rs
+3
-3
src/librustc/middle/dead.rs
src/librustc/middle/dead.rs
+1
-1
src/librustc/middle/liveness.rs
src/librustc/middle/liveness.rs
+3
-3
src/librustc/middle/privacy.rs
src/librustc/middle/privacy.rs
+1
-1
src/librustc/middle/resolve.rs
src/librustc/middle/resolve.rs
+3
-3
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/base.rs
+2
-2
src/librustc/middle/typeck/check/mod.rs
src/librustc/middle/typeck/check/mod.rs
+2
-2
src/librustdoc/core.rs
src/librustdoc/core.rs
+1
-1
未找到文件。
src/librustc/driver/driver.rs
浏览文件 @
b5542f7f
...
...
@@ -786,7 +786,7 @@ pub fn collect_crate_types(session: &Session,
}
Some
(
ref
n
)
if
n
.equiv
(
&
(
"bin"
))
=>
Some
(
config
::
CrateTypeExecutable
),
Some
(
_
)
=>
{
session
.add_lint
(
lint
::
builtin
::
unknown_crate_type
,
session
.add_lint
(
lint
::
builtin
::
UNKNOWN_CRATE_TYPE
,
ast
::
CRATE_NODE_ID
,
a
.span
,
"invalid `crate_type`
\
...
...
@@ -794,7 +794,7 @@ pub fn collect_crate_types(session: &Session,
None
}
_
=>
{
session
.add_lint
(
lint
::
builtin
::
unknown_crate_type
,
session
.add_lint
(
lint
::
builtin
::
UNKNOWN_CRATE_TYPE
,
ast
::
CRATE_NODE_ID
,
a
.span
,
"`crate_type` requires a
\
...
...
src/librustc/front/feature_gate.rs
浏览文件 @
b5542f7f
...
...
@@ -409,7 +409,7 @@ pub fn check_crate(sess: &Session, krate: &ast::Crate) {
directive not necessary"
);
}
None
=>
{
sess
.add_lint
(
lint
::
builtin
::
unknown_features
,
sess
.add_lint
(
lint
::
builtin
::
UNKNOWN_FEATURES
,
ast
::
CRATE_NODE_ID
,
mi
.span
,
"unknown feature"
.to_string
());
...
...
src/librustc/lint/builtin.rs
浏览文件 @
b5542f7f
此差异已折叠。
点击以展开。
src/librustc/lint/context.rs
浏览文件 @
b5542f7f
...
...
@@ -264,7 +264,7 @@ fn lookup_and_emit(&self, lint: &'static Lint, span: Option<Span>, msg: &str) {
let
(
level
,
src
)
=
match
self
.lints.levels
.find
(
&
LintId
::
of
(
lint
))
{
None
=>
return
,
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
)
}
Some
(
&
pair
)
=>
pair
,
...
...
@@ -359,7 +359,7 @@ fn gather_lint_attrs(&mut self, attrs: &[ast::Attribute]) -> Vec<(LintId, Level,
match
self
.lints.by_name
.find_equiv
(
&
lint_name
.get
())
{
Some
(
lint_id
)
=>
out
.push
((
*
lint_id
,
level
,
meta
.span
)),
None
=>
self
.span_lint
(
builtin
::
unrecognized_lint
,
None
=>
self
.span_lint
(
builtin
::
UNRECOGNIZED_LINT
,
meta
.span
,
format!
(
"unknown `{}` attribute: `{}`"
,
level
.as_str
(),
lint_name
)
.as_slice
()),
...
...
@@ -588,7 +588,7 @@ fn get_lints(&self) -> LintArray {
fn
check_item
(
&
mut
self
,
cx
:
&
Context
,
it
:
&
ast
::
Item
)
{
match
it
.node
{
ast
::
ItemEnum
(
..
)
=>
{
let
lint_id
=
LintId
::
of
(
builtin
::
variant_size_difference
);
let
lint_id
=
LintId
::
of
(
builtin
::
VARIANT_SIZE_DIFFERENCE
);
match
cx
.lints
.get_level_source
(
lint_id
)
{
lvlsrc
@
(
lvl
,
_
)
if
lvl
!=
Allow
=>
{
cx
.node_levels
.borrow_mut
()
...
...
src/librustc/middle/dead.rs
浏览文件 @
b5542f7f
...
...
@@ -461,7 +461,7 @@ fn warn_dead_code(&mut self,
ident
:
ast
::
Ident
)
{
self
.tcx
.sess
.add_lint
(
lint
::
builtin
::
dead_code
,
.add_lint
(
lint
::
builtin
::
DEAD_CODE
,
id
,
span
,
format!
(
"code is never used: `{}`"
,
...
...
src/librustc/middle/liveness.rs
浏览文件 @
b5542f7f
...
...
@@ -1560,11 +1560,11 @@ fn warn_about_unused(&self,
};
if
is_assigned
{
self
.ir.tcx.sess
.add_lint
(
lint
::
builtin
::
unused_variable
,
id
,
sp
,
self
.ir.tcx.sess
.add_lint
(
lint
::
builtin
::
UNUSED_VARIABLE
,
id
,
sp
,
format!
(
"variable `{}` is assigned to, but never used"
,
*
name
));
}
else
{
self
.ir.tcx.sess
.add_lint
(
lint
::
builtin
::
unused_variable
,
id
,
sp
,
self
.ir.tcx.sess
.add_lint
(
lint
::
builtin
::
UNUSED_VARIABLE
,
id
,
sp
,
format!
(
"unused variable: `{}`"
,
*
name
));
}
}
...
...
@@ -1582,7 +1582,7 @@ fn warn_about_dead_assign(&self,
if
self
.live_on_exit
(
ln
,
var
)
.is_none
()
{
let
r
=
self
.should_warn
(
var
);
for
name
in
r
.iter
()
{
self
.ir.tcx.sess
.add_lint
(
lint
::
builtin
::
dead_assignment
,
id
,
sp
,
self
.ir.tcx.sess
.add_lint
(
lint
::
builtin
::
DEAD_ASSIGNMENT
,
id
,
sp
,
format!
(
"value assigned to `{}` is never read"
,
*
name
));
}
}
...
...
src/librustc/middle/privacy.rs
浏览文件 @
b5542f7f
...
...
@@ -1394,7 +1394,7 @@ fn visit_ty(&mut self, t: &ast::Ty, _: ()) {
ast
::
TyPath
(
ref
p
,
_
,
path_id
)
=>
{
if
self
.path_is_private_type
(
path_id
)
{
self
.tcx.sess
.add_lint
(
lint
::
builtin
::
visible_private_types
,
lint
::
builtin
::
VISIBLE_PRIVATE_TYPES
,
path_id
,
p
.span
,
"private type in exported type
\
signature"
.to_string
());
...
...
src/librustc/middle/resolve.rs
浏览文件 @
b5542f7f
...
...
@@ -4632,7 +4632,7 @@ fn resolve_path(&mut self,
match
(
def
,
unqualified_def
)
{
(
Some
((
d
,
_
)),
Some
((
ud
,
_
)))
if
d
==
ud
=>
{
self
.session
.add_lint
(
lint
::
builtin
::
unnecessary_qualification
,
.add_lint
(
lint
::
builtin
::
UNNECESSARY_QUALIFICATION
,
id
,
path
.span
,
"unnecessary qualification"
.to_string
());
...
...
@@ -5487,7 +5487,7 @@ fn check_for_item_unused_imports(&mut self, vi: &ViewItem) {
if
!
self
.used_imports
.contains
(
&
(
id
,
TypeNS
))
&&
!
self
.used_imports
.contains
(
&
(
id
,
ValueNS
))
{
self
.session
.add_lint
(
lint
::
builtin
::
unused_imports
,
.add_lint
(
lint
::
builtin
::
UNUSED_IMPORTS
,
id
,
p
.span
,
"unused import"
.to_string
());
...
...
@@ -5511,7 +5511,7 @@ fn finalize_import(&mut self, id: NodeId, span: Span) {
if
!
self
.used_imports
.contains
(
&
(
id
,
TypeNS
))
&&
!
self
.used_imports
.contains
(
&
(
id
,
ValueNS
))
{
self
.session
.add_lint
(
lint
::
builtin
::
unused_imports
,
self
.session
.add_lint
(
lint
::
builtin
::
UNUSED_IMPORTS
,
id
,
span
,
"unused import"
.to_string
());
...
...
src/librustc/middle/trans/base.rs
浏览文件 @
b5542f7f
...
...
@@ -1553,7 +1553,7 @@ fn enum_variant_size_lint(ccx: &CrateContext, enum_def: &ast::EnumDef, sp: Span,
let
mut
sizes
=
Vec
::
new
();
// does no allocation if no pushes, thankfully
let
levels
=
ccx
.tcx.node_lint_levels
.borrow
();
let
lint_id
=
lint
::
LintId
::
of
(
lint
::
builtin
::
variant_size_difference
);
let
lint_id
=
lint
::
LintId
::
of
(
lint
::
builtin
::
VARIANT_SIZE_DIFFERENCE
);
let
lvlsrc
=
match
levels
.find
(
&
(
id
,
lint_id
))
{
None
|
Some
(
&
(
lint
::
Allow
,
_
))
=>
return
,
Some
(
&
lvlsrc
)
=>
lvlsrc
,
...
...
@@ -1590,7 +1590,7 @@ fn enum_variant_size_lint(ccx: &CrateContext, enum_def: &ast::EnumDef, sp: Span,
if
largest
>
slargest
*
3
&&
slargest
>
0
{
// Use lint::raw_emit_lint rather than sess.add_lint because the lint-printing
// pass for the latter already ran.
lint
::
raw_emit_lint
(
&
ccx
.tcx
()
.sess
,
lint
::
builtin
::
variant_size_difference
,
lint
::
raw_emit_lint
(
&
ccx
.tcx
()
.sess
,
lint
::
builtin
::
VARIANT_SIZE_DIFFERENCE
,
lvlsrc
,
Some
(
sp
),
format!
(
"enum variant is more than three times larger
\
({} bytes) than the next largest (ignoring padding)"
,
...
...
src/librustc/middle/typeck/check/mod.rs
浏览文件 @
b5542f7f
...
...
@@ -3416,7 +3416,7 @@ pub fn check_block_with_expected(fcx: &FnCtxt,
fcx
.ccx
.tcx
.sess
.add_lint
(
lint
::
builtin
::
unreachable_code
,
.add_lint
(
lint
::
builtin
::
UNREACHABLE_CODE
,
s_id
,
s
.span
,
"unreachable statement"
.to_string
());
...
...
@@ -3443,7 +3443,7 @@ pub fn check_block_with_expected(fcx: &FnCtxt,
fcx
.ccx
.tcx
.sess
.add_lint
(
lint
::
builtin
::
unreachable_code
,
.add_lint
(
lint
::
builtin
::
UNREACHABLE_CODE
,
e
.id
,
e
.span
,
"unreachable expression"
.to_string
());
...
...
src/librustdoc/core.rs
浏览文件 @
b5542f7f
...
...
@@ -75,7 +75,7 @@ fn get_ast_and_resolve(cpath: &Path, libs: HashSet<Path>, cfgs: Vec<String>)
let
input
=
FileInput
(
cpath
.clone
());
let
warning_lint
=
lint
::
builtin
::
warnings
.name
.to_string
();
let
warning_lint
=
lint
::
builtin
::
WARNINGS
.name_lower
();
let
sessopts
=
driver
::
config
::
Options
{
maybe_sysroot
:
Some
(
os
::
self_exe_path
()
.unwrap
()
.dir_path
()),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录