Add lints

Add some useful #![deny(...)] lints:
- missing_docs to disallow undocumented public items;
- missing_debug_implementations for public types;
- no unsafe code or unstable features.
This commit is contained in:
Koen Bolhuis 2021-10-19 23:56:42 +02:00
parent f3d2666960
commit e9fd33a7b3
5 changed files with 15 additions and 0 deletions

View File

@ -24,6 +24,13 @@
//!
//! [ListenBrainz HTTP API]: https://listenbrainz.readthedocs.io/en/production/dev/api/
#![deny(
missing_docs,
missing_debug_implementations,
unsafe_code,
unstable_features
)]
mod error;
pub mod raw;
mod wrapper;

View File

@ -18,6 +18,7 @@ const API_ROOT_URL: &str = "https://api.listenbrainz.org/1/";
/// - [`Error::Api`]: the API returned a non-`2XX` status.
/// - [`Error::Json`]: the request or response data could not be converted from or into JSON.
/// - [`Error::Http`]: there was some other HTTP error while interacting with the API.
#[derive(Debug)]
pub struct Client {
api_root_url: String,
}
@ -30,6 +31,7 @@ impl Client {
}
}
/// Construct a new client with a custom API URL.
pub fn new_with_url(url: &str) -> Self {
Self {
api_root_url: url.to_string(),

View File

@ -1,5 +1,7 @@
//! Low-level request data models.
#![allow(missing_docs)]
use std::collections::HashMap;
use serde::Serialize;

View File

@ -4,6 +4,8 @@
//! information. See the documentation of the [`RateLimit`] type for more
//! details.
#![allow(missing_docs)]
use std::collections::HashMap;
use attohttpc::Response;

View File

@ -7,6 +7,7 @@ use crate::raw::Client;
/// Contains a ListenBrainz token and the associated username
/// for authentication purposes.
#[derive(Debug)]
struct Auth {
token: String,
user: String,
@ -16,6 +17,7 @@ struct Auth {
///
/// As opposed to [`Client`](crate::raw::Client), this aims to be a convenient and high-level
/// wrapper of the ListenBrainz API.
#[derive(Debug)]
pub struct ListenBrainz {
client: Client,
auth: Option<Auth>,