Skip to content

Commit e891ae0

Browse files
committed
Remove must_use and -> Self
1 parent e27b837 commit e891ae0

File tree

7 files changed

+12
-45
lines changed

7 files changed

+12
-45
lines changed

src/client.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ impl Client {
121121
/// # movies.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
122122
/// # });
123123
/// ```
124-
#[must_use]
125124
pub fn multi_search(&self) -> MultiSearchQuery {
126125
MultiSearchQuery::new(self)
127126
}
@@ -137,7 +136,6 @@ impl Client {
137136
///
138137
/// assert_eq!(client.get_host(), "http://doggo.dog");
139138
/// ```
140-
#[must_use]
141139
pub fn get_host(&self) -> &str {
142140
&self.host
143141
}
@@ -153,7 +151,6 @@ impl Client {
153151
///
154152
/// assert_eq!(client.get_api_key(), Some("doggo"));
155153
/// ```
156-
#[must_use]
157154
pub fn get_api_key(&self) -> Option<&str> {
158155
self.api_key.as_deref()
159156
}

src/documents.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ use crate::{errors::Error, indexes::Index};
5656
pub trait IndexConfig {
5757
const INDEX_STR: &'static str;
5858

59-
#[must_use]
6059
fn index(client: &Client) -> Index {
6160
client.index(Self::INDEX_STR)
6261
}
@@ -83,7 +82,6 @@ pub struct DocumentQuery<'a> {
8382
}
8483

8584
impl<'a> DocumentQuery<'a> {
86-
#[must_use]
8785
pub fn new(index: &Index) -> DocumentQuery {
8886
DocumentQuery {
8987
index,
@@ -190,7 +188,6 @@ pub struct DocumentsQuery<'a> {
190188
}
191189

192190
impl<'a> DocumentsQuery<'a> {
193-
#[must_use]
194191
pub fn new(index: &Index) -> DocumentsQuery {
195192
DocumentsQuery {
196193
index,

src/indexes.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@ impl Index {
268268
/// # movies.delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
269269
/// # });
270270
/// ```
271-
#[must_use]
272271
pub fn search(&self) -> SearchQuery {
273272
SearchQuery::new(self)
274273
}
@@ -1575,7 +1574,6 @@ pub struct IndexesQuery<'a> {
15751574
}
15761575

15771576
impl<'a> IndexesQuery<'a> {
1578-
#[must_use]
15791577
pub fn new(client: &Client) -> IndexesQuery {
15801578
IndexesQuery {
15811579
client,

src/key.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,6 @@ impl KeysQuery {
318318
/// # use meilisearch_sdk::{key::KeysQuery};
319319
/// let builder = KeysQuery::new();
320320
/// ```
321-
#[must_use]
322321
pub fn new() -> KeysQuery {
323322
Self::default()
324323
}
@@ -442,7 +441,6 @@ impl KeyBuilder {
442441
/// # use meilisearch_sdk::{key::KeyBuilder};
443442
/// let builder = KeyBuilder::new();
444443
/// ```
445-
#[must_use]
446444
pub fn new() -> KeyBuilder {
447445
Self::default()
448446
}

src/search.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ pub struct Filter<'a> {
1818
}
1919

2020
impl<'a> Filter<'a> {
21-
#[must_use]
2221
pub fn new(inner: Either<&'a str, Vec<&'a str>>) -> Filter {
2322
Filter { inner }
2423
}
@@ -312,7 +311,6 @@ pub struct SearchQuery<'a> {
312311

313312
#[allow(missing_docs)]
314313
impl<'a> SearchQuery<'a> {
315-
#[must_use]
316314
pub fn new(index: &'a Index) -> SearchQuery<'a> {
317315
SearchQuery {
318316
index,
@@ -492,8 +490,7 @@ impl<'a> SearchQuery<'a> {
492490
self.index_uid = Some(&self.index.uid);
493491
self
494492
}
495-
#[must_use]
496-
pub fn build(&mut self) -> Self {
493+
pub fn build(&mut self) -> SearchQuery<'a> {
497494
self.clone()
498495
}
499496
/// Execute the query and fetch the results.
@@ -514,7 +511,6 @@ pub struct MultiSearchQuery<'a, 'b> {
514511

515512
#[allow(missing_docs)]
516513
impl<'a, 'b> MultiSearchQuery<'a, 'b> {
517-
#[must_use]
518514
pub fn new(client: &'a Client) -> MultiSearchQuery<'a, 'b> {
519515
MultiSearchQuery {
520516
client,

src/settings.rs

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ pub struct Settings {
8282
#[allow(missing_docs)]
8383
impl Settings {
8484
/// Create undefined settings.
85-
#[must_use]
86-
pub fn new() -> Self {
85+
pub fn new() -> Settings {
8786
Self {
8887
synonyms: None,
8988
stop_words: None,
@@ -98,8 +97,7 @@ impl Settings {
9897
}
9998
}
10099

101-
#[must_use]
102-
pub fn with_synonyms<S, U, V>(self, synonyms: HashMap<S, U>) -> Self
100+
pub fn with_synonyms<S, U, V>(self, synonyms: HashMap<S, U>) -> Settings
103101
where
104102
S: AsRef<str>,
105103
V: AsRef<str>,
@@ -121,8 +119,7 @@ impl Settings {
121119
}
122120
}
123121

124-
#[must_use]
125-
pub fn with_stop_words(self, stop_words: impl IntoIterator<Item = impl AsRef<str>>) -> Self {
122+
pub fn with_stop_words(self, stop_words: impl IntoIterator<Item = impl AsRef<str>>) -> Settings {
126123
Self {
127124
stop_words: Some(
128125
stop_words
@@ -134,19 +131,17 @@ impl Settings {
134131
}
135132
}
136133

137-
#[must_use]
138-
pub fn with_pagination(self, pagination_settings: PaginationSetting) -> Self {
134+
pub fn with_pagination(self, pagination_settings: PaginationSetting) -> Settings {
139135
Self {
140136
pagination: Some(pagination_settings),
141137
..self
142138
}
143139
}
144140

145-
#[must_use]
146141
pub fn with_ranking_rules(
147142
self,
148143
ranking_rules: impl IntoIterator<Item = impl AsRef<str>>,
149-
) -> Self {
144+
) -> Settings {
150145
Self {
151146
ranking_rules: Some(
152147
ranking_rules
@@ -158,11 +153,10 @@ impl Settings {
158153
}
159154
}
160155

161-
#[must_use]
162156
pub fn with_filterable_attributes(
163157
self,
164158
filterable_attributes: impl IntoIterator<Item = impl AsRef<str>>,
165-
) -> Self {
159+
) -> Settings {
166160
Self {
167161
filterable_attributes: Some(
168162
filterable_attributes
@@ -174,11 +168,10 @@ impl Settings {
174168
}
175169
}
176170

177-
#[must_use]
178171
pub fn with_sortable_attributes(
179172
self,
180173
sortable_attributes: impl IntoIterator<Item = impl AsRef<str>>,
181-
) -> Self {
174+
) -> Settings {
182175
Self {
183176
sortable_attributes: Some(
184177
sortable_attributes
@@ -190,19 +183,17 @@ impl Settings {
190183
}
191184
}
192185

193-
#[must_use]
194-
pub fn with_distinct_attribute(self, distinct_attribute: impl AsRef<str>) -> Self {
186+
pub fn with_distinct_attribute(self, distinct_attribute: impl AsRef<str>) -> Settings {
195187
Self {
196188
distinct_attribute: Some(distinct_attribute.as_ref().to_string()),
197189
..self
198190
}
199191
}
200192

201-
#[must_use]
202193
pub fn with_searchable_attributes(
203194
self,
204195
searchable_attributes: impl IntoIterator<Item = impl AsRef<str>>,
205-
) -> Self {
196+
) -> Settings {
206197
Self {
207198
searchable_attributes: Some(
208199
searchable_attributes
@@ -214,11 +205,10 @@ impl Settings {
214205
}
215206
}
216207

217-
#[must_use]
218208
pub fn with_displayed_attributes(
219209
self,
220210
displayed_attributes: impl IntoIterator<Item = impl AsRef<str>>,
221-
) -> Self {
211+
) -> Settings {
222212
Self {
223213
displayed_attributes: Some(
224214
displayed_attributes
@@ -230,8 +220,7 @@ impl Settings {
230220
}
231221
}
232222

233-
#[must_use]
234-
pub fn with_faceting(self, faceting: &FacetingSettings) -> Self {
223+
pub fn with_faceting(self, faceting: &FacetingSettings) -> Settings {
235224
Self {
236225
faceting: Some(*faceting),
237226
..self

src/tasks.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ pub enum Task {
205205
}
206206

207207
impl Task {
208-
#[must_use]
209208
pub fn get_uid(&self) -> u32 {
210209
match self {
211210
Self::Enqueued { content } | Self::Processing { content } => *content.as_ref(),
@@ -337,7 +336,6 @@ impl Task {
337336
/// # client.index("unwrap_failure").delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
338337
/// # });
339338
/// ```
340-
#[must_use]
341339
pub fn unwrap_failure(self) -> MeilisearchError {
342340
match self {
343341
Self::Failed {
@@ -373,7 +371,6 @@ impl Task {
373371
/// # client.index("is_failure").delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
374372
/// # });
375373
/// ```
376-
#[must_use]
377374
pub fn is_failure(&self) -> bool {
378375
matches!(self, Self::Failed { .. })
379376
}
@@ -402,7 +399,6 @@ impl Task {
402399
/// # task.try_make_index(&client).unwrap().delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
403400
/// # });
404401
/// ```
405-
#[must_use]
406402
pub fn is_success(&self) -> bool {
407403
matches!(self, Self::Succeeded { .. })
408404
}
@@ -430,7 +426,6 @@ impl Task {
430426
/// # task.wait_for_completion(&client, None, None).await.unwrap().try_make_index(&client).unwrap().delete().await.unwrap().wait_for_completion(&client, None, None).await.unwrap();
431427
/// # });
432428
/// ```
433-
#[must_use]
434429
pub fn is_pending(&self) -> bool {
435430
matches!(self, Self::Enqueued { .. } | Self::Processing { .. })
436431
}
@@ -609,7 +604,6 @@ impl<'a, T> TasksQuery<'a, T> {
609604
}
610605

611606
impl<'a> TasksQuery<'a, TasksCancelFilters> {
612-
#[must_use]
613607
pub fn new(client: &'a Client) -> TasksQuery<'a, TasksCancelFilters> {
614608
TasksQuery {
615609
client,
@@ -634,7 +628,6 @@ impl<'a> TasksQuery<'a, TasksCancelFilters> {
634628
}
635629

636630
impl<'a> TasksQuery<'a, TasksDeleteFilters> {
637-
#[must_use]
638631
pub fn new(client: &'a Client) -> TasksQuery<'a, TasksDeleteFilters> {
639632
TasksQuery {
640633
client,
@@ -659,7 +652,6 @@ impl<'a> TasksQuery<'a, TasksDeleteFilters> {
659652
}
660653

661654
impl<'a> TasksQuery<'a, TasksPaginationFilters> {
662-
#[must_use]
663655
pub fn new(client: &'a Client) -> TasksQuery<'a, TasksPaginationFilters> {
664656
TasksQuery {
665657
client,

0 commit comments

Comments
 (0)