Skip to content

Commit 005a59b

Browse files
chore: Apply suggestions
Co-authored-by: Nick <[email protected]>
1 parent 77de8c4 commit 005a59b

File tree

5 files changed

+18
-15
lines changed

5 files changed

+18
-15
lines changed

Diff for: crates/stackable-versioned-macros/src/attrs/common/item.rs

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ where
3939
item: &I,
4040
) -> Result<(), darling::Error> {
4141
// NOTE (@Techassi): Can we maybe optimize this a little?
42+
4243
let mut errors = Error::accumulator();
4344

4445
if let Some(added) = &self.common_attrs().added {

Diff for: crates/stackable-versioned-macros/src/attrs/variant.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::attrs::common::{ItemAttributes, ItemType};
1010
/// Data stored in this struct is validated using darling's `and_then` attribute.
1111
/// During darlings validation, it is not possible to validate that action
1212
/// versions match up with declared versions on the container. This validation
13-
/// can be done using the associated [`FieldAttributes::validate_versions`][1]
13+
/// can be done using the associated [`ValidateVersions::validate_versions`][1]
1414
/// function.
1515
///
1616
/// Rules shared across fields and variants can be found [here][2].

Diff for: crates/stackable-versioned-macros/src/codegen/chain.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ where
1616
{
1717
/// Returns the values of keys which are neighbors of `key`.
1818
///
19-
/// Imagine a map which contains the following keys: 1, 3, 5. Calling this
19+
/// Given a map which contains the following keys: 1, 3, 5. Calling this
2020
/// function with these keys, results in the following return values:
2121
///
2222
/// - Key **0**: `(None, Some(1))`

Diff for: crates/stackable-versioned-macros/src/codegen/common/item.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::{
1111
},
1212
};
1313

14-
/// This trait describes versioned container items, fields ans variants in a
14+
/// This trait describes versioned container items, fields and variants in a
1515
/// common way.
1616
///
1717
/// Shared functionality is implemented in a single place. Code which cannot be
@@ -60,7 +60,7 @@ pub(crate) trait Attributes {
6060
fn common_attrs(&self) -> &ItemAttributes;
6161
}
6262

63-
/// This struct combines common common code for versioned fields and variants.
63+
/// This struct combines common code for versioned fields and variants.
6464
///
6565
/// Most of the initial creation of a versioned field and variant are identical.
6666
/// Currently, the following steps are unified:
@@ -106,10 +106,11 @@ where
106106
let item_attrs = attrs.common_attrs_owned();
107107

108108
// Constructing the action chain requires going through the actions
109-
// starting at the end, because the base container always represents the
110-
// latest (most up-to-date) version of that struct. That's why the
111-
// following code needs to go through the actions in reverse order, as
112-
// otherwise it is impossible to extract the item ident for each version.
109+
// starting at the end, because the container definition always
110+
// represents the latest (most up-to-date) version of that struct.
111+
// That's why the following code needs to go through the actions in
112+
// reverse order, as otherwise it is impossible to extract the item
113+
// ident for each version.
113114

114115
// Deprecating an item is always the last state an item can end up in.
115116
// For items which are not deprecated, the last change is either the

Diff for: crates/stackable-versioned-macros/src/codegen/vstruct/field.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ use crate::{
1616
},
1717
};
1818

19-
/// A versioned field, which contains contains common [`Field`] data and a chain
20-
/// of actions.
19+
/// A versioned field, which contains common [`Field`] data and a chain of
20+
/// actions.
2121
///
22-
/// The chain of action maps versions to an action and the appropriate field
23-
/// name. Additionally, the [`Field`] data can be used to forward attributes,
24-
/// generate documentation, etc.
22+
/// The chain of actions maps versions to an action and the appropriate field
23+
/// name.
24+
///
25+
/// Additionally, the [`Field`] data can be used to forward attributes, generate
26+
/// documentation, etc.
2527
#[derive(Debug)]
2628
pub(crate) struct VersionedField(VersionedItem<Field, FieldAttributes>);
2729

@@ -129,8 +131,7 @@ impl VersionedField {
129131
}
130132
None => {
131133
// If there is no chain of field actions, the field is not
132-
// versioned and code generation is straight forward.
133-
// Unversioned fields are always included in versioned structs.
134+
// versioned and therefore included in all versions.
134135
let field_ident = &self.inner.ident;
135136
let field_type = &self.inner.ty;
136137

0 commit comments

Comments
 (0)