comparison rust/hg-core/src/requirements.rs @ 45956:40f79997e81f

rust: fix non-utf8 char in requirements.rs Apparently Phabricator detect `rust/hg-core/src/requirements.rs` file as non utf8 ‽, and mark it as binary. During application it ended up being non-utf8 and this made Rust (and as a result heptapod) very angry:: error: couldn't read hg-core/src/requirements.rs: stream did not contain valid UTF-8 --> hg-core/src/lib.rs:11:9 | 11 | pub mod requirements; | ^^^^^^^^^^^^ error: aborting due to previous error error: could not compile `hg-core`. The after "fixing", the file content has no character matching the following regexp: [^0-9-a-zA-Z /(|).,{}!\[\]:"&=>?_*-;<`'#] So we should be fine, unless Phabricator does something funny again. Differential Revision: https://phab.mercurial-scm.org/D9444
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 28 Nov 2020 14:29:50 +0100
parents f5d62f4d5327
children 9eb07ab3f2d4
comparison
equal deleted inserted replaced
45955:064449f9fdc2 45956:40f79997e81f
5 pub enum RequirementsError { 5 pub enum RequirementsError {
6 // TODO: include a path? 6 // TODO: include a path?
7 Io(io::Error), 7 Io(io::Error),
8 /// The `requires` file is corrupted 8 /// The `requires` file is corrupted
9 Corrupted, 9 Corrupted,
10 /// The repository requires a feature that we don’t support 10 /// The repository requires a feature that we don't support
11 Unsupported { 11 Unsupported {
12 feature: String, 12 feature: String,
13 }, 13 },
14 } 14 }
15 15
53 } 53 }
54 54
55 pub fn check(repo_root: &Path) -> Result<(), RequirementsError> { 55 pub fn check(repo_root: &Path) -> Result<(), RequirementsError> {
56 for feature in load(repo_root)? { 56 for feature in load(repo_root)? {
57 if !SUPPORTED.contains(&&*feature) { 57 if !SUPPORTED.contains(&&*feature) {
58 return Err(RequirementsError::Unsupported { feature }) 58 return Err(RequirementsError::Unsupported { feature });
59 } 59 }
60 } 60 }
61 Ok(()) 61 Ok(())
62 } 62 }
63 63