@@ -45,8 +45,6 @@ pub fn get<R: Runtime>(manager: Arc<AppManager<R>>) -> UriSchemeProtocolHandler
4545 )
4646 . entered ( ) ;
4747
48- let manager = manager. clone ( ) ;
49-
5048 let respond = move |mut response : http:: Response < Cow < ' static , [ u8 ] > > | {
5149 response
5250 . headers_mut ( )
@@ -113,7 +111,7 @@ pub fn get<R: Runtime>(manager: Arc<AppManager<R>>) -> UriSchemeProtocolHandler
113111
114112 let ( mut response, mime_type) = match response {
115113 InvokeResponse :: Ok ( InvokeResponseBody :: Json ( v) ) => (
116- http:: Response :: new ( v. as_bytes ( ) . to_vec ( ) . into ( ) ) ,
114+ http:: Response :: new ( v. into_bytes ( ) . into ( ) ) ,
117115 mime:: APPLICATION_JSON ,
118116 ) ,
119117 InvokeResponse :: Ok ( InvokeResponseBody :: Raw ( v) ) => (
@@ -147,7 +145,7 @@ pub fn get<R: Runtime>(manager: Arc<AppManager<R>>) -> UriSchemeProtocolHandler
147145 http:: Response :: builder ( )
148146 . status ( StatusCode :: INTERNAL_SERVER_ERROR )
149147 . header ( CONTENT_TYPE , mime:: TEXT_PLAIN . essence_str ( ) )
150- . body ( e. as_bytes ( ) . to_vec ( ) . into ( ) )
148+ . body ( e. into_bytes ( ) . into ( ) )
151149 . unwrap ( ) ,
152150 ) ;
153151 }
@@ -157,12 +155,7 @@ pub fn get<R: Runtime>(manager: Arc<AppManager<R>>) -> UriSchemeProtocolHandler
157155 http:: Response :: builder ( )
158156 . status ( StatusCode :: INTERNAL_SERVER_ERROR )
159157 . header ( CONTENT_TYPE , mime:: TEXT_PLAIN . essence_str ( ) )
160- . body (
161- "failed to acquire webview reference"
162- . as_bytes ( )
163- . to_vec ( )
164- . into ( ) ,
165- )
158+ . body ( "failed to acquire webview reference" . as_bytes ( ) . into ( ) )
166159 . unwrap ( ) ,
167160 ) ;
168161 }
@@ -177,12 +170,7 @@ pub fn get<R: Runtime>(manager: Arc<AppManager<R>>) -> UriSchemeProtocolHandler
177170 }
178171
179172 _ => {
180- let mut r = http:: Response :: new (
181- "only POST and OPTIONS are allowed"
182- . as_bytes ( )
183- . to_vec ( )
184- . into ( ) ,
185- ) ;
173+ let mut r = http:: Response :: new ( "only POST and OPTIONS are allowed" . as_bytes ( ) . into ( ) ) ;
186174 * r. status_mut ( ) = StatusCode :: METHOD_NOT_ALLOWED ;
187175 r. headers_mut ( ) . insert (
188176 CONTENT_TYPE ,
@@ -414,8 +402,8 @@ fn handle_ipc_message<R: Runtime>(request: Request<String>, manager: &AppManager
414402 error,
415403 ) ;
416404 } else {
417- let _ = Channel :: from_callback_fn ( webview , callback )
418- . send ( InvokeResponseBody :: Raw ( v. clone ( ) ) ) ;
405+ let _ =
406+ Channel :: from_callback_fn ( webview , callback ) . send ( InvokeResponseBody :: Raw ( v) ) ;
419407 }
420408 }
421409 InvokeResponse :: Err ( e) => responder_eval (
0 commit comments