diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index d841d77..ec3bba4 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -24,13 +24,15 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@1.75.0 + - uses: dtolnay/rust-toolchain@1.88.0 with: components: clippy + - name: Update Cargo.lock + run: cargo --config 'resolver.incompatible-rust-versions="fallback"' update - name: Check Clippy lints (reqwest) - run: cargo clippy --manifest-path influxdb/Cargo.toml --all-targets --no-default-features --features serde,derive,reqwest-client-rustls -- -D warnings + run: cargo clippy --manifest-path influxdb/Cargo.toml --locked --all-targets --no-default-features --features serde,derive,reqwest-client-rustls -- -D warnings - name: Check Clippy lints (surf) - run: cargo clippy --manifest-path influxdb/Cargo.toml --all-targets --no-default-features --features serde,derive,hyper-client -- -D warnings + run: cargo clippy --manifest-path influxdb/Cargo.toml --locked --all-targets --no-default-features --features serde,derive,hyper-client -- -D warnings # this checks that the code is formatted with rustfmt rustfmt: @@ -44,20 +46,6 @@ jobs: - name: Check code formatting run: cargo fmt --all -- --check - # this checks the msrv - msrv: - name: Verify MSRV - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: baptiste0928/cargo-install@v3 - with: - crate: cargo-msrv - - name: Verify minimum rust version of influxdb crate - run: cargo msrv --path influxdb --output-format json verify - - name: Verify minimum rust version of influxdb_derive crate - run: cargo msrv --path influxdb_derive --output-format json verify - # this tests that all unit and doc tests are successful unit_tests: name: Unit and Doc Tests (Rust ${{matrix.rust.name}} on ${{matrix.os}}) @@ -77,21 +65,51 @@ jobs: toolchain: nightly nightly: true os: [ubuntu-latest, windows-latest, macOS-latest] + include: + - rust: + name: MSRV + toolchain: stable + nightly: false + os: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: toolchain: ${{matrix.rust.toolchain}} id: rust-toolchain + - run: cargo --config 'resolver.incompatible-rust-versions="fallback"' update + # on msrv runs, downgrade rust after generating the Cargo.lock file + - run: sudo apt -y update && sudo apt -y install --no-install-recommends yq + if: matrix.rust.name == 'MSRV' + - run: echo "rust-version=$(tomlq -r '.workspace.package."rust-version"' Cargo.toml)" >>$GITHUB_OUTPUT + id: msrv + if: matrix.rust.name == 'MSRV' + - uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{steps.msrv.outputs.rust-version}} + id: msrv-toolchain + if: matrix.rust.name == 'MSRV' + # on non-msrv runs, use one cache key ... + - uses: actions/cache@v4 + with: + path: | + ~/.cargo/git + ~/.cargo/registry + target + key: "${{runner.os}} Rust ${{steps.rust-toolchain.outputs.cachekey}}" + if: matrix.rust.name != 'MSRV' + # ... and on msrv runs, use another - uses: actions/cache@v4 with: path: | ~/.cargo/git ~/.cargo/registry target - key: "${{matrix.rust.toolchain}} on ${{runner.os}} Rust ${{steps.rust-toolchain.outputs.cachekey}}" - - run: cargo test --lib - - run: cargo test --doc + key: "${{runner.os}} Rust ${{steps.msrv-toolchain.outputs.cachekey}}" + if: matrix.rust.name == 'MSRV' + # finally we can run tests + - run: cargo test --lib --locked + - run: cargo test --doc --locked # this tests that all integration tests are successful integration_tests: diff --git a/Cargo.toml b/Cargo.toml index d87619e..37508ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,23 @@ [workspace] members = ["influxdb", "influxdb_derive", "benches"] +resolver = "2" + +[workspace.package] +authors = ["Gero Gerke ", "Dominic "] +edition = "2018" +rust-version = "1.65" +license = "MIT" +repository = "https://github.com/influxdb-rs/influxdb-rust" + +[workspace.lints.rust] +bare_trait_objects = "forbid" +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tarpaulin)', 'cfg(tarpaulin_include)'] } + +[workspace.lints.clippy] +multiple_bound_locations = "allow" # clippy has wrong opinions +needless_doctest_main = "allow" +needless_lifetimes = "allow" # False positive in client/mod.rs query fn [patch.crates-io] influxdb = { path = "./influxdb" } diff --git a/README.j2 b/README.j2 index be728de..cba6ed7 100644 --- a/README.j2 +++ b/README.j2 @@ -25,8 +25,8 @@ Build with Rust - - Minimum Rust Version: 1.67 + + Minimum Rust Version: {{ rust_version }}

