Run clippy for all targets, including tests (#93)

The test code should also be linted.
This commit is contained in:
Paweł Romanowski 2021-01-03 16:41:19 +01:00 committed by GitHub
parent f91f9fa183
commit fa9c5ea2cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 24 deletions

View file

@ -19,7 +19,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: test
lint:
runs-on: ubuntu-latest
steps:
@ -37,7 +37,8 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
# --all-targets makes it lint tests too
args: --all-targets -- --deny warnings
publish-check:
name: Publish Check
@ -60,7 +61,7 @@ jobs:
publish:
if: startsWith(github.ref, 'refs/tags/')
needs:
needs:
- test
- lint
- publish-check
@ -70,7 +71,7 @@ jobs:
- name: cargo fetch
uses: actions-rs/cargo@v1
with:
command: fetch
command: fetch
- name: cargo publish
uses: actions-rs/cargo@v1
env:

View file

@ -161,7 +161,6 @@ pub(crate) fn extract_links(input_content: &InputContent, base_url: Option<Url>)
#[cfg(test)]
mod test {
use super::*;
use std::iter::FromIterator;
#[test]
fn test_extract_markdown_links() {
@ -172,16 +171,15 @@ mod test {
);
assert_eq!(
links,
HashSet::from_iter(
[
Uri::Website(Url::parse("https://endler.dev").unwrap()),
Uri::Website(
Url::parse("https://github.com/hello-rust/lychee/relative_link").unwrap()
)
]
.iter()
.cloned()
)
[
Uri::Website(Url::parse("https://endler.dev").unwrap()),
Uri::Website(
Url::parse("https://github.com/hello-rust/lychee/relative_link").unwrap()
)
]
.iter()
.cloned()
.collect()
)
}
@ -228,15 +226,14 @@ mod test {
let input =
"https://endler.dev and https://hello-rust.show/foo/bar?lol=1 at test@example.com";
let links = extract_links(&InputContent::from_string(input, FileType::Plaintext), None);
let expected = HashSet::from_iter(
[
Uri::Website(Url::parse("https://endler.dev").unwrap()),
Uri::Website(Url::parse("https://hello-rust.show/foo/bar?lol=1").unwrap()),
Uri::Mail("test@example.com".to_string()),
]
.iter()
.cloned(),
);
let expected = [
Uri::Website(Url::parse("https://endler.dev").unwrap()),
Uri::Website(Url::parse("https://hello-rust.show/foo/bar?lol=1").unwrap()),
Uri::Mail("test@example.com".to_string()),
]
.iter()
.cloned()
.collect();
assert_eq!(links, expected)
}