Skip to content

Ampersand insert on auto complete #13111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ktjd123 opened this issue Aug 25, 2022 · 8 comments
Closed

Ampersand insert on auto complete #13111

ktjd123 opened this issue Aug 25, 2022 · 8 comments

Comments

@ktjd123
Copy link

ktjd123 commented Aug 25, 2022

rust-analyzer version: rust-analyzer version: 0.3.1178-standalone (a670ff8 2022-08-21)

rustc version: rustc 1.63.0 (4b91a6ea7 2022-08-08)

  1. It added & on auto complete.

Code example

use std::error::Error;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let result = reqwest::get("https://www.google.com").await?.text().await?;

    println!("{:?}", result);

    Ok(())
}

If I try to auto complete the result on line 7 like below photo,

스크린샷 2022-08-25 18 38 37

It adds & to line 4 like below code

use std::error::Error;

#[tokio::main]
async fn main() -> Resul&t<(), Box<dyn Error>> {
    let result = reqwest::get("https://www.google.com").await?.text().await?;

    println!("{:?}", result);

    Ok(())
}

Thank you.

@Veykril
Copy link
Member

Veykril commented Aug 25, 2022

Fixed in #13092

@Veykril Veykril closed this as completed Aug 25, 2022
@flodiebold
Copy link
Member

Surprising that &result would be suggested at all though 🤔

@Veykril
Copy link
Member

Veykril commented Aug 25, 2022

{
    $crate::io::_print(std::fmt::Arguments::new_v1(
        &[],
        &[std::fmt::ArgumentV1::new(&(result), std::fmt::Display::fmt)],
    ));
}

I think the parentheses might be tripping the expected type up? No we seem to just show & completions even with leading & in general.

@Veykril Veykril reopened this Aug 25, 2022
@flodiebold
Copy link
Member

Can you actually reproduce it though? I don't get the &result completion, even with tokio::main 🤔

@Veykril
Copy link
Member

Veykril commented Aug 25, 2022

Not for the macro actually no, I get it for my assumption though
image

@ktjd123
Copy link
Author

ktjd123 commented Aug 25, 2022

It shows &result when I enter result to the end.

  1. When resul.

스크린샷 2022-08-26 02 43 01

  1. When result

스크린샷 2022-08-26 02 44 06

Might help 😀

@flodiebold
Copy link
Member

I tried that, but still didn't see &result 😕

@ktjd123
Copy link
Author

ktjd123 commented Aug 26, 2022

I checked out nightly version, It doesn't suggest me `&result. So maybe It could be closed I guess. 😀

@ktjd123 ktjd123 closed this as completed Aug 28, 2022
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

No branches or pull requests

3 participants