Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clippy lint on missing #[must_use] attributes #107

Merged
merged 1 commit into from
Dec 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions influxdb/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ impl Client {
///
/// let _client = Client::new("http://localhost:8086", "test");
/// ```
#[must_use = "Creating a client is pointless unless you use it"]
pub fn new<S1, S2>(url: S1, database: S2) -> Self
where
S1: Into<String>,
Expand Down Expand Up @@ -105,6 +106,7 @@ impl Client {
///
/// let _client = Client::new("http://localhost:9086", "test").with_auth("admin", "password");
/// ```
#[must_use = "Creating a client is pointless unless you use it"]
pub fn with_auth<S1, S2>(mut self, username: S1, password: S2) -> Self
where
S1: Into<String>,
Expand All @@ -118,6 +120,7 @@ impl Client {
}

/// Replaces the HTTP Client
#[must_use = "Creating a client is pointless unless you use it"]
pub fn with_http_client(mut self, http_client: HttpClient) -> Self {
self.client = http_client;
self
Expand Down
2 changes: 2 additions & 0 deletions influxdb/src/query/read_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub struct ReadQuery {

impl ReadQuery {
/// Creates a new [`ReadQuery`]
#[must_use = "Creating a query is pointless unless you execute it"]
pub fn new<S>(query: S) -> Self
where
S: Into<String>,
Expand All @@ -22,6 +23,7 @@ impl ReadQuery {
}

/// Adds a query to the [`ReadQuery`]
#[must_use = "Creating a query is pointless unless you execute it"]
pub fn add_query<S>(mut self, query: S) -> Self
where
S: Into<String>,
Expand Down
3 changes: 3 additions & 0 deletions influxdb/src/query/write_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pub struct WriteQuery {

impl WriteQuery {
/// Creates a new [`WriteQuery`](crate::query::write_query::WriteQuery)
#[must_use = "Creating a query is pointless unless you execute it"]
pub fn new<S>(timestamp: Timestamp, measurement: S) -> Self
where
S: Into<String>,
Expand All @@ -59,6 +60,7 @@ impl WriteQuery {
///
/// Timestamp::Nanoseconds(0).into_query("measurement").add_field("field1", 5).build();
/// ```
#[must_use = "Creating a query is pointless unless you execute it"]
pub fn add_field<S, F>(mut self, field: S, value: F) -> Self
where
S: Into<String>,
Expand All @@ -83,6 +85,7 @@ impl WriteQuery {
/// .into_query("measurement")
/// .add_tag("field1", 5); // calling `.build()` now would result in a `Err(Error::InvalidQueryError)`
/// ```
#[must_use = "Creating a query is pointless unless you execute it"]
pub fn add_tag<S, I>(mut self, tag: S, value: I) -> Self
where
S: Into<String>,
Expand Down