Skip to content

Allow crate/super/self in use paths - #40

Merged
aacebo merged 3 commits into
aacebo:masterfrom
antonWetzel:crate/super/self-in-use-paths
Nov 21, 2026
Merged

aacebo merged 3 commits into
aacebo:masterfrom
antonWetzel:crate/super/self-in-use-paths

Conversation

@antonWetzel

@antonWetzel antonWetzel commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Instead of using Ident in paths, use new UseSegment, which also allows super, self and crate.

Reference:

Notes:

  • this does not change the other places were simple paths are used
    • visiblity/macros/attributes
  • $crate segment is not included

Motivation

Generated code with use super::* lost it during parse as File and format round trip.

Validation

  • Add test
  • Run existing tests, clippy and doctests

Compatibility

  • This pull request includes a breaking change.
    • Rename from ident to segment
    • Change type from Ident to UseSegment

Checklist

  • This pull request is focused and does not include unrelated changes.
  • I have added or updated tests where behavior changes.
  • I have run the relevant validation checks.
  • I have read and followed the AI-assisted contribution policy.

@codecov

codecov Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 41.97531% with 47 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.21%. Comparing base (775aff3) to head (65eefa9).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
crates/moxy-ast/src/use_tree/use_segment.rs 29.31% 41 Missing ⚠️
crates/moxy-ast/src/use_tree/use_rename.rs 40.00% 3 Missing ⚠️
crates/moxy-ast/src/use_tree/use_path.rs 60.00% 2 Missing ⚠️
crates/moxy-ast/src/use_tree/use_name.rs 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #40      +/-   ##
==========================================
- Coverage   62.30%   62.21%   -0.10%     
==========================================
  Files         272      273       +1     
  Lines       18161    18226      +65     
==========================================
+ Hits        11315    11339      +24     
- Misses       6846     6887      +41     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aacebo

aacebo commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

thanks for the contribution @antonWetzel, please add fixture coverage to the grammar matrix https://github.com/aacebo/moxy/tree/master/fixtures/grammar/paths which should increase test coverage to the acceptable amount.

@antonWetzel

antonWetzel commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor Author

I added a test to the fixtures. I updated the test matrix json by hand, no clue if this is correct.

The span(), is_<...>() and as_<...>() methods continue to be not tested.

@aacebo
aacebo merged commit f7cd3e7 into aacebo:master Nov 21, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants