From b89cdc00320bb32995798860b8a023a6d01f96ca Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Tue, 30 Jun 2026 00:30:45 -0700 Subject: [PATCH 1/8] Centralize attribute printing --- src/analyzer.rs | 2 +- src/assignment.rs | 4 --- src/binding.rs | 2 ++ src/compiler.rs | 1 + src/evaluator.rs | 3 ++ src/function_definition.rs | 1 + src/item.rs | 63 +++++++++++++++++++++++++++++++------- src/node.rs | 2 +- src/parser.rs | 25 ++++++++++++--- src/recipe.rs | 13 -------- src/scope.rs | 1 + src/set.rs | 1 + tests/format.rs | 44 ++++++++++++++++++++++++-- 13 files changed, 125 insertions(+), 37 deletions(-) diff --git a/src/analyzer.rs b/src/analyzer.rs index a555d0e846..3d78da5656 100644 --- a/src/analyzer.rs +++ b/src/analyzer.rs @@ -116,7 +116,7 @@ impl<'run, 'src> Analyzer<'run, 'src> { self.analyze_set(set)?; self.sets.insert(set.clone()); } - Item::Unexport { name } => { + Item::Unexport { name, .. } => { if !self.unexports.insert(name.lexeme().to_string()) { return Err(name.error(DuplicateUnexport { variable: name.lexeme(), diff --git a/src/assignment.rs b/src/assignment.rs index c41ecbab0d..2629c53e16 100644 --- a/src/assignment.rs +++ b/src/assignment.rs @@ -5,10 +5,6 @@ pub(crate) type Assignment<'src> = Binding<'src, Expression<'src>>; impl Display for Assignment<'_> { fn fmt(&self, f: &mut Formatter) -> fmt::Result { - if self.private { - writeln!(f, "[private]")?; - } - if self.export { write!(f, "export ")?; } diff --git a/src/binding.rs b/src/binding.rs index 373c246b58..7d8e33ea9d 100644 --- a/src/binding.rs +++ b/src/binding.rs @@ -3,6 +3,8 @@ use super::*; /// A binding of `name` to `value` #[derive(Debug, Clone, PartialEq, Serialize)] pub(crate) struct Binding<'src, V = Value> { + #[serde(skip)] + pub(crate) attributes: AttributeSet<'src>, pub(crate) eager: bool, pub(crate) export: bool, #[serde(skip)] diff --git a/src/compiler.rs b/src/compiler.rs index 0467b96bcf..e52c0dc8a3 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -61,6 +61,7 @@ impl Compiler { relative, absolute, optional, + .. } => { let import = current .path diff --git a/src/evaluator.rs b/src/evaluator.rs index 6dec60f0ca..0d4956ae8b 100644 --- a/src/evaluator.rs +++ b/src/evaluator.rs @@ -240,6 +240,7 @@ impl<'src, 'run> Evaluator<'src, 'run> { }; self.scope.bind(Binding { + attributes: AttributeSet::default(), eager: assignment.eager, export: assignment.export || self @@ -286,6 +287,7 @@ impl<'src, 'run> Evaluator<'src, 'run> { for ((name, number), argument) in function.parameters.iter().copied().zip(arguments) { let value = self.evaluate_value(argument)?; scope.bind(Binding { + attributes: AttributeSet::default(), eager: false, export: false, file_depth: 0, @@ -809,6 +811,7 @@ impl<'src, 'run> Evaluator<'src, 'run> { }; evaluator.scope.bind(Binding { + attributes: AttributeSet::default(), eager: false, export: parameter.export, file_depth: 0, diff --git a/src/function_definition.rs b/src/function_definition.rs index 0fbb1b9ee8..fc4d41330a 100644 --- a/src/function_definition.rs +++ b/src/function_definition.rs @@ -2,6 +2,7 @@ use super::*; #[derive(Debug, Clone, PartialEq)] pub(crate) struct FunctionDefinition<'src> { + pub(crate) attributes: AttributeSet<'src>, pub(crate) body: Expression<'src>, pub(crate) name: Name<'src>, pub(crate) parameters: Vec<(Name<'src>, Number)>, diff --git a/src/item.rs b/src/item.rs index 1cca2466f7..2bf2a39d0d 100644 --- a/src/item.rs +++ b/src/item.rs @@ -9,11 +9,13 @@ pub(crate) enum Item<'src> { Function(FunctionDefinition<'src>), Import { absolute: Option, + attributes: AttributeSet<'src>, optional: bool, relative: StringLiteral<'src>, }, Module { absolute: Option, + attributes: AttributeSet<'src>, doc: Option, groups: Vec>, name: Name<'src>, @@ -25,12 +27,61 @@ pub(crate) enum Item<'src> { Recipe(UnresolvedRecipe<'src>), Set(Set<'src>), Unexport { + attributes: AttributeSet<'src>, name: Name<'src>, }, } +impl<'src> Item<'src> { + fn attributes(&self) -> Option<&AttributeSet<'src>> { + match self { + Self::Alias(alias) => Some(&alias.attributes), + Self::Assignment(assignment) => Some(&assignment.attributes), + Self::Comment(_) | Self::Newline => None, + Self::Function(function) => Some(&function.attributes), + Self::Import { attributes, .. } + | Self::Module { attributes, .. } + | Self::Unexport { attributes, .. } => Some(attributes), + Self::Recipe(recipe) => Some(&recipe.attributes), + Self::Set(set) => Some(&set.attributes), + } + } + + fn doc_comment(&self) -> Option<&str> { + match self { + Self::Module { + attributes, doc, .. + } => { + if attributes.contains(AttributeKind::Doc) { + None + } else { + doc.as_deref() + } + } + Self::Recipe(recipe) => { + if recipe.attributes.contains(AttributeKind::Doc) { + None + } else { + recipe.doc.as_deref() + } + } + _ => None, + } + } +} + impl ColorDisplay for Item<'_> { fn fmt(&self, f: &mut Formatter, color: Color) -> fmt::Result { + if let Some(doc) = self.doc_comment() { + writeln!(f, "# {doc}")?; + } + + if let Some(attributes) = self.attributes() { + for attribute in attributes { + writeln!(f, "[{attribute}]")?; + } + } + match self { Self::Alias(alias) => write!(f, "{alias}"), Self::Assignment(assignment) => write!(f, "{assignment}"), @@ -57,21 +108,11 @@ impl ColorDisplay for Item<'_> { write!(f, " {relative}") } Self::Module { - doc, - groups, name, optional, relative, .. } => { - if let Some(doc) = doc { - writeln!(f, "# {doc}")?; - } - - for group in groups { - writeln!(f, "[group: {group}]")?; - } - write!(f, "mod")?; if *optional { @@ -89,7 +130,7 @@ impl ColorDisplay for Item<'_> { Self::Newline => Ok(()), Self::Recipe(recipe) => write!(f, "{}", recipe.color_display(color)), Self::Set(set) => write!(f, "{set}"), - Self::Unexport { name } => write!(f, "unexport {name}"), + Self::Unexport { name, .. } => write!(f, "unexport {name}"), } } } diff --git a/src/node.rs b/src/node.rs index e5d0c49464..1d6746ddfa 100644 --- a/src/node.rs +++ b/src/node.rs @@ -70,7 +70,7 @@ impl<'src> Node<'src> for Item<'src> { } Self::Recipe(recipe) => recipe.tree(), Self::Set(set) => set.tree(), - Self::Unexport { name } => { + Self::Unexport { name, .. } => { let mut unexport = Tree::atom(Keyword::Unexport.lexeme()); unexport.push_mut(name.lexeme().replace('-', "_")); unexport diff --git a/src/parser.rs b/src/parser.rs index c8552ef169..854f66b80e 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -531,7 +531,10 @@ impl<'run, 'src> Parser<'run, 'src> { Some(Keyword::Unexport) if self.line_is(&[Identifier, Identifier]) => { self.presume_keyword(Keyword::Unexport)?; let name = self.parse_name()?; - Item::Unexport { name } + Item::Unexport { + attributes: AttributeSet::default(), + name, + } } Some(Keyword::Import) if self.next_are(&[Identifier, Identifier, StringToken]) @@ -543,6 +546,7 @@ impl<'run, 'src> Parser<'run, 'src> { let relative = self.parse_string_literal()?; Item::Import { absolute: None, + attributes: AttributeSet::default(), optional, relative, } @@ -582,14 +586,15 @@ impl<'run, 'src> Parser<'run, 'src> { let private = attributes.contains(AttributeKind::Private); let mut groups = Vec::new(); - for attribute in attributes { + for attribute in &attributes { if let Attribute::Group(group) = attribute { - groups.push(group); + groups.push(group.clone()); } } Item::Module { absolute: None, + attributes, doc, groups, name, @@ -663,6 +668,7 @@ impl<'run, 'src> Parser<'run, 'src> { let body = self.parse_expression()?; Ok(FunctionDefinition { + attributes: AttributeSet::default(), body, name, parameters, @@ -685,6 +691,7 @@ impl<'run, 'src> Parser<'run, 'src> { attributes.ensure_valid_attributes("assignment", *name, &[AttributeKind::Private])?; Ok(Assignment { + attributes, eager, export, file_depth: self.file_depth, @@ -1578,7 +1585,11 @@ impl<'run, 'src> Parser<'run, 'src> { }; if let Some(value) = set_bool { - return Ok(Set { name, value }); + return Ok(Set { + attributes: AttributeSet::default(), + name, + value, + }); } self.expect(ColonEquals)?; @@ -1627,7 +1638,11 @@ impl<'run, 'src> Parser<'run, 'src> { }; if let Some(value) = set_value { - return Ok(Set { name, value }); + return Ok(Set { + attributes: AttributeSet::default(), + name, + value, + }); } Err(name.error(CompileErrorKind::UnknownSetting { diff --git a/src/recipe.rs b/src/recipe.rs index 12cb43d400..908b810c73 100644 --- a/src/recipe.rs +++ b/src/recipe.rs @@ -755,19 +755,6 @@ impl<'src> Recipe<'src> { impl ColorDisplay for Recipe<'_, D> { fn fmt(&self, f: &mut Formatter, color: Color) -> fmt::Result { - if !self - .attributes - .iter() - .any(|attribute| matches!(attribute, Attribute::Doc(_))) - && let Some(doc) = &self.doc - { - writeln!(f, "# {doc}")?; - } - - for attribute in &self.attributes { - writeln!(f, "[{attribute}]")?; - } - if self.quiet { write!(f, "@{}", self.name)?; } else { diff --git a/src/scope.rs b/src/scope.rs index e78946d204..d1546f6a0a 100644 --- a/src/scope.rs +++ b/src/scope.rs @@ -22,6 +22,7 @@ impl<'src, 'run> Scope<'src, 'run> { for (i, (key, value)) in constants().iter().enumerate() { root.bind(Binding { + attributes: AttributeSet::default(), eager: false, export: false, file_depth: 0, diff --git a/src/set.rs b/src/set.rs index 26038c88a5..f0e12be036 100644 --- a/src/set.rs +++ b/src/set.rs @@ -2,6 +2,7 @@ use super::*; #[derive(Debug, Clone)] pub(crate) struct Set<'src> { + pub(crate) attributes: AttributeSet<'src>, pub(crate) name: Name<'src>, pub(crate) value: Setting<'src>, } diff --git a/tests/format.rs b/tests/format.rs index 877a24ea0f..bf6bff89e2 100644 --- a/tests/format.rs +++ b/tests/format.rs @@ -1225,6 +1225,26 @@ fn private_variable() { ); } +#[test] +fn private_alias() { + assert_dump( + " + [private] + alias f := foo + + foo: + echo foo + ", + " + [private] + alias f := foo + + foo: + echo foo + ", + ); +} + #[test] fn module_groups_are_preserved() { Test::new() @@ -1239,14 +1259,34 @@ fn module_groups_are_preserved() { .arg("--dump") .stdout( r#" - [group: 'bar'] - [group: "baz"] + [group('bar')] + [group("baz")] mod foo "#, ) .success(); } +#[test] +fn module_private_is_preserved() { + Test::new() + .justfile( + " + [private] + mod foo + ", + ) + .write("foo.just", "") + .arg("--dump") + .stdout( + " + [private] + mod foo + ", + ) + .success(); +} + #[test] fn module_docs_are_preserved() { Test::new() From d1ed725a7a88a89b98c1d89c6aaf96d106bcde0e Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Tue, 30 Jun 2026 00:46:20 -0700 Subject: [PATCH 2/8] Derive module private from attributes --- src/analyzer.rs | 4 ++-- src/item.rs | 1 - src/parser.rs | 3 --- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/analyzer.rs b/src/analyzer.rs index 3d78da5656..a9e6f9e378 100644 --- a/src/analyzer.rs +++ b/src/analyzer.rs @@ -84,7 +84,7 @@ impl<'run, 'src> Analyzer<'run, 'src> { groups, name, optional, - private, + attributes, .. } => { if let Some(absolute) = absolute { @@ -98,7 +98,7 @@ impl<'run, 'src> Analyzer<'run, 'src> { Some(*name), overrides, paths, - *private, + attributes.contains(AttributeKind::Private), absolute, )?); } else if *optional { diff --git a/src/item.rs b/src/item.rs index 2bf2a39d0d..4e82fd60aa 100644 --- a/src/item.rs +++ b/src/item.rs @@ -20,7 +20,6 @@ pub(crate) enum Item<'src> { groups: Vec>, name: Name<'src>, optional: bool, - private: bool, relative: Option>, }, Newline, diff --git a/src/parser.rs b/src/parser.rs index 854f66b80e..dd3fb1bfc4 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -583,8 +583,6 @@ impl<'run, 'src> Parser<'run, 'src> { let doc = self.take_doc_comment(&attributes); - let private = attributes.contains(AttributeKind::Private); - let mut groups = Vec::new(); for attribute in &attributes { if let Attribute::Group(group) = attribute { @@ -599,7 +597,6 @@ impl<'run, 'src> Parser<'run, 'src> { groups, name, optional, - private, relative, } } From 98f127debfe03aca81b9eefc086e4c1b32e99879 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Tue, 30 Jun 2026 01:05:44 -0700 Subject: [PATCH 3/8] Adjust --- src/analyzer.rs | 3 +-- src/attribute_set.rs | 14 ++++++++++++++ src/item.rs | 1 - src/parser.rs | 8 -------- src/recipe.rs | 11 +++-------- 5 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/analyzer.rs b/src/analyzer.rs index a9e6f9e378..8f56ed4e2a 100644 --- a/src/analyzer.rs +++ b/src/analyzer.rs @@ -81,7 +81,6 @@ impl<'run, 'src> Analyzer<'run, 'src> { Item::Module { absolute, doc, - groups, name, optional, attributes, @@ -93,7 +92,7 @@ impl<'run, 'src> Analyzer<'run, 'src> { asts, config, doc.clone(), - groups.as_slice(), + &attributes.groups(), loaded, Some(*name), overrides, diff --git a/src/attribute_set.rs b/src/attribute_set.rs index 33e03af1a6..90a273eb79 100644 --- a/src/attribute_set.rs +++ b/src/attribute_set.rs @@ -16,6 +16,20 @@ impl<'src> AttributeSet<'src> { self.0.keys().find(|attribute| attribute.kind() == kind) } + pub(crate) fn groups(&self) -> Vec> { + self + .0 + .keys() + .filter_map(|attribute| { + if let Attribute::Group(group) = attribute { + Some(group.clone()) + } else { + None + } + }) + .collect() + } + pub(crate) fn name(&self, attribute: &Attribute<'src>) -> Name<'src> { self.0[attribute] } diff --git a/src/item.rs b/src/item.rs index 4e82fd60aa..44e9ddecf6 100644 --- a/src/item.rs +++ b/src/item.rs @@ -17,7 +17,6 @@ pub(crate) enum Item<'src> { absolute: Option, attributes: AttributeSet<'src>, doc: Option, - groups: Vec>, name: Name<'src>, optional: bool, relative: Option>, diff --git a/src/parser.rs b/src/parser.rs index dd3fb1bfc4..2251fc8991 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -583,18 +583,10 @@ impl<'run, 'src> Parser<'run, 'src> { let doc = self.take_doc_comment(&attributes); - let mut groups = Vec::new(); - for attribute in &attributes { - if let Attribute::Group(group) = attribute { - groups.push(group.clone()); - } - } - Item::Module { absolute: None, attributes, doc, - groups, name, optional, relative, diff --git a/src/recipe.rs b/src/recipe.rs index 908b810c73..03595e2f44 100644 --- a/src/recipe.rs +++ b/src/recipe.rs @@ -723,14 +723,9 @@ impl<'src> Recipe<'src> { pub(crate) fn groups(&self) -> BTreeSet { self .attributes - .iter() - .filter_map(|attribute| { - if let Attribute::Group(group) = attribute { - Some(group.cooked.clone()) - } else { - None - } - }) + .groups() + .into_iter() + .map(|group| group.cooked) .collect() } From 73dee4ff7e3736617248c9d1b9591c8d1b32a2e1 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Tue, 30 Jun 2026 12:07:51 -0700 Subject: [PATCH 4/8] Modify --- src/recipe.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/recipe.rs b/src/recipe.rs index 03595e2f44..1ad3107ba7 100644 --- a/src/recipe.rs +++ b/src/recipe.rs @@ -730,12 +730,6 @@ impl<'src> Recipe<'src> { } pub(crate) fn doc(&self) -> Option<&str> { - for attribute in &self.attributes { - if let Attribute::Doc(doc) = attribute { - return doc.as_ref().map(|s| s.cooked.as_ref()); - } - } - self.doc.as_deref() } From f4b9e8f5a3d82490623dd6f9ca3f1a2a2c6ad87d Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Tue, 30 Jun 2026 12:08:23 -0700 Subject: [PATCH 5/8] Revise --- src/analyzer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/analyzer.rs b/src/analyzer.rs index 8f56ed4e2a..de7f607764 100644 --- a/src/analyzer.rs +++ b/src/analyzer.rs @@ -80,10 +80,10 @@ impl<'run, 'src> Analyzer<'run, 'src> { } Item::Module { absolute, + attributes, doc, name, optional, - attributes, .. } => { if let Some(absolute) = absolute { From e660e8f6bd5a0e10c0248f3474cea14acf61b2fb Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Tue, 30 Jun 2026 12:11:18 -0700 Subject: [PATCH 6/8] Adapt --- src/alias.rs | 2 +- src/analyzer.rs | 2 +- src/attribute_set.rs | 4 ++++ src/parser.rs | 6 +++--- src/recipe.rs | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/alias.rs b/src/alias.rs index 393d04b7e2..6cda385500 100644 --- a/src/alias.rs +++ b/src/alias.rs @@ -26,7 +26,7 @@ impl<'src> Alias<'src> { impl RecipeAlias<'_> { pub(crate) fn is_public(&self) -> bool { - !self.name.lexeme().starts_with('_') && !self.attributes.contains(AttributeKind::Private) + !self.name.lexeme().starts_with('_') && !self.attributes.private() } } diff --git a/src/analyzer.rs b/src/analyzer.rs index de7f607764..8e394b3acc 100644 --- a/src/analyzer.rs +++ b/src/analyzer.rs @@ -97,7 +97,7 @@ impl<'run, 'src> Analyzer<'run, 'src> { Some(*name), overrides, paths, - attributes.contains(AttributeKind::Private), + attributes.private(), absolute, )?); } else if *optional { diff --git a/src/attribute_set.rs b/src/attribute_set.rs index 90a273eb79..737a287dce 100644 --- a/src/attribute_set.rs +++ b/src/attribute_set.rs @@ -34,6 +34,10 @@ impl<'src> AttributeSet<'src> { self.0[attribute] } + pub(crate) fn private(&self) -> bool { + self.contains(AttributeKind::Private) + } + pub(crate) fn iter(&self) -> btree_map::Keys<'_, Attribute<'src>, Name<'src>> { self.0.keys() } diff --git a/src/parser.rs b/src/parser.rs index 2251fc8991..31bc674572 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -675,10 +675,10 @@ impl<'run, 'src> Parser<'run, 'src> { self.presume(ColonEquals)?; let value = self.parse_expression()?; - let private = attributes.contains(AttributeKind::Private); - attributes.ensure_valid_attributes("assignment", *name, &[AttributeKind::Private])?; + let private = attributes.private(); + Ok(Assignment { attributes, eager, @@ -1394,7 +1394,7 @@ impl<'run, 'src> Parser<'run, 'src> { })); } - let private = name.lexeme().starts_with('_') || attributes.contains(AttributeKind::Private); + let private = name.lexeme().starts_with('_') || attributes.private(). let doc = self.take_doc_comment(&attributes); diff --git a/src/recipe.rs b/src/recipe.rs index 1ad3107ba7..d0817ce000 100644 --- a/src/recipe.rs +++ b/src/recipe.rs @@ -175,7 +175,7 @@ impl<'src> Recipe<'src> { } pub(crate) fn is_public(&self) -> bool { - !self.private && !self.attributes.contains(AttributeKind::Private) + !self.private && !self.attributes.private() } pub(crate) fn takes_positional_arguments(&self, settings: &Settings) -> bool { From 1fe75dd383120f8dbfabca433a9b89d30fd7f0ce Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Tue, 30 Jun 2026 12:12:32 -0700 Subject: [PATCH 7/8] Adjust --- src/parser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parser.rs b/src/parser.rs index 31bc674572..ac5fdfef44 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -1394,7 +1394,7 @@ impl<'run, 'src> Parser<'run, 'src> { })); } - let private = name.lexeme().starts_with('_') || attributes.private(). + let private = name.lexeme().starts_with('_') || attributes.private(); let doc = self.take_doc_comment(&attributes); From 9513a5f632d326a381e200ed4878b99119d6a30f Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Tue, 30 Jun 2026 12:14:03 -0700 Subject: [PATCH 8/8] Modify --- src/attribute_set.rs | 4 ++++ src/evaluator.rs | 6 +++--- src/parser.rs | 10 +++++----- src/scope.rs | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/attribute_set.rs b/src/attribute_set.rs index 737a287dce..75b84d8c6b 100644 --- a/src/attribute_set.rs +++ b/src/attribute_set.rs @@ -34,6 +34,10 @@ impl<'src> AttributeSet<'src> { self.0[attribute] } + pub(crate) fn new() -> Self { + Self::default() + } + pub(crate) fn private(&self) -> bool { self.contains(AttributeKind::Private) } diff --git a/src/evaluator.rs b/src/evaluator.rs index 0d4956ae8b..e1ca05752e 100644 --- a/src/evaluator.rs +++ b/src/evaluator.rs @@ -240,7 +240,7 @@ impl<'src, 'run> Evaluator<'src, 'run> { }; self.scope.bind(Binding { - attributes: AttributeSet::default(), + attributes: AttributeSet::new(), eager: assignment.eager, export: assignment.export || self @@ -287,7 +287,7 @@ impl<'src, 'run> Evaluator<'src, 'run> { for ((name, number), argument) in function.parameters.iter().copied().zip(arguments) { let value = self.evaluate_value(argument)?; scope.bind(Binding { - attributes: AttributeSet::default(), + attributes: AttributeSet::new(), eager: false, export: false, file_depth: 0, @@ -811,7 +811,7 @@ impl<'src, 'run> Evaluator<'src, 'run> { }; evaluator.scope.bind(Binding { - attributes: AttributeSet::default(), + attributes: AttributeSet::new(), eager: false, export: parameter.export, file_depth: 0, diff --git a/src/parser.rs b/src/parser.rs index ac5fdfef44..c2f842d4c7 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -532,7 +532,7 @@ impl<'run, 'src> Parser<'run, 'src> { self.presume_keyword(Keyword::Unexport)?; let name = self.parse_name()?; Item::Unexport { - attributes: AttributeSet::default(), + attributes: AttributeSet::new(), name, } } @@ -546,7 +546,7 @@ impl<'run, 'src> Parser<'run, 'src> { let relative = self.parse_string_literal()?; Item::Import { absolute: None, - attributes: AttributeSet::default(), + attributes: AttributeSet::new(), optional, relative, } @@ -657,7 +657,7 @@ impl<'run, 'src> Parser<'run, 'src> { let body = self.parse_expression()?; Ok(FunctionDefinition { - attributes: AttributeSet::default(), + attributes: AttributeSet::new(), body, name, parameters, @@ -1575,7 +1575,7 @@ impl<'run, 'src> Parser<'run, 'src> { if let Some(value) = set_bool { return Ok(Set { - attributes: AttributeSet::default(), + attributes: AttributeSet::new(), name, value, }); @@ -1628,7 +1628,7 @@ impl<'run, 'src> Parser<'run, 'src> { if let Some(value) = set_value { return Ok(Set { - attributes: AttributeSet::default(), + attributes: AttributeSet::new(), name, value, }); diff --git a/src/scope.rs b/src/scope.rs index d1546f6a0a..3120e742ef 100644 --- a/src/scope.rs +++ b/src/scope.rs @@ -22,7 +22,7 @@ impl<'src, 'run> Scope<'src, 'run> { for (i, (key, value)) in constants().iter().enumerate() { root.bind(Binding { - attributes: AttributeSet::default(), + attributes: AttributeSet::new(), eager: false, export: false, file_depth: 0,