mirror of
https://github.com/Hopiu/lychee.git
synced 2026-05-19 19:11:52 +00:00
Merge pull request #10 from pawroman/fix_clippy_warnings
Actions improvements: add rustfmt and clippy checks, run tests
This commit is contained in:
commit
9ac2176b32
3 changed files with 31 additions and 14 deletions
26
.github/workflows/rust.yml
vendored
26
.github/workflows/rust.yml
vendored
|
|
@ -8,14 +8,32 @@ env:
|
|||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
build_and_test:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
- uses: actions-rs/cargo@v1
|
||||
- name: Run cargo test
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: build
|
||||
args: --release --all-features
|
||||
command: test
|
||||
lints:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
components: clippy
|
||||
- name: Run cargo fmt (check if all code is rustfmt-ed)
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: fmt
|
||||
args: --all -- --check
|
||||
- name: Run cargo clippy (deny warnings)
|
||||
uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: clippy
|
||||
args: -- -D warnings
|
||||
|
|
|
|||
|
|
@ -43,10 +43,8 @@ impl Status {
|
|||
if accepted.contains(&statuscode) {
|
||||
return Status::Ok(statuscode);
|
||||
}
|
||||
} else {
|
||||
if statuscode.is_success() {
|
||||
return Status::Ok(statuscode);
|
||||
}
|
||||
} else if statuscode.is_success() {
|
||||
return Status::Ok(statuscode);
|
||||
};
|
||||
if statuscode.is_redirection() {
|
||||
Status::Redirected
|
||||
|
|
@ -119,6 +117,9 @@ pub(crate) struct Checker<'a> {
|
|||
|
||||
impl<'a> Checker<'a> {
|
||||
/// Creates a new link checker
|
||||
// we should consider adding a config struct for this, so that the list
|
||||
// of arguments is short
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn try_new(
|
||||
token: String,
|
||||
excludes: Excludes,
|
||||
|
|
@ -215,7 +216,7 @@ impl<'a> Checker<'a> {
|
|||
status
|
||||
}
|
||||
|
||||
pub async fn valid_mail(&self, address: &String) -> bool {
|
||||
pub async fn valid_mail(&self, address: &str) -> bool {
|
||||
let input = CheckEmailInput::new(vec![address.to_string()]);
|
||||
let results = check_email(&input).await;
|
||||
let result = results.get(0);
|
||||
|
|
@ -334,10 +335,8 @@ impl<'a> Checker<'a> {
|
|||
if let Some(message) = self.status_message(&ret, uri) {
|
||||
pb.println(message);
|
||||
}
|
||||
} else {
|
||||
if let Some(message) = self.status_message(&ret, uri) {
|
||||
println!("{}", message);
|
||||
}
|
||||
} else if let Some(message) = self.status_message(&ret, uri) {
|
||||
println!("{}", message);
|
||||
}
|
||||
|
||||
ret
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ use checker::{Checker, Excludes, Status};
|
|||
use extract::Uri;
|
||||
use options::LycheeOptions;
|
||||
|
||||
fn print_summary(found: &HashSet<Uri>, results: &Vec<Status>) {
|
||||
fn print_summary(found: &HashSet<Uri>, results: &[Status]) {
|
||||
let found = found.len();
|
||||
let excluded: usize = results
|
||||
.iter()
|
||||
|
|
|
|||
Loading…
Reference in a new issue