mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-23 23:51:06 +01:00
Make the lint stricter (#20)
* Make the lint stricter * Add explicit lifetimes * Allow `needless_doctest_main`
This commit is contained in:
parent
d757f44557
commit
8dd2c77165
@ -50,11 +50,13 @@ impl AuthExtractorConfig for Config {
|
||||
}
|
||||
}
|
||||
|
||||
// Needs `fn main` to display complete example.
|
||||
#[allow(clippy::needless_doctest_main)]
|
||||
/// Extractor for HTTP Basic auth.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// ```
|
||||
/// use actix_web::Result;
|
||||
/// use actix_web_httpauth::extractors::basic::BasicAuth;
|
||||
///
|
||||
@ -69,7 +71,7 @@ impl AuthExtractorConfig for Config {
|
||||
///
|
||||
/// ## Example
|
||||
///
|
||||
/// ```rust
|
||||
/// ```
|
||||
/// use actix_web::{web, App};
|
||||
/// use actix_web_httpauth::extractors::basic::{BasicAuth, Config};
|
||||
///
|
||||
|
@ -54,11 +54,13 @@ impl AuthExtractorConfig for Config {
|
||||
}
|
||||
}
|
||||
|
||||
// Needs `fn main` to display complete example.
|
||||
#[allow(clippy::needless_doctest_main)]
|
||||
/// Extractor for HTTP Bearer auth
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// ```
|
||||
/// use actix_web_httpauth::extractors::bearer::BearerAuth;
|
||||
///
|
||||
/// async fn index(auth: BearerAuth) -> String {
|
||||
@ -72,7 +74,7 @@ impl AuthExtractorConfig for Config {
|
||||
///
|
||||
/// ## Example
|
||||
///
|
||||
/// ```rust
|
||||
/// ```
|
||||
/// use actix_web::{web, App};
|
||||
/// use actix_web_httpauth::extractors::bearer::{BearerAuth, Config};
|
||||
///
|
||||
|
@ -43,7 +43,7 @@ impl<C: Challenge> AuthenticationError<C> {
|
||||
}
|
||||
|
||||
impl<C: Challenge> fmt::Display for AuthenticationError<C> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmt::Display::fmt(&self.status_code, f)
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ pub enum ParseError {
|
||||
}
|
||||
|
||||
impl fmt::Display for ParseError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let display = match self {
|
||||
ParseError::Invalid => "Invalid header value".to_string(),
|
||||
ParseError::MissingScheme => {
|
||||
|
@ -21,7 +21,7 @@ use crate::headers::authorization::scheme::Scheme;
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// ```
|
||||
/// # use actix_web::http::header::Header;
|
||||
/// # use actix_web::{HttpRequest, Result};
|
||||
/// # use actix_web_httpauth::headers::authorization::{Authorization, Basic};
|
||||
@ -98,7 +98,7 @@ impl<S: Scheme> IntoHeaderValue for Authorization<S> {
|
||||
}
|
||||
|
||||
impl<S: Scheme> fmt::Display for Authorization<S> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fmt::Display::fmt(&self.0, f)
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ impl Basic {
|
||||
///
|
||||
/// ## Example
|
||||
///
|
||||
/// ```rust
|
||||
/// ```
|
||||
/// # use actix_web_httpauth::headers::authorization::Basic;
|
||||
/// let credentials = Basic::new("Alladin", Some("open sesame"));
|
||||
/// ```
|
||||
@ -89,13 +89,13 @@ impl Scheme for Basic {
|
||||
}
|
||||
|
||||
impl fmt::Debug for Basic {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.write_fmt(format_args!("Basic {}:******", self.user_id))
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Basic {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.write_fmt(format_args!("Basic {}:******", self.user_id))
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ impl Bearer {
|
||||
///
|
||||
/// ## Example
|
||||
///
|
||||
/// ```rust
|
||||
/// ```
|
||||
/// # use actix_web_httpauth::headers::authorization::Bearer;
|
||||
/// let credentials = Bearer::new("mF_9.B5f-4.1JqM");
|
||||
/// ```
|
||||
@ -64,13 +64,13 @@ impl Scheme for Bearer {
|
||||
}
|
||||
|
||||
impl fmt::Debug for Bearer {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.write_fmt(format_args!("Bearer ******"))
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Bearer {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.write_fmt(format_args!("Bearer {}", self.token))
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ use crate::utils;
|
||||
///
|
||||
/// ## Example
|
||||
///
|
||||
/// ```rust
|
||||
/// ```
|
||||
/// # use actix_web::{web, App, HttpRequest, HttpResponse, HttpServer};
|
||||
/// use actix_web_httpauth::headers::www_authenticate::basic::Basic;
|
||||
/// use actix_web_httpauth::headers::www_authenticate::WwwAuthenticate;
|
||||
@ -44,7 +44,7 @@ impl Basic {
|
||||
///
|
||||
/// ## Example
|
||||
///
|
||||
/// ```rust
|
||||
/// ```
|
||||
/// # use actix_web_httpauth::headers::www_authenticate::basic::Basic;
|
||||
/// let challenge = Basic::new();
|
||||
/// ```
|
||||
@ -56,12 +56,12 @@ impl Basic {
|
||||
///
|
||||
/// ## Examples
|
||||
///
|
||||
/// ```rust
|
||||
/// ```
|
||||
/// # use actix_web_httpauth::headers::www_authenticate::basic::Basic;
|
||||
/// let challenge = Basic::with_realm("Restricted area");
|
||||
/// ```
|
||||
///
|
||||
/// ```rust
|
||||
/// ```
|
||||
/// # use actix_web_httpauth::headers::www_authenticate::basic::Basic;
|
||||
/// let my_realm = "Earth realm".to_string();
|
||||
/// let challenge = Basic::with_realm(my_realm);
|
||||
@ -94,7 +94,7 @@ impl Challenge for Basic {
|
||||
}
|
||||
|
||||
impl fmt::Display for Basic {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
||||
let bytes = self.to_bytes();
|
||||
let repr = str::from_utf8(&bytes)
|
||||
// Should not happen since challenges are crafted manually
|
||||
|
@ -16,7 +16,7 @@ use crate::utils;
|
||||
///
|
||||
/// ## Example
|
||||
///
|
||||
/// ```rust
|
||||
/// ```
|
||||
/// # use actix_web::{web, App, HttpRequest, HttpResponse, HttpServer};
|
||||
/// use actix_web_httpauth::headers::www_authenticate::bearer::{
|
||||
/// Bearer, Error,
|
||||
@ -53,7 +53,7 @@ impl Bearer {
|
||||
///
|
||||
/// ## Example
|
||||
///
|
||||
/// ```rust
|
||||
/// ```
|
||||
/// # use actix_web_httpauth::headers::www_authenticate::bearer::{Bearer};
|
||||
/// let challenge = Bearer::build()
|
||||
/// .realm("Restricted area")
|
||||
@ -121,7 +121,7 @@ impl Challenge for Bearer {
|
||||
}
|
||||
|
||||
impl fmt::Display for Bearer {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
||||
let bytes = self.to_bytes();
|
||||
let repr = str::from_utf8(&bytes)
|
||||
// Should not happen since challenges are crafted manually
|
||||
|
@ -45,7 +45,7 @@ impl Error {
|
||||
}
|
||||
|
||||
impl fmt::Display for Error {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.write_str(self.as_str())
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,10 @@
|
||||
|
||||
#![deny(bare_trait_objects)]
|
||||
#![deny(missing_docs)]
|
||||
#![deny(nonstandard_style)]
|
||||
#![deny(rust_2018_idioms)]
|
||||
#![deny(unused)]
|
||||
#![deny(clippy::all)]
|
||||
#![cfg_attr(feature = "nightly", feature(test))]
|
||||
|
||||
pub mod extractors;
|
||||
|
@ -59,7 +59,7 @@ where
|
||||
///
|
||||
/// ## Example
|
||||
///
|
||||
/// ```rust
|
||||
/// ```
|
||||
/// # use actix_web::Error;
|
||||
/// # use actix_web::dev::ServiceRequest;
|
||||
/// # use actix_web_httpauth::middleware::HttpAuthentication;
|
||||
@ -94,7 +94,7 @@ where
|
||||
///
|
||||
/// ## Example
|
||||
///
|
||||
/// ```rust
|
||||
/// ```
|
||||
/// # use actix_web::Error;
|
||||
/// # use actix_web::dev::ServiceRequest;
|
||||
/// # use actix_web_httpauth::middleware::HttpAuthentication;
|
||||
|
@ -13,7 +13,7 @@ struct Quoted<'a> {
|
||||
}
|
||||
|
||||
impl<'a> Quoted<'a> {
|
||||
pub fn new(s: &'a str) -> Quoted {
|
||||
pub fn new(s: &'a str) -> Quoted<'_> {
|
||||
Quoted {
|
||||
inner: s.split('"').peekable(),
|
||||
state: State::YieldStr,
|
||||
|
Loading…
Reference in New Issue
Block a user