Mercurial > public > mercurial-scm > hg-stable
diff rust/hg-core/src/filepatterns.rs @ 42634:0247601869ba
rust-filepatterns: fix type of warnings tuple to (bytes, bytes)
Otherwise warn() in match.py would fail if the warning contains non-ASCII
character.
We might want to add a thin ByteString wrapper around Vec<u8> to
implement ToPyObject<ObjectType = PyBytes>, but I'm not sure.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 21 Jul 2019 12:46:57 +0900 |
parents | 326fdce22fb2 |
children | 30f8e786868c |
line wrap: on
line diff
--- a/rust/hg-core/src/filepatterns.rs Sun Jul 21 13:48:29 2019 +0900 +++ b/rust/hg-core/src/filepatterns.rs Sun Jul 21 12:46:57 2019 +0900 @@ -227,7 +227,7 @@ } pub type PatternTuple = (Vec<u8>, LineNumber, Vec<u8>); -type WarningTuple = (String, String); +type WarningTuple = (Vec<u8>, Vec<u8>); pub fn parse_pattern_file_contents( lines: &[u8], @@ -263,10 +263,7 @@ if let Some(rel_syntax) = SYNTAXES.get(syntax) { current_syntax = rel_syntax; } else if warn { - warnings.push(( - String::from_utf8_lossy(file_path).to_string(), - String::from_utf8_lossy(syntax).to_string(), - )); + warnings.push((file_path.to_owned(), syntax.to_owned())); } continue; }