Made with KolourPaint and screenshots from Kate (with the GitHub theme).

  • nebeker
    link
    fedilink
    English
    arrow-up
    8
    ·
    8 months ago

    let a = String::from(“Hello, world!”).into()

    I’ll see myself out.

      • nebeker
        link
        fedilink
        English
        arrow-up
        3
        ·
        8 months ago

        And bow to the compiler’s whims? I think not!

        This shouldn’t compile, because .into needs the type from the left side and let needs the type from the right side.

        • Haradion@lemmy.ml
          link
          fedilink
          arrow-up
          3
          ·
          7 months ago

          If type constraints later in the function let the compiler infer the type, this syntax totally works.

          • nebeker
            link
            fedilink
            English
            arrow-up
            1
            ·
            7 months ago

            Like if the variable is then used in a function that only takes one type? Huh.