From 3dfc5dcf068cd49a5059bb62bffa4f62d8a66bc4 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Tue, 20 Mar 2018 14:04:34 +0700 Subject: [PATCH] clippy: Remove needless borrows. --- examples/01a_quick_example.rs | 2 +- examples/01b_quick_example.rs | 2 +- examples/04_using_matches.rs | 2 +- examples/06_positional_args.rs | 2 +- examples/07_option_args.rs | 2 +- examples/08_subcommands.rs | 2 +- examples/18_builder_macro.rs | 4 ++-- examples/21_aliases.rs | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/01a_quick_example.rs b/examples/01a_quick_example.rs index 76981114d14..c7fa20f9048 100644 --- a/examples/01a_quick_example.rs +++ b/examples/01a_quick_example.rs @@ -64,7 +64,7 @@ fn main() { // You can check for the existence of subcommands, and if found use their // matches just as you would the top level app - if let Some(ref matches) = matches.subcommand_matches("test") { + if let Some(matches) = matches.subcommand_matches("test") { // "$ myapp test" was run if matches.is_present("list") { // "$ myapp test -l" was run diff --git a/examples/01b_quick_example.rs b/examples/01b_quick_example.rs index 717cdbe04bb..7f455a82657 100644 --- a/examples/01b_quick_example.rs +++ b/examples/01b_quick_example.rs @@ -78,7 +78,7 @@ fn main() { // You can check for the existence of subcommands, and if found use their // matches just as you would the top level app - if let Some(ref matches) = matches.subcommand_matches("test") { + if let Some(matches) = matches.subcommand_matches("test") { // "$ myapp test" was run if matches.is_present("list") { // "$ myapp test -l" was run diff --git a/examples/04_using_matches.rs b/examples/04_using_matches.rs index e9471b57e48..8a5c2d6516b 100644 --- a/examples/04_using_matches.rs +++ b/examples/04_using_matches.rs @@ -42,7 +42,7 @@ fn main() { // If we wanted to some custom initialization based off some configuration file provided // by the user, we could get the file (A string of the file) - if let Some(ref file) = matches.value_of("config") { + if let Some(file) = matches.value_of("config") { println!("Using config file: {}", file); } diff --git a/examples/06_positional_args.rs b/examples/06_positional_args.rs index 70b73f4cd8c..329c3560f66 100644 --- a/examples/06_positional_args.rs +++ b/examples/06_positional_args.rs @@ -48,7 +48,7 @@ fn main() { } // We can also get the values for those arguments - if let Some(ref in_file) = matches.value_of("input") { + if let Some(in_file) = matches.value_of("input") { // It's safe to call unwrap() because of the required options we set above println!("Doing work with {} and {}", in_file, matches.value_of("config").unwrap()); } diff --git a/examples/07_option_args.rs b/examples/07_option_args.rs index 1af55fd7b08..2c7f9dc56c6 100644 --- a/examples/07_option_args.rs +++ b/examples/07_option_args.rs @@ -49,7 +49,7 @@ fn main() { // // NOTE: If we specified multiple(), this will only return the _FIRST_ // occurrence - if let Some(ref in_file) = matches.value_of("input") { + if let Some(in_file) = matches.value_of("input") { println!("An input file: {}", in_file); } diff --git a/examples/08_subcommands.rs b/examples/08_subcommands.rs index c2ea808380e..73bd09830a2 100644 --- a/examples/08_subcommands.rs +++ b/examples/08_subcommands.rs @@ -41,7 +41,7 @@ fn main() { } // You can get the independent subcommand matches (which function exactly like App matches) - if let Some(ref matches) = matches.subcommand_matches("add") { + if let Some(matches) = matches.subcommand_matches("add") { // Safe to use unwrap() because of the required() option println!("Adding file: {}", matches.value_of("input").unwrap()); } diff --git a/examples/18_builder_macro.rs b/examples/18_builder_macro.rs index 297fb869312..6bdce47d330 100644 --- a/examples/18_builder_macro.rs +++ b/examples/18_builder_macro.rs @@ -41,7 +41,7 @@ fn main() { (@arg list: -l "Lists test values") (@arg test_req: -r requires[list] "Tests requirement for listing") (@arg aaaa: --aaaa +takes_value { - |a| if a.contains("a") { + |a| if a.contains('a') { Ok(()) } else { Err(String::from("string does not contain at least one a")) @@ -70,7 +70,7 @@ fn main() { // You can check for the existence of subcommands, and if found use their // matches just as you would the top level app - if let Some(ref matches) = matches.subcommand_matches("test") { + if let Some(matches) = matches.subcommand_matches("test") { // "$ myapp test" was run if matches.is_present("list") { // "$ myapp test -l" was run diff --git a/examples/21_aliases.rs b/examples/21_aliases.rs index 941d0ce9bd4..3be04458b50 100644 --- a/examples/21_aliases.rs +++ b/examples/21_aliases.rs @@ -23,7 +23,7 @@ fn main() { } // You can get the independent subcommand matches (which function exactly like App matches) - if let Some(ref matches) = matches.subcommand_matches("add") { + if let Some(matches) = matches.subcommand_matches("add") { // Safe to use unwrap() because of the required() option println!("Adding file: {}", matches.value_of("input").unwrap()); }