Skip to content

Commit 45c50ff

Browse files
committed
Remove is_union and use is_shallow
1 parent fba94ac commit 45c50ff

File tree

1 file changed

+2
-5
lines changed
  • compiler/rustc_builtin_macros/src/deriving

1 file changed

+2
-5
lines changed

compiler/rustc_builtin_macros/src/deriving/clone.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,16 @@ pub fn expand_deriving_clone(
4444
is_shallow = false;
4545
substructure = combine_substructure(Box::new(|c, s, sub| cs_clone(c, s, sub)));
4646
}
47-
is_union = false;
4847
}
4948
ItemKind::Union(..) => {
5049
bounds = vec![Literal(path_std!(marker::Copy))];
5150
is_shallow = true;
5251
substructure =
5352
combine_substructure(Box::new(|c, s, sub| cs_clone_shallow(c, s, sub, true)));
54-
is_union = true;
5553
}
5654
_ => {
5755
bounds = vec![];
5856
is_shallow = false;
59-
is_union = false;
6057
substructure = combine_substructure(Box::new(|c, s, sub| cs_clone(c, s, sub)));
6158
}
6259
},
@@ -69,7 +66,7 @@ pub fn expand_deriving_clone(
6966
let trait_def = TraitDef {
7067
span,
7168
attributes: Vec::new(),
72-
path: if is_union { path_std!(clone::Clone) } else { path_std!(clone::DerivedClone) },
69+
path: if is_shallow { path_std!(clone::Clone) } else { path_std!(clone::DerivedClone) },
7370
bound_current_trait: false,
7471
additional_bounds: bounds,
7572
generics: Bounds::empty(),
@@ -91,7 +88,7 @@ pub fn expand_deriving_clone(
9188

9289
trait_def.expand_ext(cx, mitem, item, push, is_shallow);
9390

94-
if !is_union {
91+
if !is_shallow {
9592
TraitDef {
9693
span,
9794
attributes: Vec::new(),

0 commit comments

Comments
 (0)