Skip to content

Commit 007cbac

Browse files
committed
Merge tag 'v9.1.1881'
Don't merge vim/master as the latest commit (v9.1.1882) could lead to a crash if used incorrectly.
2 parents c70bf99 + 50ede52 commit 007cbac

File tree

7 files changed

+15
-35
lines changed

7 files changed

+15
-35
lines changed

runtime/autoload/rustfmt.vim

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
" Author: Stephen Sugden <stephen@stephensugden.com>
22
" Last Modified: 2023-09-11
33
" Last Change:
4-
" 2025 Mar 31 by Vim project (rename s:RustfmtConfigOptions())
5-
" 2025 Jul 14 by Vim project (don't parse rustfmt version automatically #17745)
4+
" 2025 Oct 27 by Vim project don't use rustfmt as 'formatprg' by default
5+
"
66
"
77
" Adapted from https://github.com/fatih/vim-go
88
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
@@ -68,13 +68,7 @@ function! s:RustfmtWriteMode()
6868
endif
6969
endfunction
7070

71-
function! rustfmt#RustfmtConfigOptions()
72-
let default = '--edition 2018'
73-
74-
if !get(g:, 'rustfmt_find_toml', 0)
75-
return default
76-
endif
77-
71+
function! s:RustfmtConfigOptions()
7872
let l:rustfmt_toml = findfile('rustfmt.toml', expand('%:p:h') . ';')
7973
if l:rustfmt_toml !=# ''
8074
return '--config-path '.shellescape(fnamemodify(l:rustfmt_toml, ":p"))
@@ -97,7 +91,7 @@ function! s:RustfmtCommandRange(filename, line1, line2)
9791

9892
let l:arg = {"file": shellescape(a:filename), "range": [a:line1, a:line2]}
9993
let l:write_mode = s:RustfmtWriteMode()
100-
let l:rustfmt_config = rustfmt#RustfmtConfigOptions()
94+
let l:rustfmt_config = s:RustfmtConfigOptions()
10195

10296
" FIXME: When --file-lines gets to be stable, add version range checking
10397
" accordingly.
@@ -112,7 +106,7 @@ endfunction
112106

113107
function! s:RustfmtCommand()
114108
let write_mode = g:rustfmt_emit_files ? '--emit=stdout' : '--write-mode=display'
115-
let config = rustfmt#RustfmtConfigOptions()
109+
let config = s:RustfmtConfigOptions()
116110
return join([g:rustfmt_command, write_mode, config, g:rustfmt_options])
117111
endfunction
118112

runtime/doc/ft_rust.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,6 @@ g:rustfmt_detect_version~
166166
Disabled by default for performance reasons
167167
>
168168
let g:rustfmt_detect_version = 1
169-
<
170-
*g:rustfmt_find_toml*
171-
g:rustfmt_emit_files~
172-
When set to 1, will try to find "rustfmt.toml" file by searching from
173-
current path upwards. Disabled by default for performance reasons
174-
>
175-
let g:rustfmt_find_toml = 1
176169
<
177170
*g:rust_playpen_url*
178171
g:rust_playpen_url~

