Skip to content

Commit a1c5f7c

Browse files
authored
Update Rust Edition to 2021 and remove deprecated <dyn Query>::raw_read_query (#169)
* Update Rust Edition to 2021 Our MSRV is 1.67.1, edition 2021 was introduced in 1.56. We are already using resolver 2, which became default in 2021. Safe to say we can just migrate to 2021 completely at this point. * make "chrono" a required feature for derive_integration_tests * remove deprecated `Query::raw_read_query` * fix imports
1 parent ad0d84a commit a1c5f7c

File tree

7 files changed

+17
-31
lines changed

7 files changed

+17
-31
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Removed
11+
- `<dyn Query>::raw_read_query`, deprecated in 0.5.0, was removed
12+
1013
## [0.7.2] - 2024-02-14
1114

1215
### Fixed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ resolver = "2"
66

77
[workspace.package]
88
authors = ["Gero Gerke <[email protected]>", "Dominic <[email protected]>"]
9-
edition = "2018"
9+
edition = "2021"
1010
rust-version = "1.67.1"
1111
license = "MIT"
1212
repository = "https://github.com/influxdb-rs/influxdb-rust"

influxdb/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ repository.workspace = true
1616
[lints]
1717
workspace = true
1818

19+
[[test]]
20+
name = "derive_integration_tests"
21+
path = "tests/derive_integration_tests.rs"
22+
required-features = ["chrono"]
23+
1924
[dependencies]
2025
chrono = { version = "0.4.23", features = ["serde"], default-features = false, optional = true }
2126
futures-util = "0.3.17"

influxdb/src/integrations/serde_integration/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//! `name`, InfluxDB provides alongside query results.
88
//!
99
//! ```rust,no_run
10-
//! use influxdb::{Client, Query};
10+
//! use influxdb::{Client, Query as _, ReadQuery};
1111
//! use serde_derive::Deserialize;
1212
//!
1313
//! #[derive(Deserialize)]
@@ -24,7 +24,7 @@
2424
//! # #[tokio::main]
2525
//! # async fn main() -> Result<(), influxdb::Error> {
2626
//! let client = Client::new("http://localhost:8086", "test");
27-
//! let query = Query::raw_read_query(
27+
//! let query = ReadQuery::new(
2828
//! "SELECT temperature FROM /weather_[a-z]*$/ WHERE time > now() - 1m ORDER BY DESC",
2929
//! );
3030
//! let mut db_result = client.json_query(query).await?;

influxdb/src/query/mod.rs

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! # Examples
55
//!
66
//! ```rust
7-
//! use influxdb::{Query, Timestamp};
7+
//! use influxdb::{ReadQuery, Query as _, Timestamp};
88
//! use influxdb::InfluxDbWriteable;
99
//!
1010
//! let write_query = Timestamp::Nanoseconds(0).into_query("measurement")
@@ -14,7 +14,7 @@
1414
//!
1515
//! assert!(write_query.is_ok());
1616
//!
17-
//! let read_query = Query::raw_read_query("SELECT * FROM weather")
17+
//! let read_query = ReadQuery::new("SELECT * FROM weather")
1818
//! .build();
1919
//!
2020
//! assert!(read_query.is_ok());
@@ -26,7 +26,7 @@ pub mod read_query;
2626
pub mod write_query;
2727
use std::fmt;
2828

29-
use crate::{Error, ReadQuery, WriteQuery};
29+
use crate::{Error, WriteQuery};
3030
use consts::{
3131
MILLIS_PER_SECOND, MINUTES_PER_HOUR, NANOS_PER_MICRO, NANOS_PER_MILLI, SECONDS_PER_MINUTE,
3232
};
@@ -195,25 +195,6 @@ impl InfluxDbWriteable for Timestamp {
195195
}
196196
}
197197

198-
impl dyn Query {
199-
/// Returns a [`ReadQuery`](crate::ReadQuery) builder.
200-
///
201-
/// # Examples
202-
///
203-
/// ```rust
204-
/// use influxdb::Query;
205-
///
206-
/// Query::raw_read_query("SELECT * FROM weather"); // Is of type [`ReadQuery`](crate::ReadQuery)
207-
/// ```
208-
#[deprecated(since = "0.5.0", note = "Use ReadQuery::new instead")]
209-
pub fn raw_read_query<S>(read_query: S) -> ReadQuery
210-
where
211-
S: Into<String>,
212-
{
213-
ReadQuery::new(read_query)
214-
}
215-
}
216-
217198
#[derive(Debug)]
218199
#[doc(hidden)]
219200
pub struct ValidQuery(String);
@@ -255,7 +236,6 @@ mod tests {
255236
MILLIS_PER_SECOND, MINUTES_PER_HOUR, NANOS_PER_MICRO, NANOS_PER_MILLI, SECONDS_PER_MINUTE,
256237
};
257238
use crate::query::{Timestamp, ValidQuery};
258-
use std::convert::TryInto;
259239
#[test]
260240
fn test_equality_str() {
261241
assert_eq!(ValidQuery::from("hello"), "hello");

influxdb/src/query/read_query.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
//! Read Query Builder returned by Query::raw_read_query
2-
//!
3-
//! Can only be instantiated by using Query::raw_read_query
1+
//! Read Query Builder
42
53
use crate::query::{QueryType, ValidQuery};
64
use crate::{Error, Query};
@@ -49,7 +47,8 @@ impl Query for ReadQuery {
4947

5048
#[cfg(test)]
5149
mod tests {
52-
use crate::query::{Query, QueryType, ReadQuery};
50+
use super::ReadQuery;
51+
use crate::query::{Query, QueryType};
5352

5453
#[test]
5554
fn test_read_builder_single_query() {

influxdb_derive/src/writeable.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use proc_macro2::TokenStream;
22
use quote::{format_ident, quote};
3-
use std::convert::TryFrom;
43
use syn::{
54
parse::{Parse, ParseStream},
65
punctuated::Punctuated,

0 commit comments

Comments
 (0)