diff --git a/README.md b/README.md index 9865904..289ed65 100644 --- a/README.md +++ b/README.md @@ -25,40 +25,36 @@ Build with Rust - - Minimum Rust Version: 1.65 + + Minimum Rust Version: 1.65.0

Pull requests are always welcome. See [Contributing][__link0] and [Code of Conduct][__link1]. For a list of past changes, see [CHANGELOG.md][__link2]. - ### Currently Supported Features - - Reading and writing to InfluxDB - - Optional Serde support for deserialization - - Running multiple queries in one request (e.g. `SELECT * FROM weather_berlin; SELECT * FROM weather_london`) - - Writing single or multiple measurements in one request (e.g. `WriteQuery` or `Vec` argument) - - Authenticated and unauthenticated connections - - `async`/`await` support - - `#[derive(InfluxDbWriteable)]` derive macro for writing / reading into structs - - `GROUP BY` support - - Tokio and async-std support (see example below) or [available backends][__link3] - - Swappable HTTP backends ([see below](#Choice-of-HTTP-backend)) - +* Reading and writing to InfluxDB +* Optional Serde support for deserialization +* Running multiple queries in one request (e.g. `SELECT * FROM weather_berlin; SELECT * FROM weather_london`) +* Writing single or multiple measurements in one request (e.g. `WriteQuery` or `Vec` argument) +* Authenticated and unauthenticated connections +* `async`/`await` support +* `#[derive(InfluxDbWriteable)]` derive macro for writing / reading into structs +* `GROUP BY` support +* Tokio and async-std support (see example below) or [available backends][__link3] +* Swappable HTTP backends ([see below](#Choice-of-HTTP-backend)) ## Quickstart Add the following to your `Cargo.toml` - ```toml influxdb = { version = "0.7.2", features = ["derive"] } ``` For an example with using Serde deserialization, please refer to [serde_integration][__link4] - ```rust use chrono::{DateTime, Utc}; use influxdb::{Client, Error, InfluxDbWriteable, ReadQuery, Timestamp}; @@ -104,73 +100,62 @@ async fn main() -> Result<(), Error> { } ``` -For further examples, check out the integration tests in `tests/integration_tests.rs` in the repository. - +For further examples, check out the integration tests in `tests/integration_tests.rs` +in the repository. ## Choice of HTTP backend To communicate with InfluxDB, you can choose the HTTP backend to be used configuring the appropriate feature. We recommend sticking with the default reqwest-based client, unless you really need async-std compatibility. - - **[hyper][__link5]** (through reqwest, used by default), with [rustls][__link6] - ```toml - influxdb = { version = "0.7.2", features = ["derive"] } - ``` - - - - **[hyper][__link7]** (through reqwest), with native TLS (OpenSSL) - ```toml - influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "reqwest-client-native-tls"] } - ``` - - - - **[hyper][__link8]** (through reqwest), with vendored native TLS (OpenSSL) - ```toml - influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "reqwest-client-native-tls-vendored"] } - ``` - - - - **[hyper][__link9]** (through surf), use this if you need tokio 0.2 compatibility - ```toml - influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "hyper-client"] } - ``` - - - - **[curl][__link10]**, using [libcurl][__link11] - ```toml - influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "curl-client"] } - ``` - - - - **[async-h1][__link12]** with native TLS (OpenSSL) - ```toml - influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "h1-client"] } - ``` - - - - **[async-h1][__link13]** with [rustls][__link14] - ```toml - influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "h1-client-rustls"] } - ``` - - - - WebAssembly’s `window.fetch`, via `web-sys` and **[wasm-bindgen][__link15]** - ```toml - influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "wasm-client"] } - ``` - - - +* **[hyper][__link5]** (through reqwest, used by default), with [rustls][__link6] + ```toml + influxdb = { version = "0.7.2", features = ["derive"] } + ``` + +* **[hyper][__link7]** (through reqwest), with native TLS (OpenSSL) + ```toml + influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "reqwest-client-native-tls"] } + ``` + +* **[hyper][__link8]** (through reqwest), with vendored native TLS (OpenSSL) + ```toml + influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "reqwest-client-native-tls-vendored"] } + ``` + +* **[hyper][__link9]** (through surf), use this if you need tokio 0.2 compatibility + ```toml + influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "hyper-client"] } + ``` + +* **[curl][__link10]**, using [libcurl][__link11] + ```toml + influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "curl-client"] } + ``` + +* **[async-h1][__link12]** with native TLS (OpenSSL) + ```toml + influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "h1-client"] } + ``` + +* **[async-h1][__link13]** with [rustls][__link14] + ```toml + influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "h1-client-rustls"] } + ``` + +* WebAssembly’s `window.fetch`, via `web-sys` and **[wasm-bindgen][__link15]** + ```toml + influxdb = { version = "0.7.2", default-features = false, features = ["derive", "serde", "wasm-client"] } + ``` ## License -[![License: MIT][__link16]][__link17] - +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)][__link16] @ 2020-2024 Gero Gerke, msrd0 and [contributors]. [contributors]: https://github.com/influxdb-rs/influxdb-rust/graphs/contributors - [__cargo_doc2readme_dependencies_info]: ggGkYW0BYXSEG_RDmlyxxvyrG0rwcLBKoYdvG5It9hbWNgjUGzjD8iBYfsFFYXKEG1LaAVLASZMqG5J2qfpyCvbMG_Rohh5BobOmG0DqLv5454SZYWSBgmhpbmZsdXhkYmUwLjcuMg + [__cargo_doc2readme_dependencies_info]: ggGkYW0BYXSEGzJ_QpW55zB1G0S-TER-rIfLG2gXv8EYBG3jG1nuXXn-kdx-YXKEG1LaAVLASZMqG5J2qfpyCvbMG_Rohh5BobOmG0DqLv5454SZYWSBgmhpbmZsdXhkYmUwLjcuMg [__link0]: https://github.com/influxdb-rs/influxdb-rust/blob/main/CONTRIBUTING.md [__link1]: https://github.com/influxdb-rs/influxdb-rust/blob/main/CODE_OF_CONDUCT.md [__link10]: https://github.com/alexcrichton/curl-rust @@ -179,8 +164,7 @@ To communicate with InfluxDB, you can choose the HTTP backend to be used configu [__link13]: https://github.com/http-rs/async-h1 [__link14]: https://github.com/ctz/rustls [__link15]: https://github.com/rustwasm/wasm-bindgen - [__link16]: https://img.shields.io/badge/License-MIT-yellow.svg - [__link17]: https://opensource.org/licenses/MIT + [__link16]: https://opensource.org/licenses/MIT [__link2]: https://github.com/influxdb-rs/influxdb-rust/blob/main/CHANGELOG.md [__link3]: https://github.com/influxdb-rs/influxdb-rust/blob/main/influxdb/Cargo.toml [__link4]: https://docs.rs/influxdb/0.7.2/influxdb/?search=integrations::serde_integration diff --git a/influxdb/Cargo.toml b/influxdb/Cargo.toml index c31729a..b0ca36e 100644 --- a/influxdb/Cargo.toml +++ b/influxdb/Cargo.toml @@ -3,15 +3,18 @@ [package] name = "influxdb" version = "0.7.2" -authors = ["Gero Gerke <11deutron11@gmail.com>"] -edition = "2018" +authors.workspace = true +edition.workspace = true +rust-version.workspace = true description = "InfluxDB Driver for Rust" keywords = ["influxdb", "database", "influx"] -license = "MIT" +license.workspace = true readme = "README.md" include = ["src/**/*", "tests/**/*", "Cargo.toml", "LICENSE"] -repository = "https://github.com/influxdb-rs/influxdb-rust" -rust-version = "1.70" +repository.workspace = true + +[lints] +workspace = true [dependencies] chrono = { version = "0.4.23", features = ["serde"], default-features = false } diff --git a/influxdb/src/client/mod.rs b/influxdb/src/client/mod.rs index 264cfde..b238a84 100644 --- a/influxdb/src/client/mod.rs +++ b/influxdb/src/client/mod.rs @@ -162,7 +162,7 @@ impl Client { .send() .await .map_err(|err| Error::ProtocolError { - error: format!("{}", err), + error: err.to_string(), })?; const BUILD_HEADER: &str = "X-Influxdb-Build"; @@ -276,13 +276,13 @@ impl Client { let body = res.body_string(); let s = body.await.map_err(|_| Error::DeserializationError { - error: "response could not be converted to UTF-8".to_string(), + error: "response could not be converted to UTF-8".into(), })?; // todo: improve error parsing without serde if s.contains("\"error\"") || s.contains("\"Error\"") { return Err(Error::DatabaseError { - error: format!("influxdb error: \"{}\"", s), + error: format!("influxdb error: {s:?}"), }); } @@ -291,7 +291,7 @@ impl Client { fn auth_if_needed(&self, rb: RequestBuilder) -> RequestBuilder { if let Some(ref token) = self.token { - rb.header("Authorization", format!("Token {}", token)) + rb.header("Authorization", format!("Token {token}")) } else { rb } @@ -314,7 +314,7 @@ mod tests { #[test] fn test_client_debug_redacted_password() { let client = Client::new("https://localhost:8086", "db").with_auth("user", "pass"); - let actual = format!("{:#?}", client); + let actual = format!("{client:#?}"); let expected = indoc! { r#" Client { url: "https://localhost:8086", diff --git a/influxdb/src/integrations/serde_integration/mod.rs b/influxdb/src/integrations/serde_integration/mod.rs index 75b678b..a6373f1 100644 --- a/influxdb/src/integrations/serde_integration/mod.rs +++ b/influxdb/src/integrations/serde_integration/mod.rs @@ -71,7 +71,7 @@ impl DatabaseQueryResult { { serde_json::from_value::>(self.results.remove(0)).map_err(|err| { Error::DeserializationError { - error: format!("could not deserialize: {}", err), + error: format!("could not deserialize: {err}"), } }) } @@ -85,7 +85,7 @@ impl DatabaseQueryResult { { serde_json::from_value::>(self.results.remove(0)).map_err(|err| { Error::DeserializationError { - error: format!("could not deserialize: {}", err), + error: format!("could not deserialize: {err}"), } }) } @@ -123,7 +123,7 @@ pub struct TaggedSeries { impl Client { pub async fn json_query(&self, q: ReadQuery) -> Result { let query = q.build().map_err(|err| Error::InvalidQueryError { - error: format!("{}", err), + error: err.to_string(), })?; let read_query = query.get(); @@ -131,9 +131,7 @@ impl Client { if !read_query_lower.contains("select") && !read_query_lower.contains("show") { let error = Error::InvalidQueryError { - error: String::from( - "Only SELECT and SHOW queries supported with JSON deserialization", - ), + error: "Only SELECT and SHOW queries supported with JSON deserialization".into(), }; return Err(error); } @@ -143,7 +141,7 @@ impl Client { parameters.insert("q", read_query); let mut request_builder = self.client.get(url); if let Some(ref token) = self.token { - request_builder = request_builder.header("Authorization", format!("Token {}", token)) + request_builder = request_builder.header("Authorization", format!("Token {token}")) } let request_builder = request_builder.query(¶meters); @@ -179,7 +177,7 @@ impl Client { // Json has another structure, let's try actually parsing it to the type we're deserializing serde_json::from_slice::(&body).map_err(|err| { Error::DeserializationError { - error: format!("serde error: {}", err), + error: format!("serde error: {err}"), } }) } diff --git a/influxdb/src/lib.rs b/influxdb/src/lib.rs index d062e25..16303bd 100644 --- a/influxdb/src/lib.rs +++ b/influxdb/src/lib.rs @@ -94,10 +94,6 @@ //! //! [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) -#![allow(clippy::needless_doctest_main)] -#![allow(clippy::needless_lifetimes)] // False positive in client/mod.rs query fn -#![forbid(bare_trait_objects)] - macro_rules! cargo_toml { (indent=$indent:literal, $firstfeat:literal $(, $feature:literal)*) => { cargo_toml_private!($indent, "", $firstfeat $(, $feature)*) @@ -107,6 +103,7 @@ macro_rules! cargo_toml { cargo_toml_private!($indent, "default-features = false, ", $firstfeat $(, $feature)*) }; } +use cargo_toml; macro_rules! cargo_toml_private { ($indent:literal, $deffeats:literal, $firstfeat:literal $(, $feature:literal)*) => { @@ -129,6 +126,7 @@ macro_rules! cargo_toml_private { ) }; } +use cargo_toml_private; #[cfg(all(feature = "reqwest", feature = "surf"))] compile_error!("You need to choose between reqwest and surf; enabling both is not supported"); diff --git a/influxdb/src/query/line_proto_term.rs b/influxdb/src/query/line_proto_term.rs index d803c75..6ec6fed 100644 --- a/influxdb/src/query/line_proto_term.rs +++ b/influxdb/src/query/line_proto_term.rs @@ -49,12 +49,12 @@ impl LineProtoTerm<'_> { } .to_string(), Float(v) => v.to_string(), - SignedInteger(v) => format!("{}i", v), + SignedInteger(v) => format!("{v}i"), UnsignedInteger(v) => { if use_v2 { - format!("{}u", v) + format!("{v}u") } else { - format!("{}i", v) + format!("{v}i") } } Text(v) => format!(r#""{}""#, Self::escape_any(v, "ES_SLASHES)), @@ -71,10 +71,10 @@ impl LineProtoTerm<'_> { "false" } } - .to_string(), - Float(v) => format!(r#"{}"#, v), - SignedInteger(v) => format!(r#"{}"#, v), - UnsignedInteger(v) => format!(r#"{}"#, v), + .into(), + Float(v) => v.to_string(), + SignedInteger(v) => v.to_string(), + UnsignedInteger(v) => v.to_string(), Text(v) => Self::escape_any(v, &SLASHES), } } diff --git a/influxdb/src/query/mod.rs b/influxdb/src/query/mod.rs index 02163c7..e83c224 100644 --- a/influxdb/src/query/mod.rs +++ b/influxdb/src/query/mod.rs @@ -52,7 +52,7 @@ impl fmt::Display for Timestamp { use Timestamp::*; match self { Nanoseconds(ts) | Microseconds(ts) | Milliseconds(ts) | Seconds(ts) | Minutes(ts) - | Hours(ts) => write!(f, "{}", ts), + | Hours(ts) => write!(f, "{ts}"), } } } diff --git a/influxdb/src/query/write_query.rs b/influxdb/src/query/write_query.rs index 75d8b02..5f9a5c2 100644 --- a/influxdb/src/query/write_query.rs +++ b/influxdb/src/query/write_query.rs @@ -122,11 +122,11 @@ impl Display for Type { use Type::*; match self { - Boolean(x) => write!(f, "{}", x), - Float(x) => write!(f, "{}", x), - SignedInteger(x) => write!(f, "{}", x), - UnsignedInteger(x) => write!(f, "{}", x), - Text(text) => write!(f, "{text}", text = text), + Boolean(x) => write!(f, "{x}"), + Float(x) => write!(f, "{x}"), + SignedInteger(x) => write!(f, "{x}"), + UnsignedInteger(x) => write!(f, "{x}"), + Text(text) => write!(f, "{text}"), } } } @@ -187,11 +187,7 @@ impl Query for WriteQuery { } else { LineProtoTerm::TagValue(value).escape() }; - format!( - "{tag}={value}", - tag = escaped_tag_key, - value = escaped_tag_value, - ) + format!("{escaped_tag_key}={escaped_tag_value}") }) .collect::>() .join(","); @@ -213,11 +209,7 @@ impl Query for WriteQuery { } else { LineProtoTerm::FieldValue(value).escape() }; - format!( - "{field}={value}", - field = escaped_field_key, - value = escaped_field_value, - ) + format!("{escaped_field_key}={escaped_field_value}") }) .collect::>() .join(","); diff --git a/influxdb/tests/derive_integration_tests.rs b/influxdb/tests/derive_integration_tests.rs index 1601ce7..6ecf612 100644 --- a/influxdb/tests/derive_integration_tests.rs +++ b/influxdb/tests/derive_integration_tests.rs @@ -104,7 +104,7 @@ async fn test_write_and_read_option() { let query = ReadQuery::new("SELECT time, pressure, wind_strength FROM weather_reading"); let result = client.json_query(query).await.and_then(|mut db_result| { - println!("{:?}", db_result); + println!("{db_result:?}"); db_result.deserialize_next::() }); assert_result_ok(&result); diff --git a/influxdb/tests/integration_tests.rs b/influxdb/tests/integration_tests.rs index 01b9fdf..289ac9c 100644 --- a/influxdb/tests/integration_tests.rs +++ b/influxdb/tests/integration_tests.rs @@ -25,7 +25,7 @@ async fn test_ping_influx_db_async_std() { assert!(!build.is_empty(), "Build should not be empty"); assert!(!version.is_empty(), "Build should not be empty"); - println!("build: {} version: {}", build, version); + println!("build: {build} version: {version}"); } /// INTEGRATION TEST @@ -42,7 +42,7 @@ async fn test_ping_influx_db_tokio() { assert!(!build.is_empty(), "Build should not be empty"); assert!(!version.is_empty(), "Build should not be empty"); - println!("build: {} version: {}", build, version); + println!("build: {build} version: {version}"); } /// INTEGRATION TEST @@ -78,7 +78,7 @@ async fn test_authed_write_and_read() { || async move { let client = Client::new("http://127.0.0.1:9086", TEST_NAME).with_auth("admin", "password"); - let query = format!("CREATE DATABASE {}", TEST_NAME); + let query = format!("CREATE DATABASE {TEST_NAME}"); client .query(ReadQuery::new(query)) .await @@ -103,7 +103,7 @@ async fn test_authed_write_and_read() { || async move { let client = Client::new("http://127.0.0.1:9086", TEST_NAME).with_auth("admin", "password"); - let query = format!("DROP DATABASE {}", TEST_NAME); + let query = format!("DROP DATABASE {TEST_NAME}"); client .query(ReadQuery::new(query)) @@ -128,7 +128,7 @@ async fn test_wrong_authed_write_and_read() { || async move { let client = Client::new("http://127.0.0.1:9086", TEST_NAME).with_auth("admin", "password"); - let query = format!("CREATE DATABASE {}", TEST_NAME); + let query = format!("CREATE DATABASE {TEST_NAME}"); client .query(ReadQuery::new(query)) .await @@ -176,7 +176,7 @@ async fn test_wrong_authed_write_and_read() { || async move { let client = Client::new("http://127.0.0.1:9086", TEST_NAME).with_auth("admin", "password"); - let query = format!("DROP DATABASE {}", TEST_NAME); + let query = format!("DROP DATABASE {TEST_NAME}"); client .query(ReadQuery::new(query)) .await @@ -200,7 +200,7 @@ async fn test_non_authed_write_and_read() { || async move { let client = Client::new("http://127.0.0.1:9086", TEST_NAME).with_auth("admin", "password"); - let query = format!("CREATE DATABASE {}", TEST_NAME); + let query = format!("CREATE DATABASE {TEST_NAME}"); client .query(ReadQuery::new(query)) .await @@ -234,7 +234,7 @@ async fn test_non_authed_write_and_read() { || async move { let client = Client::new("http://127.0.0.1:9086", TEST_NAME).with_auth("admin", "password"); - let query = format!("DROP DATABASE {}", TEST_NAME); + let query = format!("DROP DATABASE {TEST_NAME}"); client .query(ReadQuery::new(query)) .await @@ -292,7 +292,7 @@ async fn test_json_non_authed_read() { || async move { let client = Client::new("http://127.0.0.1:9086", TEST_NAME).with_auth("admin", "password"); - let query = format!("CREATE DATABASE {}", TEST_NAME); + let query = format!("CREATE DATABASE {TEST_NAME}"); client .query(ReadQuery::new(query)) .await @@ -313,7 +313,7 @@ async fn test_json_non_authed_read() { || async move { let client = Client::new("http://127.0.0.1:9086", TEST_NAME).with_auth("admin", "password"); - let query = format!("DROP DATABASE {}", TEST_NAME); + let query = format!("DROP DATABASE {TEST_NAME}"); client .query(ReadQuery::new(query)) @@ -337,7 +337,7 @@ async fn test_json_authed_read() { || async move { let client = Client::new("http://127.0.0.1:9086", TEST_NAME).with_auth("admin", "password"); - let query = format!("CREATE DATABASE {}", TEST_NAME); + let query = format!("CREATE DATABASE {TEST_NAME}"); client .query(ReadQuery::new(query)) .await @@ -350,7 +350,7 @@ async fn test_json_authed_read() { || async move { let client = Client::new("http://127.0.0.1:9086", TEST_NAME).with_auth("admin", "password"); - let query = format!("DROP DATABASE {}", TEST_NAME); + let query = format!("DROP DATABASE {TEST_NAME}"); client .query(ReadQuery::new(query)) diff --git a/influxdb/tests/integration_tests_v2.rs b/influxdb/tests/integration_tests_v2.rs index 8c47e2a..8eb77ad 100644 --- a/influxdb/tests/integration_tests_v2.rs +++ b/influxdb/tests/integration_tests_v2.rs @@ -9,7 +9,6 @@ use influxdb::{Client, Error, ReadQuery, Timestamp}; /// INTEGRATION TEST /// - /// This test case tests the Authentication #[async_std::test] #[cfg(not(tarpaulin))] diff --git a/influxdb/tests/utilities.rs b/influxdb/tests/utilities.rs index 8b3d5a7..dc3b17b 100644 --- a/influxdb/tests/utilities.rs +++ b/influxdb/tests/utilities.rs @@ -30,7 +30,7 @@ where T: Into, { let test_name = name.into(); - let query = format!("CREATE DATABASE {}", test_name); + let query = format!("CREATE DATABASE {test_name}"); create_client(test_name).query(ReadQuery::new(query)).await } @@ -41,7 +41,7 @@ where T: Into, { let test_name = name.into(); - let query = format!("DROP DATABASE {}", test_name); + let query = format!("DROP DATABASE {test_name}"); create_client(test_name).query(ReadQuery::new(query)).await } diff --git a/influxdb_derive/Cargo.toml b/influxdb_derive/Cargo.toml index 6e4b377..093ae63 100644 --- a/influxdb_derive/Cargo.toml +++ b/influxdb_derive/Cargo.toml @@ -3,15 +3,18 @@ [package] name = "influxdb_derive" version = "0.5.1" -authors = ["Gero Gerke <11deutron11@gmail.com>"] -edition = "2018" +authors.workspace = true +edition.workspace = true +rust-version.workspace = true description = "Private implementation detail of the influxdb crate" keywords = ["influxdb", "database", "influx", "derive"] -license = "MIT" +license.workspace = true readme = "README.md" include = ["src/**/*", "tests/**/*", "Cargo.toml", "LICENSE"] -repository = "https://github.com/influxdb-rs/influxdb-rust" -rust-version = "1.70" +repository.workspace = true + +[lints] +workspace = true [lib] proc-macro = true diff --git a/influxdb_derive/src/writeable.rs b/influxdb_derive/src/writeable.rs index 870f947..234e5fc 100644 --- a/influxdb_derive/src/writeable.rs +++ b/influxdb_derive/src/writeable.rs @@ -21,6 +21,7 @@ mod kw { custom_keyword!(ignore); } +#[allow(dead_code)] // TODO do we need to store the keywords? enum FieldAttr { Tag(kw::tag), Ignore(kw::ignore),