Re: [PATCH] scripts: rust-analyzer: Skip crate module directories

From: Miguel Ojeda
Date: Thu Apr 06 2023 - 18:33:43 EST


On Tue, Mar 7, 2023 at 6:14 PM Miguel Ojeda
<miguel.ojeda.sandonis@xxxxxxxxx> wrote:
>
> I don't have a strong opinion either way -- this was originally done
> to improve fuzzy searching, see commit 829c2df153d7 ("rust: move `net`
> and `sync` modules to uniquely-named files") upstream:
>
> This is so that each file in the module has a unique name instead of the
> generic `mod.rs` name. It makes it easier to open files when using fuzzy
> finders like `fzf` once names are unique.

Apparently the "encouraged" way is using `name.rs`:

https://doc.rust-lang.org/stable/reference/items/modules.html#module-source-filenames
https://doc.rust-lang.org/edition-guide/rust-2018/path-changes.html#no-more-modrs

Another argument I saw for `name.rs` is that one can easily the name
of the file in editor's tabs/titles, and some of the editors can add
part of the path to disambiguate, which may take more space in the UI.

Cheers,
Miguel