File tree Expand file tree Collapse file tree 14 files changed +92
-115
lines changed Expand file tree Collapse file tree 14 files changed +92
-115
lines changed Original file line number Diff line number Diff line change @@ -119,17 +119,17 @@ impl PartialEq for Model {
119
119
}
120
120
impl Eq for Model { }
121
121
122
+ impl Ord for Model {
123
+ fn cmp ( & self , other : & Self ) -> std:: cmp:: Ordering {
124
+ self . id . cmp ( & other. id )
125
+ }
126
+ }
127
+
122
128
impl PartialOrd for Model {
123
129
fn lt ( & self , other : & Self ) -> bool {
124
130
self . id . lt ( & other. id )
125
131
}
126
132
fn partial_cmp ( & self , other : & Self ) -> Option < std:: cmp:: Ordering > {
127
- self . id . partial_cmp ( & other. id )
128
- }
129
- }
130
-
131
- impl Ord for Model {
132
- fn cmp ( & self , other : & Self ) -> std:: cmp:: Ordering {
133
- self . id . cmp ( & other. id )
133
+ Some ( self . cmp ( other) )
134
134
}
135
135
}
Original file line number Diff line number Diff line change @@ -81,17 +81,17 @@ impl PartialEq for Model {
81
81
}
82
82
impl Eq for Model { }
83
83
84
+ impl Ord for Model {
85
+ fn cmp ( & self , other : & Self ) -> std:: cmp:: Ordering {
86
+ self . id . cmp ( & other. id )
87
+ }
88
+ }
89
+
84
90
impl PartialOrd for Model {
85
91
fn lt ( & self , other : & Self ) -> bool {
86
92
self . id . lt ( & other. id )
87
93
}
88
94
fn partial_cmp ( & self , other : & Self ) -> Option < std:: cmp:: Ordering > {
89
- self . id . partial_cmp ( & other. id )
90
- }
91
- }
92
-
93
- impl Ord for Model {
94
- fn cmp ( & self , other : & Self ) -> std:: cmp:: Ordering {
95
- self . id . cmp ( & other. id )
95
+ Some ( self . cmp ( other) )
96
96
}
97
97
}
Original file line number Diff line number Diff line change @@ -48,17 +48,6 @@ impl PartialEq for Model {
48
48
}
49
49
impl Eq for Model { }
50
50
51
- impl PartialOrd for Model {
52
- fn lt ( & self , other : & Self ) -> bool {
53
- self . artist_credit_id . lt ( & other. artist_credit_id ) && self . release_id . lt ( & other. release_id )
54
- }
55
- fn partial_cmp ( & self , other : & Self ) -> Option < std:: cmp:: Ordering > {
56
- self . artist_credit_id
57
- . partial_cmp ( & other. artist_credit_id )
58
- . and ( self . release_id . partial_cmp ( & other. release_id ) )
59
- }
60
- }
61
-
62
51
impl Ord for Model {
63
52
fn cmp ( & self , other : & Self ) -> std:: cmp:: Ordering {
64
53
if self . eq ( other) {
@@ -68,3 +57,12 @@ impl Ord for Model {
68
57
}
69
58
}
70
59
}
60
+
61
+ impl PartialOrd for Model {
62
+ fn lt ( & self , other : & Self ) -> bool {
63
+ self . artist_credit_id . lt ( & other. artist_credit_id ) && self . release_id . lt ( & other. release_id )
64
+ }
65
+ fn partial_cmp ( & self , other : & Self ) -> Option < std:: cmp:: Ordering > {
66
+ Some ( self . cmp ( other) )
67
+ }
68
+ }
Original file line number Diff line number Diff line change @@ -48,17 +48,6 @@ impl PartialEq for Model {
48
48
}
49
49
impl Eq for Model { }
50
50
51
- impl PartialOrd for Model {
52
- fn lt ( & self , other : & Self ) -> bool {
53
- self . artist_credit_id . lt ( & other. artist_credit_id ) && self . track_id . lt ( & other. track_id )
54
- }
55
- fn partial_cmp ( & self , other : & Self ) -> Option < std:: cmp:: Ordering > {
56
- self . artist_credit_id
57
- . partial_cmp ( & other. artist_credit_id )
58
- . and ( self . track_id . partial_cmp ( & other. track_id ) )
59
- }
60
- }
61
-
62
51
impl Ord for Model {
63
52
fn cmp ( & self , other : & Self ) -> std:: cmp:: Ordering {
64
53
if self . eq ( other) {
@@ -68,3 +57,12 @@ impl Ord for Model {
68
57
}
69
58
}
70
59
}
60
+
61
+ impl PartialOrd for Model {
62
+ fn lt ( & self , other : & Self ) -> bool {
63
+ self . artist_credit_id . lt ( & other. artist_credit_id ) && self . track_id . lt ( & other. track_id )
64
+ }
65
+ fn partial_cmp ( & self , other : & Self ) -> Option < std:: cmp:: Ordering > {
66
+ Some ( self . cmp ( other) )
67
+ }
68
+ }
Original file line number Diff line number Diff line change @@ -131,6 +131,16 @@ impl PartialEq for Model {
131
131
}
132
132
impl Eq for Model { }
133
133
134
+ impl Ord for Model {
135
+ fn cmp ( & self , other : & Self ) -> std:: cmp:: Ordering {
136
+ if self . eq ( other) {
137
+ std:: cmp:: Ordering :: Equal
138
+ } else {
139
+ self . artist_id . cmp ( & other. artist_id )
140
+ }
141
+ }
142
+ }
143
+
134
144
impl PartialOrd for Model {
135
145
fn lt ( & self , other : & Self ) -> bool {
136
146
self . artist_id . lt ( & other. artist_id )
@@ -139,20 +149,6 @@ impl PartialOrd for Model {
139
149
&& self . relation_value . lt ( & other. relation_value )
140
150
}
141
151
fn partial_cmp ( & self , other : & Self ) -> Option < std:: cmp:: Ordering > {
142
- self . artist_id
143
- . partial_cmp ( & other. artist_id )
144
- . and ( self . track_id . partial_cmp ( & other. track_id ) )
145
- . and ( self . relation_type . partial_cmp ( & other. relation_type ) )
146
- . and ( self . relation_value . partial_cmp ( & other. relation_value ) )
147
- }
148
- }
149
-
150
- impl Ord for Model {
151
- fn cmp ( & self , other : & Self ) -> std:: cmp:: Ordering {
152
- if self . eq ( other) {
153
- std:: cmp:: Ordering :: Equal
154
- } else {
155
- self . artist_id . cmp ( & other. artist_id )
156
- }
152
+ Some ( self . cmp ( other) )
157
153
}
158
154
}
Original file line number Diff line number Diff line change @@ -87,17 +87,17 @@ impl PartialEq for Model {
87
87
}
88
88
impl Eq for Model { }
89
89
90
+ impl Ord for Model {
91
+ fn cmp ( & self , other : & Self ) -> std:: cmp:: Ordering {
92
+ self . id . cmp ( & other. id )
93
+ }
94
+ }
95
+
90
96
impl PartialOrd for Model {
91
97
fn lt ( & self , other : & Self ) -> bool {
92
98
self . id . lt ( & other. id )
93
99
}
94
100
fn partial_cmp ( & self , other : & Self ) -> Option < std:: cmp:: Ordering > {
95
- self . id . partial_cmp ( & other. id )
96
- }
97
- }
98
-
99
- impl Ord for Model {
100
- fn cmp ( & self , other : & Self ) -> std:: cmp:: Ordering {
101
- self . id . cmp ( & other. id )
101
+ Some ( self . cmp ( other) )
102
102
}
103
103
}
Original file line number Diff line number Diff line change @@ -48,17 +48,6 @@ impl PartialEq for Model {
48
48
}
49
49
impl Eq for Model { }
50
50
51
- impl PartialOrd for Model {
52
- fn lt ( & self , other : & Self ) -> bool {
53
- self . genre_id . lt ( & other. genre_id ) && self . release_id . lt ( & other. release_id )
54
- }
55
- fn partial_cmp ( & self , other : & Self ) -> Option < std:: cmp:: Ordering > {
56
- self . genre_id
57
- . partial_cmp ( & other. genre_id )
58
- . and ( self . release_id . partial_cmp ( & other. release_id ) )
59
- }
60
- }
61
-
62
51
impl Ord for Model {
63
52
fn cmp ( & self , other : & Self ) -> std:: cmp:: Ordering {
64
53
if self . eq ( other) {
@@ -68,3 +57,12 @@ impl Ord for Model {
68
57
}
69
58
}
70
59
}
60
+
61
+ impl PartialOrd for Model {
62
+ fn lt ( & self , other : & Self ) -> bool {
63
+ self . genre_id . lt ( & other. genre_id ) && self . release_id . lt ( & other. release_id )
64
+ }
65
+ fn partial_cmp ( & self , other : & Self ) -> Option < std:: cmp:: Ordering > {
66
+ Some ( self . cmp ( other) )
67
+ }
68
+ }
Original file line number Diff line number Diff line change @@ -49,17 +49,6 @@ impl PartialEq for Model {
49
49
}
50
50
impl Eq for Model { }
51
51
52
- impl PartialOrd for Model {
53
- fn lt ( & self , other : & Self ) -> bool {
54
- self . genre_id . lt ( & other. genre_id ) && self . track_id . lt ( & other. track_id )
55
- }
56
- fn partial_cmp ( & self , other : & Self ) -> Option < std:: cmp:: Ordering > {
57
- self . genre_id
58
- . partial_cmp ( & other. genre_id )
59
- . and ( self . track_id . partial_cmp ( & other. track_id ) )
60
- }
61
- }
62
-
63
52
impl Ord for Model {
64
53
fn cmp ( & self , other : & Self ) -> std:: cmp:: Ordering {
65
54
if self . eq ( other) {
@@ -69,3 +58,12 @@ impl Ord for Model {
69
58
}
70
59
}
71
60
}
61
+
62
+ impl PartialOrd for Model {
63
+ fn lt ( & self , other : & Self ) -> bool {
64
+ self . genre_id . lt ( & other. genre_id ) && self . track_id . lt ( & other. track_id )
65
+ }
66
+ fn partial_cmp ( & self , other : & Self ) -> Option < std:: cmp:: Ordering > {
67
+ Some ( self . cmp ( other) )
68
+ }
69
+ }
Original file line number Diff line number Diff line change @@ -80,17 +80,17 @@ impl PartialEq for Model {
80
80
}
81
81
impl Eq for Model { }
82
82
83
+ impl Ord for Model {
84
+ fn cmp ( & self , other : & Self ) -> std:: cmp:: Ordering {
85
+ self . id . cmp ( & other. id )
86
+ }
87
+ }
88
+
83
89
impl PartialOrd for Model {
84
90
fn lt ( & self , other : & Self ) -> bool {
85
91
self . id . lt ( & other. id )
86
92
}
87
93
fn partial_cmp ( & self , other : & Self ) -> Option < std:: cmp:: Ordering > {
88
- self . id . partial_cmp ( & other. id )
89
- }
90
- }
91
-
92
- impl Ord for Model {
93
- fn cmp ( & self , other : & Self ) -> std:: cmp:: Ordering {
94
- self . id . cmp ( & other. id )
94
+ Some ( self . cmp ( other) )
95
95
}
96
96
}
Original file line number Diff line number Diff line change @@ -136,17 +136,17 @@ impl PartialEq for Model {
136
136
}
137
137
impl Eq for Model { }
138
138
139
+ impl Ord for Model {
140
+ fn cmp ( & self , other : & Self ) -> std:: cmp:: Ordering {
141
+ self . id . cmp ( & other. id )
142
+ }
143
+ }
144
+
139
145
impl PartialOrd for Model {
140
146
fn lt ( & self , other : & Self ) -> bool {
141
147
self . id . lt ( & other. id )
142
148
}
143
149
fn partial_cmp ( & self , other : & Self ) -> Option < std:: cmp:: Ordering > {
144
- self . id . partial_cmp ( & other. id )
145
- }
146
- }
147
-
148
- impl Ord for Model {
149
- fn cmp ( & self , other : & Self ) -> std:: cmp:: Ordering {
150
- self . id . cmp ( & other. id )
150
+ Some ( self . cmp ( other) )
151
151
}
152
152
}
Original file line number Diff line number Diff line change @@ -161,17 +161,17 @@ impl PartialEq for Model {
161
161
}
162
162
impl Eq for Model { }
163
163
164
+ impl Ord for Model {
165
+ fn cmp ( & self , other : & Self ) -> std:: cmp:: Ordering {
166
+ self . id . cmp ( & other. id )
167
+ }
168
+ }
169
+
164
170
impl PartialOrd for Model {
165
171
fn lt ( & self , other : & Self ) -> bool {
166
172
self . id . lt ( & other. id )
167
173
}
168
174
fn partial_cmp ( & self , other : & Self ) -> Option < std:: cmp:: Ordering > {
169
- self . id . partial_cmp ( & other. id )
170
- }
171
- }
172
-
173
- impl Ord for Model {
174
- fn cmp ( & self , other : & Self ) -> std:: cmp:: Ordering {
175
- self . id . cmp ( & other. id )
175
+ Some ( self . cmp ( other) )
176
176
}
177
177
}
Original file line number Diff line number Diff line change @@ -78,14 +78,7 @@ impl Eq for Included {}
78
78
79
79
impl std:: cmp:: PartialOrd for Included {
80
80
fn partial_cmp ( & self , other : & Self ) -> Option < std:: cmp:: Ordering > {
81
- match ( self , other) {
82
- ( Included :: Image ( a) , Included :: Image ( b) ) => a. id . partial_cmp ( & b. id ) ,
83
- ( Included :: Artist ( a) , Included :: Artist ( b) ) => a. id . partial_cmp ( & b. id ) ,
84
- ( Included :: Track ( a) , Included :: Track ( b) ) => a. id . partial_cmp ( & b. id ) ,
85
- ( Included :: Medium ( a) , Included :: Medium ( b) ) => a. id . partial_cmp ( & b. id ) ,
86
- ( Included :: Release ( a) , Included :: Release ( b) ) => a. id . partial_cmp ( & b. id ) ,
87
- ( _, _) => None ,
88
- }
81
+ Some ( self . cmp ( other) )
89
82
}
90
83
}
91
84
Original file line number Diff line number Diff line change @@ -137,11 +137,7 @@ impl Eq for Included {}
137
137
138
138
impl std:: cmp:: PartialOrd for Included {
139
139
fn partial_cmp ( & self , other : & Self ) -> Option < std:: cmp:: Ordering > {
140
- match ( self , other) {
141
- ( Included :: Directory ( a) , Included :: Directory ( b) ) => a. id . partial_cmp ( & b. id ) ,
142
- ( Included :: Import ( a) , Included :: Import ( b) ) => a. id . partial_cmp ( & b. id ) ,
143
- ( _, _) => None ,
144
- }
140
+ Some ( self . cmp ( other) )
145
141
}
146
142
}
147
143
Original file line number Diff line number Diff line change @@ -274,7 +274,7 @@ where
274
274
} )
275
275
. collect ( )
276
276
} )
277
- . unwrap_or ( HashMap :: new ( ) ) ,
277
+ . unwrap_or_default ( ) ,
278
278
page : raw_opts. page . unwrap_or_else ( default_page) ,
279
279
} ;
280
280
Ok ( Query ( opts) )
You can’t perform that action at this time.
0 commit comments