Skip to content

Commit 3896107

Browse files
ehussJayflux
authored andcommitted
Change default on-save syntax checking to "cargo check" from no-trans. (#191)
Fixes #183.
1 parent 619f18a commit 3896107

File tree

3 files changed

+28
-12
lines changed

3 files changed

+28
-12
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ This relies on Cargo and Rust (>= 1.8.0) being installed and on your system path
6060
| Setting | Default | Description |
6161
| :------ | :------ | :---------- |
6262
| `rust_syntax_checking` | `true` | Enable the on-save syntax checking. |
63+
| `rust_syntax_checking_method` | `"check"` | The method used for checking your code (see below). |
6364
| `rust_syntax_checking_include_tests` | `true` | Enable checking of test code within `#[cfg(test)]` sections (only for `no-trans` method). |
64-
| `rust_syntax_checking_method` | `"no-trans"` | The method used for checking your code (see below). |
6565

6666
The available checking methods are:
6767

RustEnhanced.sublime-settings

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
// build errors or warnings.
44
"rust_syntax_checking": true,
55

6+
// The method used to check code on-save.
7+
// "check", "no-trans", or "clippy" (see README.md)
8+
"rust_syntax_checking_method": "check",
9+
610
// Enable checking of test code within #[cfg(test)] sections.
711
"rust_syntax_checking_include_tests": true,
812

SyntaxCheckPlugin.py

+23-11
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,33 @@
1313
"""
1414

1515
# Notes:
16-
# - -Zno-trans produces a warning about being unstable (see
17-
# https://github.com/rust-lang/rust/issues/31847). I am uncertain about the
18-
# long-term prospects of how this will be resolved. There are a few things
19-
# to consider:
20-
# - Cargo recently added "cargo check"
21-
# (https://github.com/rust-lang/cargo/pull/3296), which more or less
22-
# does the same thing. See also the original "cargo check" addon
23-
# (https://github.com/rsolomo/cargo-check/).
16+
# - -Zno-trans has been deprecated, and will only be available with the
17+
# nightly compiler starting with rust 1.19. Using "cargo check" is the
18+
# preferred alternative, though it currently has some limitations. See:
19+
#
20+
# - Unstable flags removed:
21+
# https://github.com/rust-lang/rust/issues/31847
22+
#
23+
# - Cargo check added in rust 1.16:
24+
# https://github.com/rust-lang/cargo/pull/3296 (based on original
25+
# "cargo check" addon https://github.com/rsolomo/cargo-check/)
26+
#
2427
# - RLS was recently released
2528
# (https://github.com/rust-lang-nursery/rls). It's unclear to me if
2629
# this will perform full-linting that could replace this or not.
2730
#
31+
# - "cargo check" ignores #[test]:
32+
# https://github.com/rust-lang/cargo/issues/3431
33+
#
34+
# - "cargo check" will not re-issue errors/warnings if nothing has
35+
# changed. This generally should not be a problem since on-save
36+
# syntax only runs after the file has been saved which updates the
37+
# timestamp, but it's something to be careful about. See:
38+
# https://github.com/rust-lang/cargo/issues/3624
39+
#
2840
# - -Zno-trans prevents some warnings and errors from being generated. For
29-
# example, see const-err.rs. "cargo check" will solve this, but it is
30-
# nightly only right now. Other issues:
41+
# example, see const-err.rs. "cargo check" does not have this problem.
42+
# Other issues:
3143
# - Errors generated by compiling an extern crate do not not output as
3244
# json.
3345

@@ -104,7 +116,7 @@ def get_rustc_messages(self):
104116
105117
:raises rust_proc.ProcessTerminatedError: Check was canceled.
106118
"""
107-
method = util.get_setting('rust_syntax_checking_method', 'no-trans')
119+
method = util.get_setting('rust_syntax_checking_method', 'check')
108120
settings = cargo_settings.CargoSettings(self.window)
109121
settings.load()
110122
command_info = cargo_settings.CARGO_COMMANDS[method]

0 commit comments

Comments
 (0)