runtime/doc/tags

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8062,7 +8062,6 @@ g:rustfmt_command ft_rust.txt /*g:rustfmt_command*
80628062
g:rustfmt_detect_version ft_rust.txt /*g:rustfmt_detect_version*
80638063
g:rustfmt_emit_files ft_rust.txt /*g:rustfmt_emit_files*
80648064
g:rustfmt_fail_silently ft_rust.txt /*g:rustfmt_fail_silently*
8065-
g:rustfmt_find_toml ft_rust.txt /*g:rustfmt_find_toml*
80668065
g:rustfmt_options ft_rust.txt /*g:rustfmt_options*
80678066
g:statusline_winid options.txt /*g:statusline_winid*
80688067
g:syntax_on syntax.txt /*g:syntax_on*

runtime/ftplugin/rust.vim

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
" Maintainer: Chris Morgan <me@chrismorgan.info>
44
" Last Change: 2024 Mar 17
55
" 2024 May 23 by Riley Bruins <ribru17@gmail.com ('commentstring')
6-
" 2025 Mar 31 by Vim project (set 'formatprg' option)
76
" For bugs, patches and license go to https://github.com/rust-lang/rust.vim
87

98
if exists("b:did_ftplugin")
@@ -58,19 +57,6 @@ setlocal includeexpr=rust#IncludeExpr(v:fname)
5857

5958
setlocal suffixesadd=.rs
6059

61-
if executable(get(g:, 'rustfmt_command', 'rustfmt'))
62-
if get(g:, "rustfmt_fail_silently", 0)
63-
augroup rust.vim.FailSilently
64-
autocmd! * <buffer>
65-
autocmd ShellFilterPost <buffer> if v:shell_error | execute 'echom "shell filter returned error " . v:shell_error . ", undoing changes"' | undo | endif
66-
augroup END
67-
endif
68-
69-
let &l:formatprg = get(g:, 'rustfmt_command', 'rustfmt') . ' ' .
70-
\ get(g:, 'rustfmt_options', '') . ' ' .
71-
\ rustfmt#RustfmtConfigOptions()
72-
endif
73-
7460
if exists("g:ftplugin_rust_source_path")
7561
let &l:path=g:ftplugin_rust_source_path . ',' . &l:path
7662
endif
@@ -163,7 +149,7 @@ endif
163149

164150
let b:undo_ftplugin = "
165151
\ compiler make |
166-
\ setlocal formatoptions< comments< commentstring< include< includeexpr< suffixesadd< formatprg<
152+
\ setlocal formatoptions< comments< commentstring< include< includeexpr< suffixesadd<
167153
\|if exists('b:rust_set_style')
168154
\|setlocal tabstop< shiftwidth< softtabstop< expandtab< textwidth<
169155
\|endif

src/insexpand.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4239,7 +4239,7 @@ get_complete_info(list_T *what_list, dict_T *retdict)
42394239
int len = compl_ins_end_col - curwin->w_cursor.col;
42404240

42414241
ret = dict_add_string_len(retdict, "preinserted_text",
4242-
(len > 0) ? line + curwin->w_cursor.col : (char_u *)"", len);
4242+
(len > 0) ? line + curwin->w_cursor.col : (char_u *)"", (len > 0) ? len : 0);
42434243
}
42444244

42454245
if (ret == OK && (what_flag & (CI_WHAT_ITEMS | CI_WHAT_SELECTED

src/testdir/test_ins_complete.vim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,10 @@ func Test_completefunc_info()
571571
new
572572
set completeopt=menuone
573573
set completefunc=CompleteTest
574+
" Can be called outside of ins-completion
575+
call feedkeys("i\<C-X>\<C-U>\<C-Y>\<C-R>\<C-R>=string(complete_info())\<CR>\<ESC>", "tx")
576+
call assert_equal("matched{'preinserted_text': '', 'pum_visible': 0, 'mode': '', 'selected': -1, 'items': []}", getline(1))
577+
%d
574578
call feedkeys("i\<C-X>\<C-U>\<C-R>\<C-R>=string(complete_info())\<CR>\<ESC>", "tx")
575579
call assert_equal("matched{'preinserted_text': '', 'pum_visible': 1, 'mode': 'function', 'selected': 0, 'items': [{'word': 'matched', 'menu': '', 'user_data': '', 'info': '', 'kind': '', 'abbr': ''}]}", getline(1))
576580
%d

src/version.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,10 @@ static char *(features[]) =
744744

745745
static int included_patches[] =
746746
{ /* Add new patch number below this line */
747+
/**/
748+
1881,
749+
/**/
750+
1880,
747751
/**/
748752
1879,
749753
/**/

0 commit comments

Comments
 (0)