Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
e6f77a17
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,发现更多精彩内容 >>
提交
e6f77a17
编写于
10月 07, 2021
作者:
M
Matthias Krüger
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
clippy::complexity fixes
上级
0157cc97
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
23 addition
and
30 deletion
+23
-30
compiler/rustc_ast_lowering/src/item.rs
compiler/rustc_ast_lowering/src/item.rs
+1
-2
compiler/rustc_borrowck/src/dataflow.rs
compiler/rustc_borrowck/src/dataflow.rs
+1
-1
compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs
compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs
+1
-2
compiler/rustc_builtin_macros/src/deriving/generic/mod.rs
compiler/rustc_builtin_macros/src/deriving/generic/mod.rs
+1
-1
compiler/rustc_infer/src/infer/error_reporting/nice_region_error/trait_impl_difference.rs
...rror_reporting/nice_region_error/trait_impl_difference.rs
+2
-2
compiler/rustc_lint/src/non_fmt_panic.rs
compiler/rustc_lint/src/non_fmt_panic.rs
+1
-2
compiler/rustc_metadata/src/native_libs.rs
compiler/rustc_metadata/src/native_libs.rs
+1
-1
compiler/rustc_middle/src/ty/layout.rs
compiler/rustc_middle/src/ty/layout.rs
+2
-2
compiler/rustc_mir_build/src/build/expr/as_rvalue.rs
compiler/rustc_mir_build/src/build/expr/as_rvalue.rs
+2
-2
compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs
compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs
+1
-3
compiler/rustc_mir_transform/src/early_otherwise_branch.rs
compiler/rustc_mir_transform/src/early_otherwise_branch.rs
+1
-1
compiler/rustc_mir_transform/src/normalize_array_len.rs
compiler/rustc_mir_transform/src/normalize_array_len.rs
+1
-2
compiler/rustc_passes/src/check_attr.rs
compiler/rustc_passes/src/check_attr.rs
+1
-2
compiler/rustc_trait_selection/src/traits/const_evaluatable.rs
...ler/rustc_trait_selection/src/traits/const_evaluatable.rs
+3
-3
compiler/rustc_traits/src/chalk/lowering.rs
compiler/rustc_traits/src/chalk/lowering.rs
+1
-1
compiler/rustc_typeck/src/check/callee.rs
compiler/rustc_typeck/src/check/callee.rs
+1
-1
compiler/rustc_typeck/src/check/regionck.rs
compiler/rustc_typeck/src/check/regionck.rs
+1
-1
src/librustdoc/json/mod.rs
src/librustdoc/json/mod.rs
+1
-1
未找到文件。
compiler/rustc_ast_lowering/src/item.rs
浏览文件 @
e6f77a17
...
...
@@ -1345,8 +1345,7 @@ pub(super) fn lower_generics_mut(
generics
.params
.iter
()
.find
(|
p
|
def_id
==
self
.resolver
.local_def_id
(
p
.id
)
.to_def_id
())
.is_some
()
.any
(|
p
|
def_id
==
self
.resolver
.local_def_id
(
p
.id
)
.to_def_id
())
}
// Either the `bounded_ty` is not a plain type parameter, or
// it's not found in the generic type parameters list.
...
...
compiler/rustc_borrowck/src/dataflow.rs
浏览文件 @
e6f77a17
...
...
@@ -201,7 +201,7 @@ fn precompute_borrows_out_of_scope(
let
bb_data
=
&
self
.body
[
bb
];
debug_assert!
(
hi
==
bb_data
.statements
.len
());
for
&
succ_bb
in
bb_data
.terminator
()
.successors
()
{
if
self
.visited
.insert
(
succ_bb
)
==
false
{
if
!
self
.visited
.insert
(
succ_bb
)
{
if
succ_bb
==
location
.block
&&
first_lo
>
0
{
// `succ_bb` has been seen before. If it wasn't
// fully processed, add its first part to `stack`
...
...
compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs
浏览文件 @
e6f77a17
...
...
@@ -972,8 +972,7 @@ fn suggest_ampmut<'tcx>(
if
let
Some
(
assignment_rhs_span
)
=
opt_assignment_rhs_span
{
if
let
Ok
(
src
)
=
tcx
.sess
.source_map
()
.span_to_snippet
(
assignment_rhs_span
)
{
let
is_mutbl
=
|
ty
:
&
str
|
->
bool
{
if
ty
.starts_with
(
"mut"
)
{
let
rest
=
&
ty
[
3
..
];
if
let
Some
(
rest
)
=
ty
.strip_prefix
(
"mut"
)
{
match
rest
.chars
()
.next
()
{
// e.g. `&mut x`
Some
(
c
)
if
c
.is_whitespace
()
=>
true
,
...
...
compiler/rustc_builtin_macros/src/deriving/generic/mod.rs
浏览文件 @
e6f77a17
...
...
@@ -594,7 +594,7 @@ fn create_derived_impl(
GenericParamKind
::
Const
{
ty
,
kw_span
,
..
}
=>
{
let
const_nodefault_kind
=
GenericParamKind
::
Const
{
ty
:
ty
.clone
(),
kw_span
:
kw_span
.clone
()
,
kw_span
:
*
kw_span
,
// We can't have default values inside impl block
default
:
None
,
...
...
compiler/rustc_infer/src/infer/error_reporting/nice_region_error/trait_impl_difference.rs
浏览文件 @
e6f77a17
...
...
@@ -130,8 +130,8 @@ fn emit_associated_type_err(
.tcx
()
.sess
.struct_span_err
(
span
,
&
format!
(
"`impl` associated type signature for `{}` doesn't match `trait` associated type signature"
,
item_name
));
err
.span_label
(
impl_sp
,
&
format!
(
"found"
)
);
err
.span_label
(
trait_sp
,
&
format!
(
"expected"
)
);
err
.span_label
(
impl_sp
,
"found"
);
err
.span_label
(
trait_sp
,
"expected"
);
err
.emit
();
}
...
...
compiler/rustc_lint/src/non_fmt_panic.rs
浏览文件 @
e6f77a17
...
...
@@ -230,8 +230,7 @@ fn check_panic_str<'tcx>(
Err
(
_
)
=>
(
None
,
None
),
};
let
mut
fmt_parser
=
Parser
::
new
(
fmt
.as_ref
(),
style
,
snippet
.clone
(),
false
,
ParseMode
::
Format
);
let
mut
fmt_parser
=
Parser
::
new
(
fmt
,
style
,
snippet
.clone
(),
false
,
ParseMode
::
Format
);
let
n_arguments
=
(
&
mut
fmt_parser
)
.filter
(|
a
|
matches!
(
a
,
Piece
::
NextArgument
(
_
)))
.count
();
if
n_arguments
>
0
&&
fmt_parser
.errors
.is_empty
()
{
...
...
compiler/rustc_metadata/src/native_libs.rs
浏览文件 @
e6f77a17
...
...
@@ -363,7 +363,7 @@ fn process_command_line(&mut self) {
.collect
::
<
Vec
<
_
>>
();
if
existing
.is_empty
()
{
// Add if not found
let
new_name
=
passed_lib
.new_name
.as_ref
()
.map
(|
s
|
&**
s
);
// &Option<String> -> Option<&str>
let
new_name
:
Option
<&
str
>
=
passed_lib
.new_name
.as_deref
();
let
lib
=
NativeLib
{
name
:
Some
(
Symbol
::
intern
(
new_name
.unwrap_or
(
&
passed_lib
.name
))),
kind
:
passed_lib
.kind
,
...
...
compiler/rustc_middle/src/ty/layout.rs
浏览文件 @
e6f77a17
...
...
@@ -986,7 +986,7 @@ fn layout_of_uncached(&self, ty: Ty<'tcx>) -> Result<&'tcx Layout, LayoutError<'
let
niche
=
if
def
.repr
.hide_niche
()
{
None
}
else
{
Niche
::
from_scalar
(
dl
,
Size
::
ZERO
,
scalar
.clone
()
)
Niche
::
from_scalar
(
dl
,
Size
::
ZERO
,
*
scalar
)
};
if
let
Some
(
niche
)
=
niche
{
match
st
.largest_niche
{
...
...
@@ -2273,7 +2273,7 @@ fn field_ty_or_layout(
)
->
TyMaybeWithLayout
<
'tcx
>
{
let
tcx
=
cx
.tcx
();
let
tag_layout
=
|
tag
:
Scalar
|
->
TyAndLayout
<
'tcx
>
{
let
layout
=
Layout
::
scalar
(
cx
,
tag
.clone
()
);
let
layout
=
Layout
::
scalar
(
cx
,
tag
);
TyAndLayout
{
layout
:
tcx
.intern_layout
(
layout
),
ty
:
tag
.value
.to_ty
(
tcx
)
}
};
...
...
compiler/rustc_mir_build/src/build/expr/as_rvalue.rs
浏览文件 @
e6f77a17
...
...
@@ -130,7 +130,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
TerminatorKind
::
Call
{
func
:
exchange_malloc
,
args
:
vec!
[
Operand
::
Move
(
size
),
Operand
::
Move
(
align
)],
destination
:
Some
((
Place
::
from
(
storage
)
,
success
)),
destination
:
Some
((
storage
,
success
)),
cleanup
:
None
,
from_hir_call
:
false
,
fn_span
:
expr_span
,
...
...
@@ -153,7 +153,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
}
// Transmute `*mut u8` to the box (thus far, uninitialized):
let
box_
=
Rvalue
::
ShallowInitBox
(
Operand
::
Move
(
Place
::
from
(
storage
)
),
value
.ty
);
let
box_
=
Rvalue
::
ShallowInitBox
(
Operand
::
Move
(
storage
),
value
.ty
);
this
.cfg
.push_assign
(
block
,
source_info
,
Place
::
from
(
result
),
box_
);
// initialize the box contents:
...
...
compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs
浏览文件 @
e6f77a17
...
...
@@ -1068,9 +1068,7 @@ pub(super) fn iter_missing<'a, 'p>(
Missing
{
nonexhaustive_enum_missing_real_variants
:
self
.iter_missing
(
pcx
)
.filter
(|
c
|
!
c
.is_non_exhaustive
())
.next
()
.is_some
(),
.any
(|
c
|
!
c
.is_non_exhaustive
()),
}
}
else
{
Missing
{
nonexhaustive_enum_missing_real_variants
:
false
}
...
...
compiler/rustc_mir_transform/src/early_otherwise_branch.rs
浏览文件 @
e6f77a17
...
...
@@ -263,7 +263,7 @@ fn find_discriminant_switch_pairing(
}
// check that the value being matched on is the same. The
if
this_bb_discr_info
.targets_with_values
.iter
()
.find
(|
x
|
x
.0
==
value
)
.is_none
(
)
{
if
!
this_bb_discr_info
.targets_with_values
.iter
()
.any
(|
x
|
x
.0
==
value
)
{
trace!
(
"NO: values being matched on are not the same"
);
return
None
;
}
...
...
compiler/rustc_mir_transform/src/normalize_array_len.rs
浏览文件 @
e6f77a17
...
...
@@ -111,8 +111,7 @@ fn patch_expand_statement(
Operand
::
Copy
(
place
)
|
Operand
::
Move
(
place
)
=>
{
// create new local
let
ty
=
operand
.ty
(
self
.local_decls
,
self
.tcx
);
let
local_decl
=
LocalDecl
::
with_source_info
(
ty
,
statement
.source_info
.clone
());
let
local_decl
=
LocalDecl
::
with_source_info
(
ty
,
statement
.source_info
);
let
local
=
self
.local_decls
.push
(
local_decl
);
// make it live
let
mut
make_live_statement
=
statement
.clone
();
...
...
compiler/rustc_passes/src/check_attr.rs
浏览文件 @
e6f77a17
...
...
@@ -1766,8 +1766,7 @@ fn check_macro_use(&self, hir_id: HirId, attr: &Attribute, target: Target) {
fn
check_macro_export
(
&
self
,
hir_id
:
HirId
,
attr
:
&
Attribute
,
target
:
Target
)
{
if
target
!=
Target
::
MacroDef
{
self
.tcx
.struct_span_lint_hir
(
UNUSED_ATTRIBUTES
,
hir_id
,
attr
.span
,
|
lint
|
{
lint
.build
(
&
format!
(
"`#[macro_export]` only has an effect on macro definitions"
))
.emit
();
lint
.build
(
"`#[macro_export]` only has an effect on macro definitions"
)
.emit
();
});
}
}
...
...
compiler/rustc_trait_selection/src/traits/const_evaluatable.rs
浏览文件 @
e6f77a17
...
...
@@ -278,14 +278,14 @@ fn thir(&self) -> &'a thir::Thir<'tcx> {
fn
visit_expr
(
&
mut
self
,
expr
:
&
thir
::
Expr
<
'tcx
>
)
{
self
.is_poly
|
=
expr
.ty
.definitely_has_param_types_or_consts
(
self
.tcx
);
if
self
.is_poly
==
false
{
if
!
self
.is_poly
{
visit
::
walk_expr
(
self
,
expr
)
}
}
fn
visit_pat
(
&
mut
self
,
pat
:
&
thir
::
Pat
<
'tcx
>
)
{
self
.is_poly
|
=
pat
.ty
.definitely_has_param_types_or_consts
(
self
.tcx
);
if
self
.is_poly
==
false
{
if
!
self
.is_poly
{
visit
::
walk_pat
(
self
,
pat
);
}
}
...
...
@@ -298,7 +298,7 @@ fn visit_const(&mut self, ct: &'tcx ty::Const<'tcx>) {
let
mut
is_poly_vis
=
IsThirPolymorphic
{
is_poly
:
false
,
thir
:
body
,
tcx
};
visit
::
walk_expr
(
&
mut
is_poly_vis
,
&
body
[
body_id
]);
debug!
(
"AbstractConstBuilder: is_poly={}"
,
is_poly_vis
.is_poly
);
if
is_poly_vis
.is_poly
==
false
{
if
!
is_poly_vis
.is_poly
{
return
Ok
(
None
);
}
...
...
compiler/rustc_traits/src/chalk/lowering.rs
浏览文件 @
e6f77a17
...
...
@@ -892,7 +892,7 @@ fn visit_region(&mut self, r: Region<'tcx>) -> ControlFlow<Self::BreakTy> {
match
r
{
ty
::
ReLateBound
(
index
,
br
)
if
*
index
==
self
.binder_index
=>
match
br
.kind
{
ty
::
BoundRegionKind
::
BrNamed
(
def_id
,
_
name
)
=>
{
if
self
.named_parameters
.iter
()
.find
(|
d
|
**
d
==
def_id
)
.is_none
(
)
{
if
!
self
.named_parameters
.iter
()
.any
(|
d
|
*
d
==
def_id
)
{
self
.named_parameters
.push
(
def_id
);
}
}
...
...
compiler/rustc_typeck/src/check/callee.rs
浏览文件 @
e6f77a17
...
...
@@ -329,7 +329,7 @@ fn confirm_builtin_call(
let
obligation
=
Obligation
::
new
(
ObligationCause
::
dummy_with_span
(
callee_expr
.span
),
self
.param_env
,
predicate
.clone
()
,
*
predicate
,
);
let
result
=
self
.infcx
.evaluate_obligation
(
&
obligation
);
self
.tcx
...
...
compiler/rustc_typeck/src/check/regionck.rs
浏览文件 @
e6f77a17
...
...
@@ -413,7 +413,7 @@ fn visit_expr(&mut self, expr: &'tcx hir::Expr<'tcx>) {
}
hir
::
ExprKind
::
Match
(
ref
discr
,
arms
,
_
)
=>
{
self
.link_match
(
discr
,
&
arms
[
..
]
);
self
.link_match
(
discr
,
arms
);
intravisit
::
walk_expr
(
self
,
expr
);
}
...
...
src/librustdoc/json/mod.rs
浏览文件 @
e6f77a17
...
...
@@ -207,7 +207,7 @@ fn after_krate(&mut self) -> Result<(), Error> {
debug!
(
"Done with crate"
);
for
primitive
in
Rc
::
clone
(
&
self
.cache
)
.primitive_locations
.values
()
{
self
.get_impls
(
primitive
.clone
()
);
self
.get_impls
(
*
primitive
);
}
let
mut
index
=
(
*
self
.index
)
.clone
()
.into_inner
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录