Skip to content

Commit 28170eb

Browse files
committed
Make deriving workarounds less ugly for now
rust-lang/rust#18738 still seems broken, but this makes the impls a tad less ugly...
1 parent db9dae0 commit 28170eb

File tree

1 file changed

+8
-88
lines changed

1 file changed

+8
-88
lines changed

src/gl_device/info.rs

Lines changed: 8 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -30,103 +30,23 @@ pub struct Version {
3030
}
3131

3232
// FIXME https://github.com/rust-lang/rust/issues/18738
33-
// derive PartialOrd, Ord
33+
// derive
3434

3535
#[automatically_derived]
3636
impl ::std::cmp::Ord for Version {
3737
#[inline]
38-
fn cmp(&self, __arg_0: &Version) -> ::std::cmp::Ordering {
39-
match *__arg_0 {
40-
Version {
41-
major: ref __self_1_0,
42-
minor: ref __self_1_1,
43-
revision: ref __self_1_2,
44-
vendor_info: ref __self_1_3 } =>
45-
match *self {
46-
Version {
47-
major: ref __self_0_0,
48-
minor: ref __self_0_1,
49-
revision: ref __self_0_2,
50-
vendor_info: ref __self_0_3 } => {
51-
let __test = (*__self_0_0).cmp(&(*__self_1_0));
52-
if __test == ::std::cmp::Equal {
53-
{
54-
let __test =
55-
(*__self_0_1).cmp(&(*__self_1_1));
56-
if __test == ::std::cmp::Equal {
57-
{
58-
let __test =
59-
(*__self_0_2).cmp(&(*__self_1_2));
60-
if __test == ::std::cmp::Equal {
61-
{
62-
let __test =
63-
(*__self_0_3).cmp(*__self_1_3);
64-
if __test ==
65-
::std::cmp::Equal {
66-
::std::cmp::Equal
67-
} else { __test }
68-
}
69-
} else { __test }
70-
}
71-
} else { __test }
72-
}
73-
} else { __test }
74-
}
75-
},
76-
}
38+
fn cmp(&self, other: &Version) -> ::std::cmp::Ordering {
39+
(&self.major, &self.minor, &self.revision, self.vendor_info)
40+
.cmp(&(&other.major, &other.minor, &other.revision, other.vendor_info))
7741
}
7842
}
7943
#[automatically_derived]
8044
impl ::std::cmp::PartialOrd for Version {
8145
#[inline]
82-
fn partial_cmp(&self, __arg_0: &Version) ->
83-
::std::option::Option<::std::cmp::Ordering> {
84-
match *__arg_0 {
85-
Version {
86-
major: ref __self_1_0,
87-
minor: ref __self_1_1,
88-
revision: ref __self_1_2,
89-
vendor_info: ref __self_1_3 } =>
90-
match *self {
91-
Version {
92-
major: ref __self_0_0,
93-
minor: ref __self_0_1,
94-
revision: ref __self_0_2,
95-
vendor_info: ref __self_0_3 } => {
96-
let __test =
97-
(*__self_0_0).partial_cmp(&(*__self_1_0));
98-
if __test ==
99-
::std::option::Some(::std::cmp::Equal) {
100-
{
101-
let __test =
102-
(*__self_0_1).partial_cmp(&(*__self_1_1));
103-
if __test ==
104-
::std::option::Some(::std::cmp::Equal)
105-
{
106-
{
107-
let __test =
108-
(*__self_0_2).partial_cmp(&(*__self_1_2));
109-
if __test ==
110-
::std::option::Some(::std::cmp::Equal)
111-
{
112-
{
113-
let __test =
114-
(*__self_0_3).partial_cmp(*__self_1_3);
115-
if __test ==
116-
::std::option::Some(::std::cmp::Equal)
117-
{
118-
::std::option::Some(::std::cmp::Equal)
119-
} else { __test }
120-
}
121-
} else { __test }
122-
}
123-
} else { __test }
124-
}
125-
} else { __test }
126-
}
127-
},
128-
}
129-
}
46+
fn partial_cmp(&self, other: &Version) -> ::std::option::Option<::std::cmp::Ordering> {
47+
(&self.major, &self.minor, &self.revision, self.vendor_info)
48+
.partial_cmp(&(&other.major, &other.minor, &other.revision, other.vendor_info))
49+
}
13050
}
13151

13252
impl Version {

0 commit comments

Comments
 (0)