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:
parent
da32c1bb49
commit
c08cd8a23a
@ -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,
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
@ -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,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user