1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-27 17:22:57 +01:00

add standard crate lints

This commit is contained in:
Rob Ede 2022-07-31 15:33:22 +01:00
parent da32c1bb49
commit c08cd8a23a
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
8 changed files with 18 additions and 8 deletions

View File

@ -1,5 +1,12 @@
//! Easily manage Actix Web's settings from a TOML file and environment variables. //! Easily manage Actix Web's settings from a TOML file and environment variables.
#![forbid(unsafe_code)]
#![deny(rust_2018_idioms, nonstandard_style)]
#![warn(future_incompatible, missing_debug_implementations)]
// #![warn(missing_docs)]
#![doc(html_logo_url = "https://actix.rs/img/logo.png")]
#![doc(html_favicon_url = "https://actix.rs/favicon.ico")]
use std::{ use std::{
env, fmt, env, fmt,
fs::File, fs::File,

View File

@ -35,7 +35,7 @@ impl<'de> de::Deserialize<'de> for Backlog {
impl<'de> de::Visitor<'de> for BacklogVisitor { impl<'de> de::Visitor<'de> for BacklogVisitor {
type Value = Backlog; type Value = Backlog;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
let msg = "Either \"default\" or a string containing an integer > 0"; let msg = "Either \"default\" or a string containing an integer > 0";
formatter.write_str(msg) formatter.write_str(msg)
} }

View File

@ -31,7 +31,7 @@ impl Parse for KeepAlive {
}; };
} }
let digits_in = |m: regex::Match| &string[m.start()..m.end()]; let digits_in = |m: regex::Match<'_>| &string[m.start()..m.end()];
match string { match string {
"default" => Ok(KeepAlive::Default), "default" => Ok(KeepAlive::Default),
"disabled" => Ok(KeepAlive::Disabled), "disabled" => Ok(KeepAlive::Disabled),
@ -58,7 +58,7 @@ impl<'de> de::Deserialize<'de> for KeepAlive {
impl<'de> de::Visitor<'de> for KeepAliveVisitor { impl<'de> de::Visitor<'de> for KeepAliveVisitor {
type Value = KeepAlive; type Value = KeepAlive;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
let msg = "Either \"default\", \"disabled\", \"os\", or a string of the format \"N seconds\" where N is an integer > 0"; let msg = "Either \"default\", \"disabled\", \"os\", or a string of the format \"N seconds\" where N is an integer > 0";
formatter.write_str(msg) formatter.write_str(msg)
} }

View File

@ -35,7 +35,7 @@ impl<'de> de::Deserialize<'de> for MaxConnectionRate {
impl<'de> de::Visitor<'de> for MaxConnectionRateVisitor { impl<'de> de::Visitor<'de> for MaxConnectionRateVisitor {
type Value = MaxConnectionRate; type Value = MaxConnectionRate;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
let msg = "Either \"default\" or a string containing an integer > 0"; let msg = "Either \"default\" or a string containing an integer > 0";
formatter.write_str(msg) formatter.write_str(msg)
} }

View File

@ -35,7 +35,7 @@ impl<'de> de::Deserialize<'de> for MaxConnections {
impl<'de> de::Visitor<'de> for MaxConnectionsVisitor { impl<'de> de::Visitor<'de> for MaxConnectionsVisitor {
type Value = MaxConnections; type Value = MaxConnections;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
let msg = "Either \"default\" or a string containing an integer > 0"; let msg = "Either \"default\" or a string containing an integer > 0";
formatter.write_str(msg) formatter.write_str(msg)
} }

View File

@ -2,11 +2,14 @@ use serde::Deserialize;
use crate::{AtResult, Parse}; use crate::{AtResult, Parse};
/// /// Marker of intended deployment environment.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize)] #[derive(Debug, Clone, PartialEq, Eq, Hash, Deserialize)]
#[serde(rename_all = "lowercase")] #[serde(rename_all = "lowercase")]
pub enum Mode { pub enum Mode {
/// Marks development environment.
Development, Development,
/// Marks production environment.
Production, Production,
} }

View File

@ -35,7 +35,7 @@ impl<'de> de::Deserialize<'de> for NumWorkers {
impl<'de> de::Visitor<'de> for NumWorkersVisitor { impl<'de> de::Visitor<'de> for NumWorkersVisitor {
type Value = NumWorkers; type Value = NumWorkers;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
let msg = "Either \"default\" or a string containing an integer > 0"; let msg = "Either \"default\" or a string containing an integer > 0";
formatter.write_str(msg) formatter.write_str(msg)
} }

View File

@ -64,7 +64,7 @@ impl<'de> de::Deserialize<'de> for Timeout {
impl<'de> de::Visitor<'de> for TimeoutVisitor { impl<'de> de::Visitor<'de> for TimeoutVisitor {
type Value = Timeout; type Value = Timeout;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
let msg = "Either \"default\", \"disabled\", \"os\", or a string of the format \"N seconds\" where N is an integer > 0"; let msg = "Either \"default\", \"disabled\", \"os\", or a string of the format \"N seconds\" where N is an integer > 0";
formatter.write_str(msg) formatter.write_str(msg)
} }