@@ -129,21 +129,21 @@ fn process_semver_file<W: Write, P: AsRef<Path>>(output: &mut W, path: &mut Path
129
129
} ;
130
130
let input = BufReader :: new ( input_file) ;
131
131
132
- write ! ( output, "// Source: {}.\n " , path. display( ) ) . unwrap ( ) ;
133
- output. write ( b"use libc::{\n " ) . unwrap ( ) ;
132
+ writeln ! ( output, "// Source: {}." , path. display( ) ) . unwrap ( ) ;
133
+ output. write_all ( b"use libc::{\n " ) . unwrap ( ) ;
134
134
for line in input. lines ( ) {
135
135
let line = line. unwrap ( ) . into_bytes ( ) ;
136
136
match line. first ( ) {
137
137
// Ignore comments and empty lines.
138
138
Some ( b'#' ) | None => continue ,
139
139
_ => {
140
- output. write ( b" " ) . unwrap ( ) ;
141
- output. write ( & line) . unwrap ( ) ;
142
- output. write ( b",\n " ) . unwrap ( ) ;
140
+ output. write_all ( b" " ) . unwrap ( ) ;
141
+ output. write_all ( & line) . unwrap ( ) ;
142
+ output. write_all ( b",\n " ) . unwrap ( ) ;
143
143
}
144
144
}
145
145
}
146
- output. write ( b"};\n \n " ) . unwrap ( ) ;
146
+ output. write_all ( b"};\n \n " ) . unwrap ( ) ;
147
147
path. pop ( ) ;
148
148
}
149
149
@@ -158,21 +158,21 @@ fn main() {
158
158
159
159
// FIXME(ctest): ctest cannot parse `crate::` in paths, so replace them with `::`
160
160
let re = regex:: bytes:: Regex :: new ( r"(?-u:\b)crate::" ) . unwrap ( ) ;
161
- copy_dir_hotfix ( Path :: new ( "../src" ) , & hotfix_dir, & re) ;
161
+ copy_dir_hotfix ( Path :: new ( "../src" ) , & hotfix_dir, & re, b"::" ) ;
162
162
163
163
do_cc ( ) ;
164
164
do_ctest ( ) ;
165
165
do_semver ( ) ;
166
166
}
167
167
168
- fn copy_dir_hotfix ( src : & Path , dst : & Path , regex : & regex:: bytes:: Regex ) {
169
- std:: fs:: create_dir ( dst) . unwrap ( ) ;
168
+ fn copy_dir_hotfix ( src : & Path , dst : & Path , regex : & regex:: bytes:: Regex , replace : & [ u8 ] ) {
169
+ std:: fs:: create_dir ( & dst) . unwrap ( ) ;
170
170
for entry in src. read_dir ( ) . unwrap ( ) {
171
171
let entry = entry. unwrap ( ) ;
172
172
let src_path = entry. path ( ) ;
173
173
let dst_path = dst. join ( entry. file_name ( ) ) ;
174
174
if entry. file_type ( ) . unwrap ( ) . is_dir ( ) {
175
- copy_dir_hotfix ( & src_path, & dst_path, regex) ;
175
+ copy_dir_hotfix ( & src_path, & dst_path, regex, replace ) ;
176
176
} else {
177
177
// Replace "crate::" with "::"
178
178
let src_data = std:: fs:: read ( & src_path) . unwrap ( ) ;
0 commit comments