mirror of
https://github.com/rust-lang/rust-clippy
synced 2025-02-17 06:28:42 +00:00
Fix type complexity lint
This commit is contained in:
parent
a7270adbd7
commit
b2f4550654
2 changed files with 1 additions and 10 deletions
10
src/types.rs
10
src/types.rs
|
@ -280,18 +280,10 @@ impl LateLintPass for TypeComplexityPass {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_struct_field(&mut self, cx: &LateContext, field: &StructField) {
|
fn check_struct_field(&mut self, cx: &LateContext, field: &StructField) {
|
||||||
|
// enum variants are also struct fields now
|
||||||
check_type(cx, &field.node.ty);
|
check_type(cx, &field.node.ty);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_variant(&mut self, cx: &LateContext, var: &Variant, _: &Generics) {
|
|
||||||
// StructVariant is covered by check_struct_field
|
|
||||||
if let VariantData::Tuple(ref args, _) = *var.node.data {
|
|
||||||
for arg in args {
|
|
||||||
check_type(cx, &arg.node.ty);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn check_item(&mut self, cx: &LateContext, item: &Item) {
|
fn check_item(&mut self, cx: &LateContext, item: &Item) {
|
||||||
match item.node {
|
match item.node {
|
||||||
ItemStatic(ref ty, _, _) |
|
ItemStatic(ref ty, _, _) |
|
||||||
|
|
|
@ -17,7 +17,6 @@ struct TS(Vec<Vec<Box<(u32, u32, u32, u32)>>>); //~ERROR very complex type
|
||||||
|
|
||||||
enum E {
|
enum E {
|
||||||
V1(Vec<Vec<Box<(u32, u32, u32, u32)>>>), //~ERROR very complex type
|
V1(Vec<Vec<Box<(u32, u32, u32, u32)>>>), //~ERROR very complex type
|
||||||
//~^ERROR very complex type
|
|
||||||
V2 { f: Vec<Vec<Box<(u32, u32, u32, u32)>>> }, //~ERROR very complex type
|
V2 { f: Vec<Vec<Box<(u32, u32, u32, u32)>>> }, //~ERROR very complex type
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue