Skip to content

Commit 550b06c

Browse files
authored
Remove redundant Cast calls (#660)
+semver:patch
1 parent 7a9a86d commit 550b06c

22 files changed

+55
-104
lines changed

src/FluentNHibernate/Conventions/Inspections/AnyInspector.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ public IEnumerable<IColumnInspector> IdentifierColumns
3535
get
3636
{
3737
return mapping.IdentifierColumns
38-
.Select(x => new ColumnInspector(mapping.ContainingEntityType, x))
39-
.Cast<IColumnInspector>();
38+
.Select(x => new ColumnInspector(mapping.ContainingEntityType, x));
4039
}
4140
}
4241

@@ -51,8 +50,7 @@ public IEnumerable<IMetaValueInspector> MetaValues
5150
get
5251
{
5352
return mapping.MetaValues
54-
.Select(x => new MetaValueInspector(x))
55-
.Cast<IMetaValueInspector>();
53+
.Select(x => new MetaValueInspector(x));
5654
}
5755
}
5856

@@ -63,8 +61,7 @@ public IEnumerable<IColumnInspector> TypeColumns
6361
get
6462
{
6563
return mapping.TypeColumns
66-
.Select(x => new ColumnInspector(mapping.ContainingEntityType, x))
67-
.Cast<IColumnInspector>();
64+
.Select(x => new ColumnInspector(mapping.ContainingEntityType, x));
6865
}
6966
}
7067

src/FluentNHibernate/Conventions/Inspections/ClassInspector.cs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ public IEnumerable<IAnyInspector> Anys
7676
get
7777
{
7878
return mapping.Anys
79-
.Select(x => new AnyInspector(x))
80-
.Cast<IAnyInspector>();
79+
.Select(x => new AnyInspector(x));
8180
}
8281
}
8382

@@ -88,8 +87,7 @@ public IEnumerable<ICollectionInspector> Collections
8887
get
8988
{
9089
return mapping.Collections
91-
.Select(x => new CollectionInspector(x))
92-
.Cast<ICollectionInspector>();
90+
.Select(x => new CollectionInspector(x));
9391
}
9492
}
9593

@@ -113,8 +111,7 @@ public IEnumerable<IJoinInspector> Joins
113111
get
114112
{
115113
return mapping.Joins
116-
.Select(x => new JoinInspector(x))
117-
.Cast<IJoinInspector>();
114+
.Select(x => new JoinInspector(x));
118115
}
119116
}
120117

@@ -123,8 +120,7 @@ public IEnumerable<IOneToOneInspector> OneToOnes
123120
get
124121
{
125122
return mapping.OneToOnes
126-
.Select(x => new OneToOneInspector(x))
127-
.Cast<IOneToOneInspector>();
123+
.Select(x => new OneToOneInspector(x));
128124
}
129125
}
130126

@@ -133,17 +129,15 @@ public IEnumerable<IPropertyInspector> Properties
133129
get
134130
{
135131
return mapping.Properties
136-
.Select(x => new PropertyInspector(x))
137-
.Cast<IPropertyInspector>();
132+
.Select(x => new PropertyInspector(x));
138133
}
139134
}
140135
public IEnumerable<IManyToOneInspector> References
141136
{
142137
get
143138
{
144139
return mapping.References
145-
.Select(x => new ManyToOneInspector(x))
146-
.Cast<IManyToOneInspector>();
140+
.Select(x => new ManyToOneInspector(x));
147141
}
148142
}
149143

src/FluentNHibernate/Conventions/Inspections/ComponentBaseInspector.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ public IEnumerable<IAnyInspector> Anys
4646
get
4747
{
4848
return mapping.Anys
49-
.Select(x => new AnyInspector(x))
50-
.Cast<IAnyInspector>();
49+
.Select(x => new AnyInspector(x));
5150
}
5251
}
5352

@@ -56,8 +55,7 @@ public IEnumerable<ICollectionInspector> Collections
5655
get
5756
{
5857
return mapping.Collections
59-
.Select(x => new CollectionInspector(x))
60-
.Cast<ICollectionInspector>();
58+
.Select(x => new CollectionInspector(x));
6159
}
6260
}
6361

@@ -89,8 +87,7 @@ public IEnumerable<IOneToOneInspector> OneToOnes
8987
get
9088
{
9189
return mapping.OneToOnes
92-
.Select(x => new OneToOneInspector(x))
93-
.Cast<IOneToOneInspector>();
90+
.Select(x => new OneToOneInspector(x));
9491
}
9592
}
9693

@@ -99,8 +96,7 @@ public IEnumerable<IPropertyInspector> Properties
9996
get
10097
{
10198
return mapping.Properties
102-
.Select(x => new PropertyInspector(x))
103-
.Cast<IPropertyInspector>();
99+
.Select(x => new PropertyInspector(x));
104100
}
105101
}
106102

