Skip to content

Commit adf6717

Browse files
Update rust 1.8 version 2024 (#116)
* Updated cargo.toml * Regresed cargo.toml edition * Updated & tested cargo.toml edition * Fix rust-analyzer * Fix workflow * Trying to fix cargo fmt * Should fix clippy * Adding cargo fmt component * Fix clippy * Fixed clippy * Fix format * chore(cargo): update thiserror requirement from 1.0 to 2.0 (#126) Updates the requirements on [thiserror](https://github.com/dtolnay/thiserror) to permit the latest version. - [Release notes](https://github.com/dtolnay/thiserror/releases) - [Commits](dtolnay/thiserror@1.0.0...2.0.0) --- updated-dependencies: - dependency-name: thiserror dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(cargo): update bb8-postgres requirement from 0.8 to 0.9 (#130) Updates the requirements on [bb8-postgres](https://github.com/djc/bb8) to permit the latest version. - [Release notes](https://github.com/djc/bb8/releases) - [Commits](djc/bb8@v0.8.0...v0.9.0) --- updated-dependencies: - dependency-name: bb8-postgres dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(cargo): update rand requirement from 0.8 to 0.9 (#135) Updates the requirements on [rand](https://github.com/rust-random/rand) to permit the latest version. - [Release notes](https://github.com/rust-random/rand/releases) - [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md) - [Commits](rust-random/rand@0.8.0...0.9.0) --- updated-dependencies: - dependency-name: rand dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Álvaro Cabo <alvarocaboac2@gmail.com> * chore(cargo): update redis-macros requirement from 0.4.2 to 0.5.2 (#138) Updates the requirements on [redis-macros](https://github.com/daniel7grant/redis-macros) to permit the latest version. - [Release notes](https://github.com/daniel7grant/redis-macros/releases) - [Changelog](https://github.com/daniel7grant/redis-macros/blob/master/Changelog.md) - [Commits](daniel7grant/redis-macros@v0.4.2...v0.5.2) --- updated-dependencies: - dependency-name: redis-macros dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(cargo): update redis requirement from 0.27.5 to 0.29.1 (#139) Updates the requirements on [redis](https://github.com/redis-rs/redis-rs) to permit the latest version. - [Release notes](https://github.com/redis-rs/redis-rs/releases) - [Commits](redis-rs/redis-rs@redis-0.27.5...redis-0.29.1) --- updated-dependencies: - dependency-name: redis dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Álvaro Cabo <alvarocaboac2@gmail.com> * Fixed breaking changes from rand 0.9 * Updated typebuilder to v0.21.0 * Updated toolchain to stable --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent a9e1d16 commit adf6717

File tree

11 files changed

+35
-38
lines changed

11 files changed

+35
-38
lines changed

.github/workflows/style.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ jobs:
1212
- name: Checkout repository
1313
uses: actions/checkout@v4
1414

15+
- name: Setup Rust
16+
uses: actions-rs/toolchain@v1
17+
with:
18+
components: rustfmt
19+
override: true
20+
profile: minimal
21+
toolchain: stable
22+
1523
- name: Check code formatting
1624
run: cargo fmt -- --check --verbose
1725

Cargo.toml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ members = ["examples/filter_example", "."]
44
[package]
55
name = "vinted-rs"
66
version = "0.10.0"
7-
edition = "2021"
7+
edition = "2024"
88
repository = "https://github.com/TuTarea/vinted-rs"
99
authors = [
1010
"Pepe Márquez <pepe.marquezromero@gmail.com>",
@@ -13,7 +13,7 @@ authors = [
1313
description = "An async Vinted API wrapper"
1414
license = "MIT"
1515
readme = "README.md"
16-
rust-version = "1.70"
16+
rust-version = "1.85"
1717

1818
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1919

@@ -22,35 +22,37 @@ doctest = false
2222

2323
[features]
2424
default = ["advanced_filters", "redis"]
25-
advanced_filters = ["bb8-postgres", "postgres-types"]
25+
advanced_filters = ["dep:bb8-postgres", "dep:postgres-types"]
2626
redis = ["dep:redis", "dep:redis-macros"]
2727
minimal = []
2828

2929

3030
[dependencies]
31+
3132
reqwest = { version = "0.12", features = ["json", "cookies"] }
3233
tokio = { version = "1", features = ["full"] }
3334
serde = { version = "1.0", features = ["serde_derive"] }
34-
thiserror = "1.0"
35-
rand = "0.8"
35+
thiserror = "2.0"
36+
rand = "0.9"
3637
reqwest_cookie_store = "0.8"
37-
typed-builder = "0.20"
38+
typed-builder = "0.21"
3839
fang = { version = "0.10.3", features = ["asynk"], default-features = false }
39-
redis-macros = { version = "0.4.2", optional = true }
40-
redis = { version = "0.27.5", optional = true, features = [
40+
redis-macros = { version = "0.5.2", optional = true }
41+
redis = { version = "0.29.1", optional = true, features = [
4142
"tokio-comp",
4243
"aio",
4344
] }
4445
serde_json = { version = "1.0.91" }
4546
log = "0.4.20"
4647
lazy_static = "1.4.0"
47-
dotenvy = "0.15"
48+
49+
4850
[dev-dependencies]
4951
env_logger = "0.11.5"
50-
52+
dotenvy = "0.15"
5153

5254
[dependencies.bb8-postgres]
53-
version = "0.8"
55+
version = "0.9"
5456
features = ["with-serde_json-1", "with-uuid-1", "with-chrono-0_4"]
5557
optional = true
5658

examples/filter_example/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = "2021"
77

88
[dependencies]
99
vinted-rs = { path = "../../", features = ["advanced_filters"] }
10-
bb8-postgres = { version = "0.8", features = [
10+
bb8-postgres = { version = "0.9", features = [
1111
"with-serde_json-1",
1212
"with-uuid-1",
1313
"with-chrono-0_4",

src/db.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ The `db` module depends on the following external crates:
1212
use std::fmt::Display;
1313

1414
use bb8_postgres::{
15+
PostgresConnectionManager,
1516
bb8::{Pool, RunError},
1617
tokio_postgres::{
17-
tls::{MakeTlsConnect, TlsConnect},
1818
Row, Socket,
19+
tls::{MakeTlsConnect, TlsConnect},
1920
},
20-
PostgresConnectionManager,
2121
};
2222
use postgres_types::ToSql;
2323
use thiserror::Error;

src/model/filter.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ pub struct Filter {
5656
///let filter: Filter = Filter::builder().search_text(Some(String::from("shoes"))).build();
5757
///```
5858
///
59-
6059
#[builder(default)]
6160
pub search_text: Option<String>,
6261
///
@@ -81,7 +80,6 @@ pub struct Filter {
8180
/// // 4 is catalog_id for Women clothes
8281
/// // 16 is catalog_id for Women Shoes
8382
///```
84-
8583
#[builder(default)]
8684
pub catalog_ids: Option<String>,
8785
///The color IDs to filter items by. Must be formatted as `^[\d+,]*\d+$` regex.
@@ -103,7 +101,6 @@ pub struct Filter {
103101
/// // 1 is color_id for Black
104102
/// // 5 is color_id for Pink
105103
///```
106-
107104
#[builder(default)]
108105
pub color_ids: Option<String>,
109106
/// The brand IDs to filter items by. Must be formatted as `^[\d+,]*\d+$` regex.
@@ -123,7 +120,6 @@ pub struct Filter {
123120
/// // 14 is brand_id for Adidas
124121
/// // 53 is brand_id for Nike
125122
///```
126-
127123
#[builder(default)]
128124
pub brand_ids: Option<String>,
129125
/// The country IDs to filter items by. Must be formatted as `^[\d+,]*\d+$` regex.
@@ -143,7 +139,6 @@ pub struct Filter {
143139
/// // 7 is country_id for Spain
144140
/// // 16 is country_id for France
145141
///```
146-
147142
#[builder(default)]
148143
pub countries_ids: Option<String>,
149144
/// The size IDs to filter items by. Must be formatted as `^[\d+,]*\d+$` regex.
@@ -163,7 +158,6 @@ pub struct Filter {
163158
/// // 1226 is size_id for XXXS / 30 / 2
164159
/// // 102 is size_id for XXS / 32 / 4
165160
///```
166-
167161
#[builder(default)]
168162
pub material_ids: Option<String>,
169163
/// The material IDs to filter items by. Must be formatted as `^[\d+,]*\d+$` regex.
@@ -183,10 +177,8 @@ pub struct Filter {
183177
/// // 44 is material_id for coton
184178
/// // 49 is material_id for silk
185179
///```
186-
187180
#[builder(default)]
188181
pub size_ids: Option<String>,
189-
190182
/// The article statuses to filter items by.
191183
///
192184
///### Example
@@ -196,11 +188,9 @@ pub struct Filter {
196188
///
197189
/// let filter: Filter = Filter::builder().article_status(Some(vec![ArticleStatus::NewTags,ArticleStatus::NewNoTags])).build();
198190
///```
199-
200191
#[builder(default)]
201192
pub article_status: Option<Vec<ArticleStatus>>,
202193
/// The sort order for the retrieved items.
203-
204194
///### Example
205195
///```rust
206196
/// use vinted_rs::Filter;
@@ -209,7 +199,6 @@ pub struct Filter {
209199
///
210200
/// let filter: Filter = Filter::builder().sort_by(Some(SortBy::PriceAscendant)).build();
211201
///```
212-
213202
#[builder(default)]
214203
pub sort_by: Option<SortBy>,
215204
/// The minimum price of the article

src/model/filter/category_tree.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use typed_builder::TypedBuilder;
77
use redis_macros::{FromRedisValue, ToRedisArgs};
88
#[derive(Debug, Clone, TypedBuilder, PartialEq, Eq, Serialize, Deserialize)]
99
#[cfg_attr(feature = "redis", derive(FromRedisValue, ToRedisArgs,))]
10-
1110
pub struct CategoryTree {
1211
/// Vinted-rs autogenerated id
1312
pub id: i32,

src/model/filter/colors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use typed_builder::TypedBuilder;
55

66
#[cfg(feature = "redis")]
77
use redis_macros::{FromRedisValue, ToRedisArgs};
8+
89
#[derive(Debug, Clone, TypedBuilder, PartialEq, Eq, Serialize, Deserialize)]
910
#[cfg_attr(feature = "redis", derive(FromRedisValue, ToRedisArgs,))]
10-
1111
pub struct Color {
1212
/// Color id given by Vinted
1313
pub id: i32,

src/model/item.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use std::fmt;
88

99
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Hash, Eq)]
1010
#[cfg_attr(feature = "redis", derive(FromRedisValue, ToRedisArgs,))]
11-
1211
pub struct Item {
1312
pub id: i64,
1413
pub title: String,

src/model/items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ use crate::model::{Deserialize, Serialize};
77
use redis_macros::{FromRedisValue, ToRedisArgs};
88

99
use super::item::AdvancedItem;
10+
1011
#[derive(Debug, Serialize, Deserialize)]
1112
#[cfg_attr(feature = "redis", derive(FromRedisValue, ToRedisArgs,))]
12-
1313
pub struct Items {
1414
pub items: Vec<Item>,
1515
pub pagination: Pagination,

src/queries.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ use reqwest::StatusCode;
4141
use reqwest_cookie_store::CookieStore;
4242
use reqwest_cookie_store::CookieStoreMutex;
4343
use std::fmt;
44+
use std::sync::Arc;
4445
use std::sync::atomic::AtomicUsize;
4546
use std::sync::atomic::Ordering;
46-
use std::sync::Arc;
4747

4848
use thiserror::Error;
4949

@@ -155,7 +155,7 @@ impl Host {
155155
.filter(|domain: &Host| domain.is_euro_host())
156156
.collect();
157157

158-
let random_index = rand::thread_rng().gen_range(0..domains_euro.len());
158+
let random_index = rand::rng().random_range(0..domains_euro.len());
159159

160160
domains_euro[random_index].clone()
161161
}
@@ -228,7 +228,7 @@ impl From<Host> for &str {
228228
/// println!("Random host: {}", host);
229229
/// ```
230230
pub fn random_host<'a>() -> &'a str {
231-
let random_index = rand::thread_rng().gen_range(0..DOMAINS.len());
231+
let random_index = rand::rng().random_range(0..DOMAINS.len());
232232
DOMAINS[random_index]
233233
}
234234

@@ -271,7 +271,7 @@ pub struct VintedWrappers<'a> {
271271
pub len: usize,
272272
}
273273

274-
impl<'a> VintedWrappers<'a> {
274+
impl VintedWrappers<'_> {
275275
pub fn new_with_hosts(hosts: Vec<Host>) -> Self {
276276
let len = hosts.len();
277277

@@ -342,7 +342,7 @@ impl<'a> VintedWrappers<'a> {
342342
}
343343
}
344344

345-
impl<'a> Default for VintedWrappers<'a> {
345+
impl Default for VintedWrappers<'_> {
346346
fn default() -> Self {
347347
let hosts = vec![Host::Es, Host::Fr, Host::Lu, Host::Pt, Host::It, Host::Nl];
348348
VintedWrappers::new_with_hosts(hosts)
@@ -361,13 +361,13 @@ pub struct VintedWrapper<'a> {
361361

362362
static WRAPPER_ID: AtomicUsize = AtomicUsize::new(0);
363363

364-
impl<'a> Default for VintedWrapper<'a> {
364+
impl Default for VintedWrapper<'_> {
365365
fn default() -> Self {
366366
Self::new_with_host(Host::Es)
367367
}
368368
}
369369

370-
impl<'a> VintedWrapper<'a> {
370+
impl VintedWrapper<'_> {
371371
/// Creates a new `VintedWrapper` with a random host.
372372
///
373373
/// The `new` function creates a new `VintedWrapper` instance with a random host domain. It initializes the cookie store and client for making requests to the Vinted API.

src/tests/queries.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
use crate::VintedWrapper;
12
use crate::db::DbController;
23
use crate::model::filter::{Currency, Filter};
34
use crate::queries::VintedWrapperError;
45
use crate::tests::DB_URI;
5-
use crate::VintedWrapper;
66
use bb8_postgres::tokio_postgres::NoTls;
77
use env_logger;
88

@@ -289,7 +289,7 @@ async fn test_get_items_by_material() {
289289
async fn test_get_items_by_color() {
290290
let vinted = VintedWrapper::new();
291291
let id = 7; //Red
292-
//let hex = "#CC3300"; //Red
292+
//let hex = "#CC3300"; //Red
293293

294294
//let props = calculate_color_props(hex);
295295

0 commit comments

Comments
 (0)