summaryrefslogtreecommitdiff
path: root/rust-mode.el
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2019-01-25 16:35:31 -0500
committerGitHub <noreply@github.com>2019-01-25 16:35:31 -0500
commit54a9c3d3f501620cdf3f2d86f239571c1cc87fc6 (patch)
treee95157ba0efbd95a280ade45bc12ac4819aa0c8b /rust-mode.el
parentd3a70256fe560bcc463ed42e4259e9fce0fdfee3 (diff)
parent5f3734314de0e38f472740dfeeb0102ddc5d0b2c (diff)
downloadrust-mode-54a9c3d3f501620cdf3f2d86f239571c1cc87fc6.tar.gz
Merge pull request #296 from dekellum/indent-return-type-defcustom
Add rust-indent-return-type-to-arguments defcustom variable
Diffstat (limited to 'rust-mode.el')
-rw-r--r--rust-mode.el13
1 files changed, 11 insertions, 2 deletions
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)