@@ -109,8 +105,7 @@ public IEnumerable<IManyToOneInspector> References
109105
get
110106
{
111107
return mapping.References
112-
.Select(x => new ManyToOneInspector(x))
113-
.Cast<IManyToOneInspector>();
108+
.Select(x => new ManyToOneInspector(x));
114109
}
115110
}
116111

src/FluentNHibernate/Conventions/Inspections/CompositeElementInspector.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ public IEnumerable<IPropertyInspector> Properties
4343
get
4444
{
4545
return mapping.Properties
46-
.Select(x => new PropertyInspector(x))
47-
.Cast<IPropertyInspector>();
46+
.Select(x => new PropertyInspector(x));
4847
}
4948
}
5049

@@ -53,8 +52,7 @@ public IEnumerable<IManyToOneInspector> References
5352
get
5453
{
5554
return mapping.References
56-
.Select(x => new ManyToOneInspector(x))
57-
.Cast<IManyToOneInspector>();
55+
.Select(x => new ManyToOneInspector(x));
5856
}
5957
}
6058
}

src/FluentNHibernate/Conventions/Inspections/CompositeIdentityInspector.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ public IEnumerable<IKeyManyToOneInspector> KeyManyToOnes
3636
{
3737
return mapping.Keys
3838
.Where(x => x is KeyManyToOneMapping)
39-
.Select(x => new KeyManyToOneInspector((KeyManyToOneMapping)x))
40-
.Cast<IKeyManyToOneInspector>();
39+
.Select(x => new KeyManyToOneInspector((KeyManyToOneMapping)x));
4140
}
4241
}
4342

@@ -47,8 +46,7 @@ public IEnumerable<IKeyPropertyInspector> KeyProperties
4746
{
4847
return mapping.Keys
4948
.Where(x => x is KeyPropertyMapping)
50-
.Select(x => new KeyPropertyInspector((KeyPropertyMapping)x))
51-
.Cast<IKeyPropertyInspector>();
49+
.Select(x => new KeyPropertyInspector((KeyPropertyMapping)x));
5250
}
5351
}
5452

src/FluentNHibernate/Conventions/Inspections/ElementInspector.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ public IEnumerable<IColumnInspector> Columns
3232
get
3333
{
3434
return mapping.Columns
35-
.Select(x => new ColumnInspector(mapping.ContainingEntityType, x))
36-
.Cast<IColumnInspector>();
35+
.Select(x => new ColumnInspector(mapping.ContainingEntityType, x));
3736
}
3837
}
3938

src/FluentNHibernate/Conventions/Inspections/IdentityInspector.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ public IEnumerable<IColumnInspector> Columns
3535
get
3636
{
3737
return mapping.Columns
38-
.Select(x => new ColumnInspector(EntityType, x))
39-
.Cast<IColumnInspector>();
38+
.Select(x => new ColumnInspector(EntityType, x));
4039
}
4140
}
4241

src/FluentNHibernate/Conventions/Inspections/IndexInspector.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ public IEnumerable<IColumnInspector> Columns
3232
get
3333
{
3434
return mapping.Columns
35-
.Select(x => new ColumnInspector(mapping.ContainingEntityType, x))
36-
.Cast<IColumnInspector>();
35+
.Select(x => new ColumnInspector(mapping.ContainingEntityType, x));
3736
}
3837
}
3938
}

src/FluentNHibernate/Conventions/Inspections/IndexManyToManyInspector.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ public IEnumerable<IColumnInspector> Columns
3434
get
3535
{
3636
return mapping.Columns
37-
.Select(x => new ColumnInspector(mapping.ContainingEntityType, x))
38-
.Cast<IColumnInspector>();
37+
.Select(x => new ColumnInspector(mapping.ContainingEntityType, x));
3938
}
4039
}
4140
}

src/FluentNHibernate/Conventions/Inspections/JoinInspector.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ public IEnumerable<IAnyInspector> Anys
2929
get
3030
{
3131
return mapping.Anys
32-
.Select(x => new AnyInspector(x))
33-
.Cast<IAnyInspector>();
32+
.Select(x => new AnyInspector(x));
3433
}
3534
}
3635

@@ -56,8 +55,7 @@ public IEnumerable<IPropertyInspector> Properties
5655
get
5756
{
5857
return mapping.Properties
59-
.Select(x => new PropertyInspector(x))
60-
.Cast<IPropertyInspector>();
58+
.Select(x => new PropertyInspector(x));
6159
}
6260
}
6361

@@ -66,8 +64,7 @@ public IEnumerable<IManyToOneInspector> References
6664
get
6765
{
6866
return mapping.References
69-
.Select(x => new ManyToOneInspector(x))
70-
.Cast<IManyToOneInspector>();
67+
.Select(x => new ManyToOneInspector(x));
7168
}
7269
}
7370

@@ -77,8 +74,7 @@ public IEnumerable<ICollectionInspector> Collections
7774
get
7875
{
7976
return mapping.Collections
80-
.Select(x => new CollectionInspector(x))
81-
.Cast<ICollectionInspector>();
77+
.Select(x => new CollectionInspector(x));
8278
}
8379
}
8480

0 commit comments

Comments
 (0)