summaryrefslogtreecommitdiffstats
path: root/imag-link/src/main.rs
diff options
context:
space:
mode:
authorAndre Bogus <bogusandre@gmail.com>2016-05-03 00:57:41 +0200
committerAndre Bogus <bogusandre@gmail.com>2016-05-13 22:26:48 +0200
commitdfd6a9b0d370b841d6591e0d292bc5c7fa2fe76f (patch)
tree6cb460272b335f5a2f933ca519878ad9d8fd9098 /imag-link/src/main.rs
parent0c89fafe209505acd72f787bda16bcdb9a249457 (diff)
style adaptations
these were introduced following suggestions from https://crates.io/crate/clippy
Diffstat (limited to 'imag-link/src/main.rs')
-rw-r--r--imag-link/src/main.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/imag-link/src/main.rs b/imag-link/src/main.rs
index 70f1d019..2c1cf5fb 100644
--- a/imag-link/src/main.rs
+++ b/imag-link/src/main.rs
@@ -81,16 +81,14 @@ fn handle_internal_linking(rt: &Runtime) {
if cmd.is_present("list") {
debug!("List...");
- for entry in cmd.value_of("list").unwrap().split(",") {
+ for entry in cmd.value_of("list").unwrap().split(',') {
debug!("Listing for '{}'", entry);
match get_entry_by_name(rt, entry) {
Ok(e) => {
e.get_internal_links()
.map(|links| {
- let mut i = 0;
- for link in links.iter().map(|l| l.to_str()).filter_map(|x| x) {
+ for (i, link) in links.iter().map(|l| l.to_str()).filter_map(|x| x).enumerate() {
println!("{: <3}: {}", i, link);
- i += 1;
}
})
.map_err(|e| trace_error(&e))
@@ -275,7 +273,7 @@ fn set_links_for_entry(store: &Store, matches: &ArgMatches, entry: &mut FileLock
.value_of("links")
.map(String::from)
.unwrap()
- .split(",")
+ .split(',')
.map(|uri| {
match Url::parse(uri) {
Err(e) => {
@@ -299,10 +297,8 @@ fn set_links_for_entry(store: &Store, matches: &ArgMatches, entry: &mut FileLock
fn list_links_for_entry(store: &Store, entry: &mut FileLockEntry) {
let res = entry.get_external_links(store)
.and_then(|links| {
- let mut i = 0;
- for link in links {
+ for (i, link) in links.enumerate() {
println!("{: <3}: {}", i, link);
- i += 1;
}
Ok(())
});