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:
parent
f3d2666960
commit
e9fd33a7b3
|
@ -24,6 +24,13 @@
|
||||||
//!
|
//!
|
||||||
//! [ListenBrainz HTTP API]: https://listenbrainz.readthedocs.io/en/production/dev/api/
|
//! [ListenBrainz HTTP API]: https://listenbrainz.readthedocs.io/en/production/dev/api/
|
||||||
|
|
||||||
|
#![deny(
|
||||||
|
missing_docs,
|
||||||
|
missing_debug_implementations,
|
||||||
|
unsafe_code,
|
||||||
|
unstable_features
|
||||||
|
)]
|
||||||
|
|
||||||
mod error;
|
mod error;
|
||||||
pub mod raw;
|
pub mod raw;
|
||||||
mod wrapper;
|
mod wrapper;
|
||||||
|
|
|
@ -18,6 +18,7 @@ const API_ROOT_URL: &str = "https://api.listenbrainz.org/1/";
|
||||||
/// - [`Error::Api`]: the API returned a non-`2XX` status.
|
/// - [`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::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.
|
/// - [`Error::Http`]: there was some other HTTP error while interacting with the API.
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct Client {
|
pub struct Client {
|
||||||
api_root_url: String,
|
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 {
|
pub fn new_with_url(url: &str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
api_root_url: url.to_string(),
|
api_root_url: url.to_string(),
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
//! Low-level request data models.
|
//! Low-level request data models.
|
||||||
|
|
||||||
|
#![allow(missing_docs)]
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
//! information. See the documentation of the [`RateLimit`] type for more
|
//! information. See the documentation of the [`RateLimit`] type for more
|
||||||
//! details.
|
//! details.
|
||||||
|
|
||||||
|
#![allow(missing_docs)]
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use attohttpc::Response;
|
use attohttpc::Response;
|
||||||
|
|
|
@ -7,6 +7,7 @@ use crate::raw::Client;
|
||||||
|
|
||||||
/// Contains a ListenBrainz token and the associated username
|
/// Contains a ListenBrainz token and the associated username
|
||||||
/// for authentication purposes.
|
/// for authentication purposes.
|
||||||
|
#[derive(Debug)]
|
||||||
struct Auth {
|
struct Auth {
|
||||||
token: String,
|
token: String,
|
||||||
user: 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
|
/// As opposed to [`Client`](crate::raw::Client), this aims to be a convenient and high-level
|
||||||
/// wrapper of the ListenBrainz API.
|
/// wrapper of the ListenBrainz API.
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct ListenBrainz {
|
pub struct ListenBrainz {
|
||||||
client: Client,
|
client: Client,
|
||||||
auth: Option<Auth>,
|
auth: Option<Auth>,
|
||||||
|
|
Loading…
Reference in New Issue