Skip to content

Commit 87724b9

Browse files
committed
Target Detector: Default to building the whole project
1 parent 24c1985 commit 87724b9

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

rust/target_detect.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ def determine_targets(self, file_name, metadata=None):
6060
if result:
6161
return result
6262

63-
log.critical(self.window,
63+
log.log(self.window,
6464
'Rust Enhanced: Failed to find target for %r', file_name)
65-
return []
65+
return [(None, [])]
6666

6767
def _targets_manual_config(self, file_name):
6868
"""Check for Cargo targets in the Sublime settings."""

tests/test_target_detect.py

+12-6
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ def test_multi_targets(self):
2727
# Random module in src/, defaults to --lib.
2828
('src/lmod1.rs', [('src/lib.rs', '--lib')]),
2929
# Target failure. Perhaps this should run rustc directly?
30-
('mystery.rs', []),
31-
('build.rs', []),
30+
('mystery.rs', [(None, '')]),
31+
('build.rs', [(None, '')]),
3232
# Shared module in test, not possible to easily determine which
3333
# test it belongs to.
3434
('tests/common/helpers.rs', [('tests/test1.rs', '--test test1'),
@@ -53,11 +53,17 @@ def test_multi_targets(self):
5353

5454
for (path, targets) in expected_targets:
5555
path = os.path.join('tests', 'multi-targets', path)
56-
targets = [(os.path.normpath(
57-
os.path.join(plugin_path, 'tests', 'multi-targets', x[0])),
58-
x[1].split()) for x in targets]
56+
joined_targets = []
57+
for (target_path, args) in targets:
58+
args = args.split()
59+
if target_path:
60+
joined = os.path.normpath(
61+
os.path.join(plugin_path, 'tests', 'multi-targets', target_path))
62+
joined_targets.append((joined, args))
63+
else:
64+
joined_targets.append((None, args))
5965
self._with_open_file(path,
60-
lambda view: self._test_multi_targets(view, targets))
66+
lambda view: self._test_multi_targets(view, joined_targets))
6167

6268
def _test_multi_targets(self, view, expected_targets):
6369
expected_targets.sort()

0 commit comments

Comments
 (0)