Skip to content

Commit ec4571e

Browse files
committed
Fix on-save syntax check running clippy multiple times.
1 parent 4957f25 commit ec4571e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

SyntaxCheckPlugin.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,21 @@ def get_rustc_messages(self):
109109
110110
:raises rust_proc.ProcessTerminatedError: Check was canceled.
111111
"""
112+
method = util.get_setting('rust_syntax_checking_method', 'no-trans')
113+
if method == 'clippy':
114+
cmd = ['cargo', '+nightly', 'clippy', '--message-format=json']
115+
p = rust_proc.RustProc()
116+
p.run(self.window, cmd, self.cwd, self)
117+
p.wait()
118+
return
119+
120+
# "no-trans" or "check" methods.
112121
td = target_detect.TargetDetector(self.window)
113122
targets = td.determine_targets(self.triggered_file_name)
114123
for (target_src, target_args) in targets:
115-
method = util.get_setting('rust_syntax_checking_method', 'no-trans')
116124
if method == 'check':
117125
cmd = ['cargo', 'check', '--message-format=json']
118126
cmd.extend(target_args)
119-
elif method == 'clippy':
120-
cmd = ['cargo', '+nightly', 'clippy', '--message-format=json']
121127
else:
122128
cmd = ['cargo', 'rustc']
123129
cmd.extend(target_args)

0 commit comments

Comments
 (0)