Skip to content

Commit 7a6eadd

Browse files
committed
Merge pull request #4 from utkarshkukreti/add-examples-as-crate-roots
Treat files under `examples/` as crate roots.
2 parents 998a4c8 + 231d052 commit 7a6eadd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

flycheck-rust.el

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ REL-NAME is the file relative to the Cargo.toml file."
5656
REL-NAME is the file relative to the Cargo.toml file."
5757
(string-prefix-p "benches/" rel-name))
5858

59+
(defun flycheck-rust-example-p (rel-name)
60+
"Whether REL-NAME denotes an example.
61+
62+
REL-NAME is the file relative to the Cargo.toml file."
63+
(string-prefix-p "examples/" rel-name))
64+
5965
(defun flycheck-rust-project-root ()
6066
"Get the project root for the current buffer.
6167
@@ -79,6 +85,7 @@ Flycheck according to the Cargo project layout."
7985
(unless (or (flycheck-rust-executable-p rel-name)
8086
(flycheck-rust-test-p rel-name)
8187
(flycheck-rust-bench-p rel-name)
88+
(flycheck-rust-example-p rel-name)
8289
(string= "src/lib.rs" rel-name))
8390
;; For other files, the library is either the default library or the
8491
;; executable

0 commit comments

Comments
 (0)