@@ -4,8 +4,7 @@ use std::iter::FusedIterator;
4
4
use regex:: bytes:: RegexBuilder as BytesRegexBuilder ;
5
5
use regex:: { Match , Regex } ;
6
6
use smallvec:: SmallVec ;
7
-
8
- use relay_wstring:: WStr ;
7
+ use utf16string:: { LittleEndian , WStr } ;
9
8
10
9
use crate :: pii:: compiledconfig:: RuleRef ;
11
10
use crate :: pii:: regexes:: { get_regex_for_rule_type, ReplaceBehavior } ;
@@ -106,7 +105,11 @@ fn apply_regex_to_utf16le_bytes(
106
105
}
107
106
108
107
/// Extract the matching encoded slice from the encoded string.
109
- fn get_wstr_match < ' a > ( all_text : & str , re_match : Match , all_encoded : & ' a mut WStr ) -> & ' a mut WStr {
108
+ fn get_wstr_match < ' a > (
109
+ all_text : & str ,
110
+ re_match : Match ,
111
+ all_encoded : & ' a mut WStr < LittleEndian > ,
112
+ ) -> & ' a mut WStr < LittleEndian > {
110
113
let mut encoded_start = 0 ;
111
114
let mut encoded_end = all_encoded. len ( ) ;
112
115
@@ -172,7 +175,7 @@ trait StringMods: AsRef<[u8]> {
172
175
}
173
176
}
174
177
175
- impl StringMods for WStr {
178
+ impl StringMods for WStr < LittleEndian > {
176
179
fn fill_content ( & mut self , fill_char : char ) {
177
180
// If fill_char is too wide, fill_char.encode_utf16() will panic, fulfilling the
178
181
// trait's contract that we must panic if fill_char is too wide.
@@ -325,7 +328,7 @@ impl<'a> FusedIterator for WStrSegmentIter<'a> {}
325
328
/// longer match.
326
329
struct WStrSegment < ' a > {
327
330
/// The raw bytes of this segment.
328
- encoded : & ' a mut WStr ,
331
+ encoded : & ' a mut WStr < LittleEndian > ,
329
332
/// The decoded string of this segment.
330
333
decoded : String ,
331
334
}
@@ -469,7 +472,11 @@ impl<'a> PiiAttachmentsProcessor<'a> {
469
472
}
470
473
471
474
/// Scrub a filepath, preserving the basename.
472
- pub fn scrub_utf16_filepath ( & self , path : & mut WStr , state : & ProcessingState < ' _ > ) -> bool {
475
+ pub fn scrub_utf16_filepath (
476
+ & self ,
477
+ path : & mut WStr < LittleEndian > ,
478
+ state : & ProcessingState < ' _ > ,
479
+ ) -> bool {
473
480
let index =
474
481
path. char_indices ( ) . rev ( ) . find_map (
475
482
|( i, c) | {
0 commit comments