Skip to content

Commit 88c57c3

Browse files
committed
Fix clippy warnings
1 parent 41afc33 commit 88c57c3

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

src/manifest.rs

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ fn find_short_comment_manifest(s: &str) -> Option<(Manifest, &str)> {
625625
let re = &*RE_SHORT_MANIFEST;
626626
if let Some(cap) = re.captures(s) {
627627
if let Some(m) = cap.get(1) {
628-
return Some((Manifest::DepList(m.as_str()), &s[..]));
628+
return Some((Manifest::DepList(m.as_str()), s));
629629
}
630630
}
631631
None
@@ -660,15 +660,13 @@ fn find_code_block_manifest(s: &str) -> Option<(Manifest, &str)> {
660660
}
661661
};
662662

663-
scrape_markdown_manifest(&comment)
664-
.unwrap_or(None)
665-
.map(|m| (Manifest::TomlOwned(m), s))
663+
scrape_markdown_manifest(&comment).map(|m| (Manifest::TomlOwned(m), s))
666664
}
667665

668666
/**
669667
Extracts the first `Cargo` fenced code block from a chunk of Markdown.
670668
*/
671-
fn scrape_markdown_manifest(content: &str) -> MainResult<Option<String>> {
669+
fn scrape_markdown_manifest(content: &str) -> Option<String> {
672670
use self::pulldown_cmark::{CodeBlockKind, Event, Options, Parser, Tag};
673671

674672
// To match librustdoc/html/markdown.rs, opts.
@@ -697,14 +695,14 @@ fn scrape_markdown_manifest(content: &str) -> MainResult<Option<String>> {
697695
}
698696
}
699697

700-
Ok(output)
698+
output
701699
}
702700

703701
#[test]
704702
fn test_scrape_markdown_manifest() {
705703
macro_rules! smm {
706704
($c:expr) => {
707-
scrape_markdown_manifest($c).map_err(|e| e.to_string())
705+
scrape_markdown_manifest($c)
708706
};
709707
}
710708

@@ -713,7 +711,7 @@ fn test_scrape_markdown_manifest() {
713711
r#"There is no manifest in this comment.
714712
"#
715713
),
716-
Ok(None)
714+
None
717715
);
718716

719717
assert_eq!(
@@ -731,7 +729,7 @@ println!("Nor is this.");
731729
Or this.
732730
"#
733731
),
734-
Ok(None)
732+
None
735733
);
736734

737735
assert_eq!(
@@ -743,11 +741,11 @@ dependencies = { time = "*" }
743741
```
744742
"#
745743
),
746-
Ok(Some(
744+
Some(
747745
r#"dependencies = { time = "*" }
748746
"#
749747
.into()
750-
))
748+
)
751749
);
752750

753751
assert_eq!(
@@ -765,11 +763,11 @@ dependencies = { time = "*" }
765763
```
766764
"#
767765
),
768-
Ok(Some(
766+
Some(
769767
r#"dependencies = { time = "*" }
770768
"#
771769
.into()
772-
))
770+
)
773771
);
774772

775773
assert_eq!(
@@ -787,11 +785,11 @@ dependencies = { explode = true }
787785
```
788786
"#
789787
),
790-
Ok(Some(
788+
Some(
791789
r#"dependencies = { time = "*" }
792790
"#
793791
.into()
794-
))
792+
)
795793
);
796794
}
797795

@@ -1033,7 +1031,7 @@ fn default_manifest(input: &Input, input_id: &OsString) -> MainResult<toml::valu
10331031
let mut subs = HashMap::with_capacity(3);
10341032
subs.insert(consts::MANI_NAME_SUB, &*pkg_name);
10351033
subs.insert(consts::MANI_BIN_NAME_SUB, &*bin_name);
1036-
subs.insert(consts::MANI_FILE_SUB, &input.safe_name()[..]);
1034+
subs.insert(consts::MANI_FILE_SUB, input.safe_name());
10371035
templates::expand(consts::DEFAULT_MANIFEST, &subs)?
10381036
};
10391037
toml::from_str(&mani_str).map_err(|e| {

0 commit comments

Comments
 (0)