Skip to content

Prefer importing items from the crate they are defined in, rather than a re-export. #11698

Closed
@JMS55

Description

@JMS55

libadwaita-rs depends on gtk-rs, which depends on glib-rs/gio-rs. The crates often re-export items from their dependencies, especially because of macros needing to use them. Yet, as a user, you will most likely be using items from all 4.

This leads to awkward issues where RA suggests importing "gio::prelude::item" instead of "glib::prelude::item" for an item originally defined in glib, and you end up with a really confusing mess of imports unless you figure out their paths manually.

I think that gtk-rs can improve their module organization to limit this to some degree, but it would maybe help to have RA prioritize importing items from the crate they were originally defined in.

As a related issue, often "item" will only have the import suggestion "gio::prelude::item", despite being also being available in "glib::submodule::item" or something similar. Not sure why that is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions