File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -254,7 +254,8 @@ impl<State: Send + Sync + 'static> Server<State> {
254
254
/// match or not, which means that the order of adding resources has no
255
255
/// effect.
256
256
pub fn at < ' a > ( & ' a mut self , path : & ' a str ) -> Route < ' a , State > {
257
- let router = Arc :: get_mut ( & mut self . router ) . unwrap ( ) ;
257
+ let router = Arc :: get_mut ( & mut self . router )
258
+ . expect ( "Registering routes is not possible after the Server has started" ) ;
258
259
Route :: new ( router, path. to_owned ( ) )
259
260
}
260
261
@@ -269,7 +270,8 @@ impl<State: Send + Sync + 'static> Server<State> {
269
270
/// Middleware can only be added at the "top level" of an application,
270
271
/// and is processed in the order in which it is applied.
271
272
pub fn middleware ( & mut self , m : impl Middleware < State > ) -> & mut Self {
272
- let middleware = Arc :: get_mut ( & mut self . middleware ) . unwrap ( ) ;
273
+ let middleware = Arc :: get_mut ( & mut self . middleware )
274
+ . expect ( "Registering middleware is not possible after the Server has started" ) ;
273
275
middleware. push ( Arc :: new ( m) ) ;
274
276
self
275
277
}
You can’t perform that action at this time.
0 commit comments