@@ -52,25 +52,20 @@ where
52
52
53
53
if let Some ( create_source) = create_source. take ( ) {
54
54
let main_context = MainContext :: ref_thread_default ( ) ;
55
- match main_context {
56
- None => panic ! ( "Polled from an Executor not backed by a GLib main context" ) ,
57
- Some ( ref main_context) => {
58
- assert ! ( main_context. is_owner( ) , "Spawning futures only allowed if the thread is owning the MainContext" ) ;
59
-
60
- // Channel for sending back the Source result to our future here.
61
- //
62
- // In theory we could directly continue polling the
63
- // corresponding task from the Source callback,
64
- // however this would break at the very least
65
- // the g_main_current_source() API.
66
- let ( send, recv) = oneshot:: channel ( ) ;
67
-
68
- let s = create_source ( send) ;
69
-
70
- s. attach ( Some ( main_context) ) ;
71
- * source = Some ( ( s, recv) ) ;
72
- }
73
- }
55
+ assert ! ( main_context. is_owner( ) , "Spawning futures only allowed if the thread is owning the MainContext" ) ;
56
+
57
+ // Channel for sending back the Source result to our future here.
58
+ //
59
+ // In theory we could directly continue polling the
60
+ // corresponding task from the Source callback,
61
+ // however this would break at the very least
62
+ // the g_main_current_source() API.
63
+ let ( send, recv) = oneshot:: channel ( ) ;
64
+
65
+ let s = create_source ( send) ;
66
+
67
+ s. attach ( Some ( & main_context) ) ;
68
+ * source = Some ( ( s, recv) ) ;
74
69
}
75
70
76
71
// At this point we must have a receiver
@@ -224,25 +219,20 @@ where
224
219
225
220
if let Some ( create_source) = create_source. take ( ) {
226
221
let main_context = MainContext :: ref_thread_default ( ) ;
227
- match main_context {
228
- None => panic ! ( "Polled from an Executor not backed by a GLib main context" ) ,
229
- Some ( ref main_context) => {
230
- assert ! ( main_context. is_owner( ) , "Spawning futures only allowed if the thread is owning the MainContext" ) ;
231
-
232
- // Channel for sending back the Source result to our future here.
233
- //
234
- // In theory we could directly continue polling the
235
- // corresponding task from the Source callback,
236
- // however this would break at the very least
237
- // the g_main_current_source() API.
238
- let ( send, recv) = mpsc:: unbounded ( ) ;
239
-
240
- let s = create_source ( send) ;
241
-
242
- s. attach ( Some ( main_context) ) ;
243
- * source = Some ( ( s, recv) ) ;
244
- }
245
- }
222
+ assert ! ( main_context. is_owner( ) , "Spawning futures only allowed if the thread is owning the MainContext" ) ;
223
+
224
+ // Channel for sending back the Source result to our future here.
225
+ //
226
+ // In theory we could directly continue polling the
227
+ // corresponding task from the Source callback,
228
+ // however this would break at the very least
229
+ // the g_main_current_source() API.
230
+ let ( send, recv) = mpsc:: unbounded ( ) ;
231
+
232
+ let s = create_source ( send) ;
233
+
234
+ s. attach ( Some ( & main_context) ) ;
235
+ * source = Some ( ( s, recv) ) ;
246
236
}
247
237
248
238
// At this point we must have a receiver
0 commit comments