Skip to content

Commit f66200c

Browse files
committed
editoast: fix some typos
Signed-off-by: Leo Valais <leo.valais97@gmail.com>
1 parent 480ed39 commit f66200c

File tree

4 files changed

+13
-20
lines changed

4 files changed

+13
-20
lines changed

editoast/editoast_derive/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ pub fn search(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
114114
/// This derive provides the implementation the `SearchConfigStore` trait.
115115
/// Each struct that derives `Search` will be saved and the struct deriving
116116
/// `SearchConfigStore` will implement a `find(name: &str)` function that
117-
/// given a seach object name, returns the `SearchConfig` of the search object
117+
/// given a search object name, returns the `SearchConfig` of the search object
118118
/// matching.
119119
///
120120
/// ```ignore
@@ -188,10 +188,10 @@ pub fn search_config_store(input: proc_macro::TokenStream) -> proc_macro::TokenS
188188
///
189189
/// * `#[model(table = crate::table::osrd_yourtable")]` (**REQUIRED**): the path to the diesel table
190190
/// * `#[model(row(type_name = "YourRowType"))]`: the name of the row struct (defaults to `ModelRow`)
191-
/// * `#[model(row(derive(ADDITIONAL_DERIVES*,)))]`: additional derives for the row struct (always implicitely derives `Queryable` and `QueryableByName`)
191+
/// * `#[model(row(derive(ADDITIONAL_DERIVES*,)))]`: additional derives for the row struct (always implicitly derives `Queryable` and `QueryableByName`)
192192
/// * `#[model(row(public))]`: make the row struct fields `pub` (private by default)
193193
/// * `#[model(changeset(type_name = "YourChangesetType"))]`: the name of the changeset struct (defaults to `ModelChangeset`)
194-
/// * `#[model(changeset(derive(ADDITIONAL_DERIVES*,)))]`: additional derives for the changeset struct (always implicitely derives `Default, Queryable, QueryableByName, AsChangeset, Insertable`)
194+
/// * `#[model(changeset(derive(ADDITIONAL_DERIVES*,)))]`: additional derives for the changeset struct (always implicitly derives `Default, Queryable, QueryableByName, AsChangeset, Insertable`)
195195
/// * `#[model(changeset(public))]`: make the changeset struct fields `pub` (private by default)
196196
/// * `#[model(identifier = IDENTIFIER)]` (multiple): just like `#[model(identifier)]` for fields, but at the struct level.
197197
/// `IDENTIFIER` can be a compound identifier with the syntax `(field1, field2, ...)` (e.g.: `#[model(identifier = (infra_id, obj_id))]`).

editoast/editoast_derive/src/model/parsing.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl ModelConfig {
6464
.collect();
6565

6666
// collect identifiers from struct-level annotations...
67-
let mut raw_identfiers: HashSet<_> = options
67+
let mut raw_identifiers: HashSet<_> = options
6868
.identifiers
6969
.iter()
7070
.cloned()
@@ -116,10 +116,10 @@ impl ModelConfig {
116116
}
117117
};
118118

119-
raw_identfiers.insert(primary_field.clone());
120-
raw_identfiers.insert(preferred_identifier.clone());
119+
raw_identifiers.insert(primary_field.clone());
120+
raw_identifiers.insert(preferred_identifier.clone());
121121

122-
let typed_identifiers = raw_identfiers
122+
let typed_identifiers = raw_identifiers
123123
.iter()
124124
.cloned()
125125
.map(|id| Identifier::new(id, &fields))

editoast/src/models/prelude/list.rs

+5-12
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use super::Model;
1212

1313
/// A dynamic container for a filter setting in a [SelectionSettings] context
1414
///
15-
/// This struct is not meant to be initialized direclty but rather through the
15+
/// This struct is not meant to be initialized directly but rather through the
1616
/// [ModelField](super::ModelField) objects generated by the `Model` derive macro expansion.
1717
pub struct FilterSetting<M: Model>(pub(in crate::models) DieselFilter<M::Table>);
1818
type DieselFilter<Table> = Box<dyn diesel::BoxableExpression<Table, Pg, SqlType = Bool>>;
@@ -25,7 +25,6 @@ impl<M: Model> FilterSetting<M> {
2525
/// both from a `Bool` and `Nullable<Bool>` query by `COALESCE`ing the expression
2626
/// to `FALSE`. That way the `Model` derive macro doesn't have to infer the type
2727
/// of each field (as `column.eq(value)` is a `Nullable<Bool>` if `column` is a `Nullable<T>`).
28-
#[allow(unused)] // FIXME: rmove this attribute asap
2928
pub(in crate::models) fn new<T, Q>(filter: Q) -> Self
3029
where
3130
Q: AsExpression<T>,
@@ -39,7 +38,7 @@ impl<M: Model> FilterSetting<M> {
3938

4039
/// A dynamic container for a sorting setting in a [SelectionSettings] context
4140
///
42-
/// This struct is not meant to be initialized direclty but rather through the
41+
/// This struct is not meant to be initialized directly but rather through the
4342
/// [ModelField](super::ModelField) objects generated by the `Model` derive macro expansion.
4443
pub struct SortSetting<M: Model>(pub(in crate::models) DieselSort<M::Table>);
4544
type DieselSort<Table> = Box<dyn diesel::BoxableExpression<Table, Pg, SqlType = NotSelectable>>;
@@ -83,7 +82,6 @@ impl<M: Model> Clone for SelectionSettings<M> {
8382

8483
impl<M: Model + 'static> SelectionSettings<M> {
8584
/// Initializes a settings builder with no constraints
86-
#[allow(unused)] // FIXME: rmove this attribute asap
8785
pub fn new() -> Self {
8886
Self::default()
8987
}
@@ -94,7 +92,7 @@ impl<M: Model + 'static> SelectionSettings<M> {
9492
///
9593
/// This function will be called multiple times if the same settings object
9694
/// is used for multiple queries (e.g. with [Count::count] or [List::list]).
97-
/// It means that the funciton must be able to produce a valid filter multiple times,
95+
/// It means that the function must be able to produce a valid filter multiple times,
9896
/// so if `f` is a closure, its captured variables must be `Clone`d at each call.
9997
/// Keep in mind that the function may also be called concurrently if the settings
10098
/// object is shared between multiple concurrent tasks.
@@ -104,7 +102,6 @@ impl<M: Model + 'static> SelectionSettings<M> {
104102
/// wraps `diesel::BoxableExpression` which is not `Clone`. To work around this, we
105103
/// instead clone an `Arc` of functions that are able to produce a new filter every
106104
/// time we need it.
107-
#[allow(unused)] // FIXME: rmove this attribute asap
108105
pub fn filter<F: Fn() -> FilterSetting<M> + Send + Sync + 'static>(mut self, f: F) -> Self {
109106
self.filters.push(Arc::new(f));
110107
self
@@ -118,7 +115,7 @@ impl<M: Model + 'static> SelectionSettings<M> {
118115
///
119116
/// This function will be called multiple times if the same settings object
120117
/// is used for multiple queries (e.g. with [Count::count] or [List::list]).
121-
/// It means that the funciton must be able to produce a valid sort multiple times,
118+
/// It means that the function must be able to produce a valid sort multiple times,
122119
/// so if `f` is a closure, its captured variables must be `Clone`d at each call.
123120
/// Keep in mind that the function may also be called concurrently if the settings
124121
/// object is shared between multiple concurrent tasks.
@@ -128,21 +125,18 @@ impl<M: Model + 'static> SelectionSettings<M> {
128125
/// wraps `diesel::BoxableExpression` which is not `Clone`. To work around this, we
129126
/// instead clone an `Arc` of functions that are able to produce a new sort every
130127
/// time we need it.
131-
#[allow(unused)] // FIXME: rmove this attribute asap
132128
pub fn order_by<F: Fn() -> SortSetting<M> + Send + Sync + 'static>(mut self, f: F) -> Self {
133129
self.sorts.push(Arc::new(f));
134130
self
135131
}
136132

137133
/// Limit the number of results
138-
#[allow(unused)] // FIXME: rmove this attribute asap
139134
pub fn limit(mut self, limit: u64) -> Self {
140135
self.limit = Some(limit.try_into().expect("limit is too large"));
141136
self
142137
}
143138

144139
/// Offset the results by an amount
145-
#[allow(unused)] // FIXME: rmove this attribute asap
146140
pub fn offset(mut self, offset: u64) -> Self {
147141
self.offset = Some(offset.try_into().expect("offset is too large"));
148142
self
@@ -153,7 +147,6 @@ impl<M: Model + 'static> SelectionSettings<M> {
153147
/// query.
154148
///
155149
/// Only useful if you are working with [Count::count].
156-
#[allow(unused)] // FIXME: rmove this attribute asap
157150
pub fn pagination_on_count(mut self, paginate: bool) -> Self {
158151
self.paginate_counting = paginate;
159152
self
@@ -196,7 +189,7 @@ pub trait List: Model {
196189
) -> crate::error::Result<Vec<Self>>;
197190
}
198191

199-
/// Describe how we can count the number of occurences of the [Model](super::Model)
192+
/// Describe how we can count the number of occurrences of the [Model](super::Model)
200193
/// that match the provided settings and constraints
201194
///
202195
/// You can implement this type manually but it is recommended to use the `Model`

editoast/src/models/prelude/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub type Changeset<M> = <M as Model>::Changeset;
6868

6969
/// A struct persisting the column and type information of each model field
7070
///
71-
/// This struct is instanciated by the `Model` derive macro and shouldn't be
71+
/// This struct is instantiated by the `Model` derive macro and shouldn't be
7272
/// used manually. The macro expansion also provides a few methods such as
7373
/// `eq` or `asc` that can be used in conjunction with [SelectionSettings].
7474
pub struct ModelField<M, T, Column>(PhantomData<(M, T, Column)>);

0 commit comments

Comments
 (0)