rust-lang / rust-lang/rust-analyzer

function import get replaced by a module import

Open
#18,347 2 comments 1 reaction 1 assignee View on GitHub

@rwakulszowa is already working on this.

Since Oct 28, 2024.

C-bug
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P)

0.3.2146-standalone

rustc version: (eg. output of rustc -V)

rustc 1.84.0-nightly (3ed6e3cc6 2024-10-17)

editor or extension: (eg. VSCode, Vim, Emacs, etc. For VSCode users, specify your extension version; for users of other editors, provide the distribution if applicable)

VSCode

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTC, RUSTUP_HOME or CARGO_HOME)

code snippet to reproduce:

#[doc(inline)]
pub use tooltip::{tooltip, Tooltip};
pub mod tooltip {
    use crate::Element;
    use std::borrow::Cow;

    pub use iced::widget::tooltip::Position;

    pub type Tooltip<'a, Message> =
        iced::widget::Tooltip<'a, Message, crate::Theme, crate::Renderer>;

    pub fn tooltip<'a, Message>(
        content: impl Into<Element<'a, Message>>,
        tooltip: impl Into<Element<'a, Message>>,
        position: Position,
    ) -> Tooltip<'a, Message> {
        let xxs = crate::theme::active().cosmic().space_xxs();

        Tooltip::new(content, tooltip, position)
            .class(crate::theme::Container::Tooltip)
            .padding(xxs)
            .gap(1)
    }
}

This code is from libcosmic.

My current import is:

use cosmic::{
    iced::{Color, Length},
    iced_widget::{pick_list, toggler},
    prelude::CollectionWidget,
    widget::{
        button, column, container, dropdown, horizontal_space, row,
        segmented_button::Entity, settings::section, text, text_input, tooltip, tooltip::Position,
        Row,
    },
    Element,
};

When I import stmg from libcosmic, let's say mouse_arena, this is what imported:

use cosmic::{
    iced::{Color, Length},
    iced_widget::{pick_list, toggler},
    prelude::CollectionWidget,
    widget::{
        button, column, container, dropdown, horizontal_space, mouse_area, row, segmented_button::Entity, settings::section, text, text_input, tooltip::{self, Position}, Row
    },
    Element,
};

Notice the tooltip::{self, Position}. This cause this error: error[E0423]: expected function, found module tooltip``

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.