@@ -147,10 +147,13 @@ impl WasmClipboard {
147147 }
148148 }
149149
150- fn handle_local_clipboard_changed ( & mut self , transaction : ClipboardData ) -> anyhow:: Result < Vec < ClipboardFormat > > {
150+ fn handle_local_clipboard_changed (
151+ & mut self ,
152+ clipboard_data : ClipboardData ,
153+ ) -> anyhow:: Result < Vec < ClipboardFormat > > {
151154 let mut formats = Vec :: new ( ) ;
152- transaction . items ( ) . iter ( ) . for_each ( |content | {
153- match content . mime_type . as_str ( ) {
155+ clipboard_data . items ( ) . iter ( ) . for_each ( |item | {
156+ match item . mime_type . as_str ( ) {
154157 MIME_TEXT => formats. push ( ClipboardFormat :: new ( ClipboardFormatId :: CF_UNICODETEXT ) ) ,
155158 MIME_HTML => {
156159 formats. extend ( [
@@ -174,7 +177,7 @@ impl WasmClipboard {
174177 } ;
175178 } ) ;
176179
177- self . local_clipboard = Some ( transaction ) ;
180+ self . local_clipboard = Some ( clipboard_data ) ;
178181
179182 trace ! ( "Sending clipboard formats: {:?}" , formats) ;
180183
@@ -186,23 +189,23 @@ impl WasmClipboard {
186189 format : ClipboardFormatId ,
187190 ) -> anyhow:: Result < FormatDataResponse < ' static > > {
188191 // Transaction is not set, bail!
189- let transaction = if let Some ( transaction ) = & self . local_clipboard {
190- transaction
192+ let clipboard_data = if let Some ( clipboard_data ) = & self . local_clipboard {
193+ clipboard_data
191194 } else {
192195 anyhow:: bail!( "Local clipboard is empty" ) ;
193196 } ;
194197
195198 let find_content_by_mime = |mime : & str | {
196- transaction
199+ clipboard_data
197200 . items ( )
198201 . iter ( )
199- . find ( |content| content . mime_type . as_str ( ) == mime)
202+ . find ( |item| item . mime_type . as_str ( ) == mime)
200203 } ;
201204
202205 let find_text_content_by_mime = |mime : & str | {
203206 find_content_by_mime ( mime)
204- . and_then ( |content | {
205- if let ClipboardItemValue :: Text ( text) = & content . value {
207+ . and_then ( |item | {
208+ if let ClipboardItemValue :: Text ( text) = & item . value {
206209 Some ( text. as_str ( ) )
207210 } else {
208211 None
@@ -213,8 +216,8 @@ impl WasmClipboard {
213216
214217 let find_binary_content_by_mime = |mime : & str | {
215218 find_content_by_mime ( mime)
216- . and_then ( |content | {
217- if let ClipboardItemValue :: Binary ( binary) = & content . value {
219+ . and_then ( |item | {
220+ if let ClipboardItemValue :: Binary ( binary) = & item . value {
218221 Some ( binary. as_slice ( ) )
219222 } else {
220223 None
@@ -360,7 +363,7 @@ impl WasmClipboard {
360363 return Ok ( ( ) ) ;
361364 }
362365
363- let content = match pending_format {
366+ let item = match pending_format {
364367 ClipboardFormatId :: CF_UNICODETEXT => match response. to_unicode_string ( ) {
365368 Ok ( text) => Some ( ClipboardItem :: new_text ( MIME_TEXT , text) ) ,
366369 Err ( err) => {
@@ -411,8 +414,8 @@ impl WasmClipboard {
411414 }
412415 } ;
413416
414- if let Some ( content ) = content {
415- self . remote_clipboard . add ( content ) ;
417+ if let Some ( item ) = item {
418+ self . remote_clipboard . add ( item ) ;
416419 }
417420
418421 if let Some ( format) = self . remote_formats_to_read . last ( ) {
@@ -443,8 +446,8 @@ impl WasmClipboard {
443446 /// Process backend event. This method should be called from the main event loop.
444447 pub ( crate ) fn process_event ( & mut self , event : WasmClipboardBackendMessage ) -> anyhow:: Result < ( ) > {
445448 match event {
446- WasmClipboardBackendMessage :: LocalClipboardChanged ( transaction ) => {
447- match self . handle_local_clipboard_changed ( transaction ) {
449+ WasmClipboardBackendMessage :: LocalClipboardChanged ( clipboard_data ) => {
450+ match self . handle_local_clipboard_changed ( clipboard_data ) {
448451 Ok ( formats) => {
449452 self . proxy
450453 . send_cliprdr_message ( ClipboardMessage :: SendInitiateCopy ( formats) ) ;
0 commit comments