[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rust-mode 54a9c3d 380/486: Merge pull request #296 from de
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rust-mode 54a9c3d 380/486: Merge pull request #296 from dekellum/indent-return-type-defcustom |
Date: |
Sat, 7 Aug 2021 09:25:57 -0400 (EDT) |
branch: elpa/rust-mode
commit 54a9c3d3f501620cdf3f2d86f239571c1cc87fc6
Merge: d3a7025 5f37343
Author: Niko Matsakis <niko@alum.mit.edu>
Commit: GitHub <noreply@github.com>
Merge pull request #296 from dekellum/indent-return-type-defcustom
Add rust-indent-return-type-to-arguments defcustom variable
---
rust-mode-tests.el | 11 +++++++++++
rust-mode.el | 13 +++++++++++--
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/rust-mode-tests.el b/rust-mode-tests.el
index 9d87960..a5fea28 100644
--- a/rust-mode-tests.el
+++ b/rust-mode-tests.el
@@ -450,6 +450,17 @@ fn foo4(a:i32,
}
"))
+(ert-deftest indent-return-type-non-visual ()
+ (let ((rust-indent-return-type-to-arguments nil))
+(test-indent
+ "
+fn imagine_long_enough_to_wrap_at_arrow(a:i32, b:char)
+ -> i32
+{
+ let body;
+}
+")))
+
(ert-deftest indent-body-after-where ()
(let ((rust-indent-where-clause t))
(test-indent
diff --git a/rust-mode.el b/rust-mode.el
index a8af671..a433d8d 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -131,6 +131,13 @@ When nil, `where' will be aligned with `fn' or `trait'."
:group 'rust-mode
:safe #'booleanp)
+(defcustom rust-indent-return-type-to-arguments t
+ "Indent a line starting with the `->' (RArrow) following a function, aligning
+to the function arguments. When nil, `->' will be indented one level."
+ :type 'boolean
+ :group 'rust-mode
+ :safe #'booleanp)
+
(defcustom rust-playpen-url-format "https://play.rust-lang.org/?code=%s"
"Format string to use when submitting code to the playpen."
:type 'string
@@ -399,8 +406,10 @@ buffer."
(back-to-indentation)
(current-column))))))
- ;; A function return type is indented to the corresponding
function arguments
- ((looking-at "->")
+ ;; A function return type is indented to the corresponding
+ ;; function arguments, if -to-arguments is selected.
+ ((and rust-indent-return-type-to-arguments
+ (looking-at "->"))
(save-excursion
(backward-list)
(or (rust-align-to-expr-after-brace)
- [nongnu] elpa/rust-mode 6093d38 327/486: Add syntax coloring for type-inferred constants and variables, (continued)
- [nongnu] elpa/rust-mode 6093d38 327/486: Add syntax coloring for type-inferred constants and variables, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 38f7d89 330/486: Fix recognition of "<" as operator in some context, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 0ded5ea 332/486: Add support for u128 and i128 types, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode f57a8eb 333/486: Merge pull request #233 from shanavas786/add-128, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 6b71c0a 348/486: fix rust--format-call, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode a90730f 349/486: don't set-window-start for selected window, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 27911c8 351/486: Merge pull request #251 from brotzeit/rust-format-buffer, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 216faf2 353/486: Do not indent where clause by default (follow standard) #257, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode e201404 367/486: Fix font-locking of "let ref", ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 8d32dc6 370/486: Add keywords `async` and `try`, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 54a9c3d 380/486: Merge pull request #296 from dekellum/indent-return-type-defcustom,
ELPA Syncer <=
- [nongnu] elpa/rust-mode ce7a27f 381/486: Add compilation mode warning face, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode c1059d6 387/486: Added angle bracket tests, some of which fail without the fix, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 06f1c68 389/486: Merge pull request #300 from mmilenko/rust-looking-back-macro--backward-char--fix, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 48290d3 399/486: Merge pull request #318 from kraai/patch-1, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode f6ebcbd 400/486: Update travis scripts to use EVM, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 077cba7 402/486: Add local docker based tests runner, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 1d42d69 416/486: Speed up line indentation inside strings (#313), ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 4a7a860 480/486: Properly markup two additional section headings, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode a789a25 266/486: Fix #168: use while in rust-rewind-irrelevant, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 936a187 276/486: handle indirect buffers and multiple windows in rust-format-buffer, ELPA Syncer, 2021/08/07