summaryrefslogtreecommitdiffstats
path: root/lib/entry
diff options
context:
space:
mode:
authorflip1995 <hello@philkrones.com>2019-08-27 10:50:19 +0200
committerMatthias Beyer <mail@beyermatthias.de>2019-08-28 18:18:40 +0200
commit3215c6351cff181d97438795253de3fd37a25f3c (patch)
tree97e968264ea5d843b37e28fc3d302f2132f39349 /lib/entry
parente2b1ed729a44c2fcee9d011ba8859774cd9e39ac (diff)
[Auto] lib/entry/markdown: Fix Clippy warnings
Signed-off-by: flip1995 <hello@philkrones.com> Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'lib/entry')
-rw-r--r--lib/entry/libimagentrymarkdown/src/html.rs4
-rw-r--r--lib/entry/libimagentrymarkdown/src/link.rs4
-rw-r--r--lib/entry/libimagentrymarkdown/src/processor.rs38
3 files changed, 21 insertions, 25 deletions
diff --git a/lib/entry/libimagentrymarkdown/src/html.rs b/lib/entry/libimagentrymarkdown/src/html.rs
index 7ef5e3bc..da284dcf 100644
--- a/lib/entry/libimagentrymarkdown/src/html.rs
+++ b/lib/entry/libimagentrymarkdown/src/html.rs
@@ -52,7 +52,7 @@ pub mod iter {
impl<I: Iterator<Item = Entry>> ToHtmlIterator<I> {
pub fn new(i: I) -> ToHtmlIterator<I> {
- ToHtmlIterator { i: i }
+ ToHtmlIterator { i }
}
}
@@ -83,7 +83,7 @@ pub mod iter {
impl<I: Iterator<Item = Entry>> WithHtmlIterator<I> {
pub fn new(i: I) -> WithHtmlIterator<I> {
- WithHtmlIterator { i: i }
+ WithHtmlIterator { i }
}
}
diff --git a/lib/entry/libimagentrymarkdown/src/link.rs b/lib/entry/libimagentrymarkdown/src/link.rs
index 8c56a37c..988e84c9 100644
--- a/lib/entry/libimagentrymarkdown/src/link.rs
+++ b/lib/entry/libimagentrymarkdown/src/link.rs
@@ -38,7 +38,7 @@ impl Link {
/// Translate a `Link` into a `UrlLink`
pub fn into_urllink(self) -> Result<UrlLink> {
Url::parse(&self.link[..])
- .map(move |link| UrlLink { title: self.title, link: link, })
+ .map(move |link| UrlLink { title: self.title, link, })
.context(err_msg("Link parsing error"))
.map_err(Error::from)
}
@@ -85,7 +85,7 @@ impl Render for LinkExtractor {
match (link, content) {
(Some(link), Some(content)) => {
- self.links.push(Link { link: link, title: content });
+ self.links.push(Link { link, title: content });
false
},
diff --git a/lib/entry/libimagentrymarkdown/src/processor.rs b/lib/entry/libimagentrymarkdown/src/processor.rs
index 98b10db2..70365ea7 100644
--- a/lib/entry/libimagentrymarkdown/src/processor.rs
+++ b/lib/entry/libimagentrymarkdown/src/processor.rs
@@ -148,10 +148,10 @@ impl LinkProcessor {
store.retrieve(id)?
} else {
store.get(id.clone())?
- .ok_or_else(|| Error::from(format_err!("Store get error: {}", id)))?
+ .ok_or_else(|| format_err!("Store get error: {}", id))?
};
- let _ = entry.add_link(&mut target)?;
+ entry.add_link(&mut target)?;
},
LinkQualification::ExternalLink(url) => {
if !self.process_urls {
@@ -212,7 +212,7 @@ impl LinkProcessor {
trace!("Ready processing, linking new ref entry...");
- let _ = entry.add_link(&mut ref_entry)?;
+ entry.add_link(&mut ref_entry)?;
},
LinkQualification::Undecidable(e) => {
// error
@@ -250,7 +250,7 @@ impl LinkQualification {
// url::Url::parse() as Err(_)
//
// if url.scheme() == "https" || url.scheme() == "http" {
- return LinkQualification::ExternalLink(url);
+ LinkQualification::ExternalLink(url)
// }
},
@@ -302,7 +302,7 @@ mod tests {
let store = get_store();
let mut base = store.create(PathBuf::from("test-1")).unwrap();
- *base.get_content_mut() = format!("This is an example entry with no links");
+ *base.get_content_mut() = "This is an example entry with no links".to_string();
let update = store.update(&mut base);
assert!(update.is_ok());
@@ -319,7 +319,7 @@ mod tests {
let store = get_store();
let mut base = store.create(PathBuf::from("test-2.1")).unwrap();
- *base.get_content_mut() = format!("This is an example entry with one [link](test-2.2)");
+ *base.get_content_mut() = "This is an example entry with one [link](test-2.2)".to_string();
let update = store.update(&mut base);
assert!(update.is_ok());
@@ -362,7 +362,7 @@ mod tests {
let store = get_store();
let mut base = store.create(PathBuf::from("test-2.1")).unwrap();
- *base.get_content_mut() = format!("This is an example entry with one [link](/test-2.2)");
+ *base.get_content_mut() = "This is an example entry with one [link](/test-2.2)".to_string();
let update = store.update(&mut base);
assert!(update.is_ok());
@@ -383,7 +383,7 @@ mod tests {
let store = get_store();
let mut base = store.create(PathBuf::from("test-2.1")).unwrap();
- *base.get_content_mut() = format!("This is an example entry with one [link](test-2.2)");
+ *base.get_content_mut() = "This is an example entry with one [link](test-2.2)".to_string();
let update = store.update(&mut base);
assert!(update.is_ok());
@@ -423,7 +423,7 @@ mod tests {
let store = get_store();
let mut base = store.create(PathBuf::from("test-5.1")).unwrap();
- *base.get_content_mut() = format!("An [example](http://example.com) is here.");
+ *base.get_content_mut() = "An [example](http://example.com) is here.".to_string();
let update = store.update(&mut base);
assert!(update.is_ok());
@@ -473,7 +473,7 @@ mod tests {
let mut base = store.create(PathBuf::from("test-5.1")).unwrap();
// As the ref target must exist, we're using /etc/hosts here
- *base.get_content_mut() = format!("An [example ref](file:///etc/hosts) is here.");
+ *base.get_content_mut() = "An [example ref](file:///etc/hosts) is here.".to_string();
let update = store.update(&mut base);
assert!(update.is_ok());
@@ -503,10 +503,8 @@ mod tests {
let mut base = store.create(PathBuf::from("test-5.1")).unwrap();
// As the ref target must exist, we're using /etc/hosts here
- *base.get_content_mut() = format!(
- r#"An [example ref](file:///etc/hosts)
- is [here](file:///etc/group)."#
- );
+ *base.get_content_mut() = r#"An [example ref](file:///etc/hosts)
+ is [here](file:///etc/group)."#.to_string();
let update = store.update(&mut base);
assert!(update.is_ok());
@@ -536,10 +534,8 @@ mod tests {
let mut base = store.create(PathBuf::from("test-5.1")).unwrap();
// As the ref target must exist, we're using /etc/hosts here
- *base.get_content_mut() = format!(
- r#"An [example ref](file:///etc/hosts)
- is [here](file:///etc/group)."#
- );
+ *base.get_content_mut() = r#"An [example ref](file:///etc/hosts)
+ is [here](file:///etc/group)."#.to_string();
let update = store.update(&mut base);
assert!(update.is_ok());
@@ -567,7 +563,7 @@ mod tests {
let store = get_store();
let mut base = store.create(PathBuf::from("test-5.1")).unwrap();
- *base.get_content_mut() = format!("An [example](http://example.com) is here.");
+ *base.get_content_mut() = "An [example](http://example.com) is here.".to_string();
let update = store.update(&mut base);
assert!(update.is_ok());
@@ -594,7 +590,7 @@ mod tests {
let store = get_store();
let mut base = store.create(PathBuf::from("test-2.1")).unwrap();
- *base.get_content_mut() = format!("This is an example entry with one [link](test-2.2)");
+ *base.get_content_mut() = "This is an example entry with one [link](test-2.2)".to_string();
let update = store.update(&mut base);
assert!(update.is_ok());
@@ -611,7 +607,7 @@ mod tests {
let result = processor.process(&mut base, &store);
assert!(result.is_ok(), "Should be Ok(()): {:?}", result);
- assert_eq!(2, store.entries().unwrap().collect::<Vec<_>>().len());
+ assert_eq!(2, store.entries().unwrap().count());
}
}