Skip to content

Commit 8f0a009

Browse files
Apply suggestions from code review
Co-authored-by: Techassi <[email protected]>
1 parent 2cca97e commit 8f0a009

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ impl ItemAttributes {
202202
if renamed.iter().any(|r| *r.since == *deprecated.since) =>
203203
{
204204
Err(Error::custom(
205-
"cannot be marked as `deprecated` and `renamed` in the same version",
205+
format!("{item_type} cannot be marked as `deprecated` and `renamed` in the same version"),
206206
)
207207
.with_span(item_ident))
208208
}
@@ -260,8 +260,8 @@ impl ItemAttributes {
260260
/// The following naming rules apply:
261261
///
262262
/// - Fields or variants marked as deprecated need to include the
263-
/// 'deprecated_' prefix in their name. The prefix must not be included
264-
/// for fields or variants which are not deprecated.
263+
/// deprecation prefix in their name. The prefix must not be included for
264+
/// fields or variants which are not deprecated.
265265
fn validate_item_name(&self, item_ident: &Ident, item_type: &ItemType) -> Result<(), Error> {
266266
let prefix = match item_type {
267267
ItemType::Field => DEPRECATED_FIELD_PREFIX,
@@ -290,14 +290,14 @@ impl ItemAttributes {
290290
///
291291
/// The following naming rules apply:
292292
///
293-
/// - `deprecated` must not be set on items. Instead, the
294-
/// stackable-versioned method of deprecating items should be used.
293+
/// - `deprecated` must not be set on items. Instead, use the `deprecated()`
294+
/// action of the `#[versioned()]` macro.
295295
fn validate_item_attributes(&self, item_attrs: &Vec<Attribute>) -> Result<(), Error> {
296296
for attr in item_attrs {
297297
for segment in &attr.path().segments {
298298
if segment.ident == "deprecated" {
299299
return Err(Error::custom("deprecation must be done using #[versioned(deprecated(since = \"VERSION\"))]")
300-
.with_span(&segment.ident.span()));
300+
.with_span(&attr.span()));
301301
}
302302
}
303303
}

crates/stackable-versioned-macros/src/attrs/field.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ pub(crate) struct FieldAttributes {
3131
// `Option<Ident>`, while for enum variants, the type is `Ident`.
3232
pub(crate) ident: Option<Ident>,
3333

34-
/// The original attributes for the field.
3534
// This must be named `attrs` for darling to populate it accordingly, and
3635
// cannot live in common because Vec<Attribute> is not implemented for
3736
// FromMeta.
37+
/// The original attributes for the field.
3838
pub(crate) attrs: Vec<Attribute>,
3939
}
4040

crates/stackable-versioned-macros/src/attrs/variant.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ pub(crate) struct VariantAttributes {
3232
// `Option<Ident>`, while for enum variants, the type is `Ident`.
3333
pub(crate) ident: Ident,
3434

35-
/// The original attributes for the field.
3635
// This must be named `attrs` for darling to populate it accordingly, and
3736
// cannot live in common because Vec<Attribute> is not implemented for
3837
// FromMeta.
38+
/// The original attributes for the field.
3939
pub(crate) attrs: Vec<Attribute>,
4040
}
4141

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ where
110110
let attrs = A::try_from(&item)?;
111111
attrs.validate_versions(container_attrs, &item)?;
112112

113-
// These are the attributes addde to the item outside of the macro.
113+
// These are the attributes added to the item outside of the macro.
114114
let original_attributes = attrs.original_attributes().clone();
115115

116116
// These are the versioned macro attrs that are common to all items.

crates/stackable-versioned-macros/src/codegen/common/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub(crate) struct ContainerVersion {
3333
/// The ident of the container.
3434
pub(crate) ident: Ident,
3535

36-
/// Store an additional doc-comment lines for this version.
36+
/// Store additional doc-comment lines for this version.
3737
pub(crate) version_specific_docs: Vec<String>,
3838
}
3939

0 commit comments

Comments
 (0)