Git Product home page Git Product logo

Comments (6)

MicahChalmer avatar MicahChalmer commented on August 21, 2024

I think the current indentation is correct. I wouldn't expect indentation to ever change the inside of a string literal. (None of the other programming modes that I tried out do it either.)

The Scan error: "Unbalanced parentheses" error message is still there, as mentioned in the comments of the old issue, is still there though, and shouldn't be. But the end result would be the same.

from rust-mode.

shepmaster avatar shepmaster commented on August 21, 2024

I agree that I'd be surprised if a string literal was indented on the second line. I can also confirm I see the Scan error: "Unbalanced parentheses" error.

from rust-mode.

nikomatsakis avatar nikomatsakis commented on August 21, 2024

I disagree. Most languages don't have backslashes at the end of line which skip all following whitespace. The express purpose of this syntax is to allow you to indent string constants nicely!

from rust-mode.

nikomatsakis avatar nikomatsakis commented on August 21, 2024

If you look through rustc you'll see where it's useful and also that indenting single-line strings that are spread across multiple lines so that they line up is what we typically do (although now that emacs doesn't handle it correctly, many of them have gotten messed up over time).

from rust-mode.

MicahChalmer avatar MicahChalmer commented on August 21, 2024

Well I'll be--I didn't know that. Sure enough, this:

fn main() {
    println!("foo\
              bar");
}

prints foobar. As I write this, I can find no reference to that anywhere in either the reference or the book, so I filed rust-lang/rust#22698.

But now I understand the original issue here.

from rust-mode.

shepmaster avatar shepmaster commented on August 21, 2024

Certainly not how I expected to learn about this feature, either!

from rust-mode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.