Browse Source

Remove unneeded clones

openbsd
Julien Blanchard 9 months ago
parent
commit
04afdd3072
2 changed files with 12 additions and 12 deletions
  1. 11
    11
      src/draw.rs
  2. 1
    1
      src/gemini/client.rs

+ 11
- 11
src/draw.rs View File

@@ -251,7 +251,7 @@ pub fn gemini_link(gui: &Arc<Gui>, link_item: String) {
251 251
     match GeminiLink::from_str(&link_item) {
252 252
         Ok(GeminiLink::Finger(url, label)) => {
253 253
             let button_label = if label.is_empty() {
254
-                url.clone().to_string()
254
+                url.to_string()
255 255
             } else {
256 256
                 label
257 257
             };
@@ -263,7 +263,7 @@ pub fn gemini_link(gui: &Arc<Gui>, link_item: String) {
263 263
         }
264 264
         Ok(GeminiLink::Gopher(url, label)) => {
265 265
             let button_label = if label.is_empty() {
266
-                url.clone().to_string()
266
+                url.to_string()
267 267
             } else {
268 268
                 label
269 269
             };
@@ -272,7 +272,7 @@ pub fn gemini_link(gui: &Arc<Gui>, link_item: String) {
272 272
         }
273 273
         Ok(GeminiLink::Http(url, label)) => {
274 274
             let button_label = if label.is_empty() {
275
-                url.clone().to_string()
275
+                url.to_string()
276 276
             } else {
277 277
                 label
278 278
             };
@@ -293,7 +293,7 @@ pub fn gopher_link(gui: &Arc<Gui>, link_item: String) {
293 293
     match GopherLink::from_str(&link_item) {
294 294
         Ok(GopherLink::Http(url, label)) => {
295 295
             let button_label = if label.is_empty() {
296
-                url.clone().to_string()
296
+                url.to_string()
297 297
             } else {
298 298
                 label
299 299
             };
@@ -303,7 +303,7 @@ pub fn gopher_link(gui: &Arc<Gui>, link_item: String) {
303 303
         }
304 304
         Ok(GopherLink::Gopher(url, label)) => {
305 305
             let button_label = if label.is_empty() {
306
-                url.clone().to_string()
306
+                url.to_string()
307 307
             } else {
308 308
                 label
309 309
             };
@@ -312,7 +312,7 @@ pub fn gopher_link(gui: &Arc<Gui>, link_item: String) {
312 312
         }
313 313
         Ok(GopherLink::Image(url, label)) => {
314 314
             let button_label = if label.is_empty() {
315
-                url.clone().to_string()
315
+                url.to_string()
316 316
             } else {
317 317
                 label
318 318
             };
@@ -321,7 +321,7 @@ pub fn gopher_link(gui: &Arc<Gui>, link_item: String) {
321 321
         }
322 322
         Ok(GopherLink::File(url, label)) => {
323 323
             let button_label = if label.is_empty() {
324
-                url.clone().to_string()
324
+                url.to_string()
325 325
             } else {
326 326
                 label
327 327
             };
@@ -337,7 +337,7 @@ pub fn gopher_link(gui: &Arc<Gui>, link_item: String) {
337 337
         }
338 338
         Ok(GopherLink::Ftp(url, label)) => {
339 339
             let button_label = if label.is_empty() {
340
-                url.clone().to_string()
340
+                url.to_string()
341 341
             } else {
342 342
                 label
343 343
             };
@@ -347,7 +347,7 @@ pub fn gopher_link(gui: &Arc<Gui>, link_item: String) {
347 347
         }
348 348
         Ok(GopherLink::Finger(url, label)) => {
349 349
             let button_label = if label.is_empty() {
350
-                url.clone().to_string()
350
+                url.to_string()
351 351
             } else {
352 352
                 label
353 353
             };
@@ -365,7 +365,7 @@ pub fn insert_button(gui: &Arc<Gui>, url: Url, label: String) {
365 365
     let buffer = content_view.get_buffer().unwrap();
366 366
 
367 367
     let button_label = if label.is_empty() {
368
-        url.clone().to_string()
368
+        url.to_string()
369 369
     } else {
370 370
         label
371 371
     };
@@ -394,7 +394,7 @@ pub fn insert_gopher_file_button(gui: &Arc<Gui>, url: Url, label: String) {
394 394
     let buffer = content_view.get_buffer().unwrap();
395 395
 
396 396
     let button_label = if label.is_empty() {
397
-        url.clone().to_string()
397
+        url.to_string()
398 398
     } else {
399 399
         label
400 400
     };

+ 1
- 1
src/gemini/client.rs View File

@@ -51,7 +51,7 @@ pub fn get_data<T: Protocol>(url: T) -> Result<(Option<Vec<u8>>, Vec<u8>), Strin
51 51
                                 let clrf_idx = find_clrf(&res);
52 52
 
53 53
                                 if clrf_idx.is_none() {
54
-                                    return Err(format!("Failed to read response (missing clrf)"));
54
+                                    return Err("Failed to read response (missing clrf)".to_string());
55 55
                                 }
56 56
 
57 57
                                 let content = res.split_off(clrf_idx.unwrap() + 2);

Loading…
Cancel
Save