Repository: rust-lang/rust-enhanced (language: rust)

Issue:
Running check on `build.rs` outputs failure message.
### Sublime Text Version

E.g Sublime Text 4 (Build 4126)

### Rust Enhanced Version

2.24.0

### Operating system

Fedora (probably unrelated)

### Actual behavior

When saving file in a `build.rs` file, `rust-enhanced` writes to the status bar:

```
Rust check failed, see console or debug log.
```

The debug log:

```
+0.000 Running: cargo metadata --no-deps
+0.092 Rust Enhanced: Failed to find target for '/home/joao/ouch/build.rs'
```

### Expected behavior

`rust-enhanced` should be able to check the `build.rs` file at the root of the project, or, if it's not possible, give a better description of what happened.

The _debug log_ left me debugging for several minutes what could be the error reason.

### Steps to reproduce
1. `cargo new foo`
2. `subl foo/build.rs`
3. Add the contents `fn main() {}`.
4. Press **Ctrl + S** to save
5. See status bar.


Discussion / hints:

Fix patch:
diff --git a/rust/target_detect.py b/rust/target_detect.py
index 293f013..024e49f 100644
--- a/rust/target_detect.py
+++ b/rust/target_detect.py
@@ -60,9 +60,9 @@ def determine_targets(self, file_name, metadata=None):
             if result:
                 return result
 
-        log.critical(self.window,
+        log.log(self.window,
             'Rust Enhanced: Failed to find target for %r', file_name)
-        return []
+        return [(None, [])]
 
     def _targets_manual_config(self, file_name):
         """Check for Cargo targets in the Sublime settings."""


Test patch:
diff --git a/tests/test_target_detect.py b/tests/test_target_detect.py
index 2a65744..1900c37 100644
--- a/tests/test_target_detect.py
+++ b/tests/test_target_detect.py
@@ -27,8 +27,8 @@ def test_multi_targets(self):
             # Random module in src/, defaults to --lib.
             ('src/lmod1.rs', [('src/lib.rs', '--lib')]),
             # Target failure.  Perhaps this should run rustc directly?
-            ('mystery.rs', []),
-            ('build.rs', []),
+            ('mystery.rs', [(None, '')]),
+            ('build.rs', [(None, '')]),
             # Shared module in test, not possible to easily determine which
             # test it belongs to.
             ('tests/common/helpers.rs', [('tests/test1.rs', '--test test1'),
@@ -53,11 +53,17 @@ def test_multi_targets(self):
 
         for (path, targets) in expected_targets:
             path = os.path.join('tests', 'multi-targets', path)
-            targets = [(os.path.normpath(
-                os.path.join(plugin_path, 'tests', 'multi-targets', x[0])),
-                x[1].split()) for x in targets]
+            joined_targets = []
+            for (target_path, args) in targets:
+                args = args.split()
+                if target_path:
+                    joined = os.path.normpath(
+                        os.path.join(plugin_path, 'tests', 'multi-targets', target_path))
+                    joined_targets.append((joined, args))
+                else:
+                    joined_targets.append((None, args))
             self._with_open_file(path,
-                lambda view: self._test_multi_targets(view, targets))
+                lambda view: self._test_multi_targets(view, joined_targets))
 
     def _test_multi_targets(self, view, expected_targets):
         expected_targets.sort()