CI: Run clippy with Rust 1.46 (#132)

This commit is contained in:
Danilo Bargen 2020-08-30 19:55:38 +02:00 committed by GitHub
commit e507343f5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 8 deletions

View file

@ -45,7 +45,7 @@ jobs:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.39.0
toolchain: 1.46.0
components: clippy
override: true
- uses: actions-rs/clippy-check@v1

View file

@ -150,7 +150,10 @@ impl Cache {
// Get platform dir
let platforms_dir = match Self::get_cache_dir() {
Ok(cache_dir) => cache_dir.join("tldr-master").join("pages"),
_ => return None,
Err(e) => {
log::error!("Could not get cache directory: {}", e);
return None;
}
};
// Determine platform

View file

@ -8,7 +8,6 @@ use ansi_term::{Color, Style};
use app_dirs::{get_app_root, AppDataType};
use log::debug;
use serde_derive::{Deserialize, Serialize};
use toml;
use crate::error::TealdeerError::{self, ConfigError};
@ -120,8 +119,9 @@ struct RawDisplayConfig {
}
/// Serde doesn't support default values yet (tracking issue:
/// https://github.com/serde-rs/serde/issues/368), so we need to wrap DEFAULT_UPDATE_INTERVAL_HOURS
/// in a function to be able to use #[serde(default = ...)]
/// <https://github.com/serde-rs/serde/issues/368>), so we need to wrap
/// `DEFAULT_UPDATE_INTERVAL_HOURS` in a function to be able to use
/// `#[serde(default = ...)]`
const fn default_auto_update_interval_hours() -> u64 {
DEFAULT_UPDATE_INTERVAL_HOURS
}

View file

@ -89,6 +89,7 @@ const ARCHIVE_URL: &str = "https://github.com/tldr-pages/tldr/archive/master.tar
const PAGER_COMMAND: &str = "less -R";
#[derive(Debug, Deserialize)]
#[allow(clippy::struct_excessive_bools)]
struct Args {
arg_command: Option<Vec<String>>,
flag_help: bool,
@ -158,11 +159,11 @@ fn check_cache(args: &Args) {
))
);
}
Some(_) => {}
None => {
eprintln!("Cache not found. Please run `tldr --update`.");
process::exit(1);
}
_ => {}
};
}

View file

@ -55,7 +55,7 @@ impl<'a> From<&'a str> for LineType {
.into(),
),
Some(' ') => Self::ExampleCode(trimmed.trim_start_matches(char::is_whitespace).into()),
_ => Self::ExampleText(trimmed.into()),
Some(_) => Self::ExampleText(trimmed.into()),
}
}
}
@ -88,7 +88,7 @@ impl LineType {
.trim_matches(|chr: char| chr == '`' || chr.is_whitespace())
.into(),
),
_ => Self::Other(trimmed.into()),
Some(_) => Self::Other(trimmed.into()),
}
}
}