Conversation
Without this fix, `xtr` would not find the nested `web` modules, mistakenly finding the top-level `web` instead. ```console $ find src -type f src/main.rs src/software.rs src/software/web.rs src/storage.rs src/storage/web.rs src/web.rs ```
Author
|
In https://github.com/mvidner/tr/tree/test-fixtures/xtr/src/fixtures I have a source (sub)tree that
|
In current.rs, "mod foo" can be found in: 1. ./current/foo.rs 2. ./current/foo/mod.rs but if current.rs is in fact lib.rs or main.rs, then in: 3. ./foo.rs 4. ./foo/mod.rs Therefore, let visit_item_mod try only half of the files, depending on whether the current file is the module root.
ogoffart
reviewed
Nov 10, 2025
Member
ogoffart
left a comment
There was a problem hiding this comment.
Thanks for the patch. That makes total sense.
Please just see my question inline.
(I wish there were tests for this code)
| if subdir.is_file() { | ||
| return self | ||
| .parse_mod(adjacent_mod) | ||
| .parse_mod(subdir, false) |
Member
There was a problem hiding this comment.
is the mod.rs not follow the same "root" rule as lib.rs or main.rs ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks for
tr! My team at work is considering to use it in https://github.com/agama-project/agama/ and I found thatxtrgets confused by a nontrivial module structure.Without this fix,
xtrwould not find the nestedwebmodules, mistakenly finding the top-levelwebinstead.