rust-lang / rust-mode

Emacs configuration for Rust
Apache License 2.0
1.1k stars 178 forks source link

Bitwise shift operator breaks indentation rules #398

Open ateraz13 opened 3 years ago

ateraz13 commented 3 years ago

When I let Emacs indent this code, it assumes the bitwise shift operator is an opening angle bracket.

let a = u32::MAX << 5;

The issue is caused by the column characters, I personally think rust-is-lt-char-operator doesn't handle this special case.

holzingk commented 3 years ago

Very annoying, indeed. It messes up the whole auto indent.

gnuvince commented 3 years ago

Any update on this?

brotzeit commented 3 years ago

Unfortunately, we lack active maintainers.

turboMaCk commented 2 years ago

this is extremely annoying issue.

brotzeit commented 2 years ago

Pull requests are very welcome.

turboMaCk commented 2 years ago

I might try to look into it but frankly my emacs-lisp fu is not that high.

In meantime the workaround is:

let u64_max = u64::MAX;
x = u64_max << 5;
brotzeit commented 2 years ago

It's probably more finding the correct regexes and existing functions that can be used than writing lots of elisp. I'm always very careful changing such functionality as it is likely to break something else. That's why adding tests for those things is always a good idea. And I have a better feeling when I press the merge button.