Skip to content

Commit a2822b4

Browse files
rhysdda-x
authored andcommitted
Fix restoring cursor position on :RustTest
1 parent 255a81f commit a2822b4

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

autoload/rust.vim

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -541,21 +541,20 @@ function! rust#Test(mods, winsize, all, options) abort
541541
let saved = getpos('.')
542542
try
543543
let func_name = s:SearchTestFunctionNameUnderCursor()
544-
if func_name ==# ''
545-
echohl ErrorMsg
546-
echomsg 'No test function was found under the cursor. Please add ! to command if you want to run all tests'
547-
echohl None
548-
return
549-
endif
550-
if a:options ==# ''
551-
execute cmd . 'cargo test --manifest-path' manifest func_name
552-
else
553-
execute cmd . 'cargo test --manifest-path' manifest func_name a:options
554-
endif
555-
return
556544
finally
557545
call setpos('.', saved)
558546
endtry
547+
if func_name ==# ''
548+
echohl ErrorMsg
549+
echomsg 'No test function was found under the cursor. Please add ! to command if you want to run all tests'
550+
echohl None
551+
return
552+
endif
553+
if a:options ==# ''
554+
execute cmd . 'cargo test --manifest-path' manifest func_name
555+
else
556+
execute cmd . 'cargo test --manifest-path' manifest func_name a:options
557+
endif
559558
endfunction
560559

561560
" }}}1

0 commit comments

Comments
 (0)