@@ -8,7 +8,7 @@ use rustc_index::vec::Idx;
8
8
use std:: error:: Error ;
9
9
use std:: fmt:: Debug ;
10
10
use std:: fs:: { self , File } ;
11
- use std:: io:: Write ;
11
+ use std:: io:: { BufWriter , Write } ;
12
12
use std:: path:: Path ;
13
13
14
14
#[ derive( Copy , Clone , Debug ) ]
@@ -117,7 +117,7 @@ impl<'w> FactWriter<'w> {
117
117
T : FactRow ,
118
118
{
119
119
let file = & self . dir . join ( file_name) ;
120
- let mut file = File :: create ( file) ?;
120
+ let mut file = BufWriter :: new ( File :: create ( file) ?) ;
121
121
for row in rows {
122
122
row. write ( & mut file, self . location_table ) ?;
123
123
}
@@ -126,11 +126,19 @@ impl<'w> FactWriter<'w> {
126
126
}
127
127
128
128
trait FactRow {
129
- fn write ( & self , out : & mut File , location_table : & LocationTable ) -> Result < ( ) , Box < dyn Error > > ;
129
+ fn write (
130
+ & self ,
131
+ out : & mut dyn Write ,
132
+ location_table : & LocationTable ,
133
+ ) -> Result < ( ) , Box < dyn Error > > ;
130
134
}
131
135
132
136
impl FactRow for RegionVid {
133
- fn write ( & self , out : & mut File , location_table : & LocationTable ) -> Result < ( ) , Box < dyn Error > > {
137
+ fn write (
138
+ & self ,
139
+ out : & mut dyn Write ,
140
+ location_table : & LocationTable ,
141
+ ) -> Result < ( ) , Box < dyn Error > > {
134
142
write_row ( out, location_table, & [ self ] )
135
143
}
136
144
}
@@ -140,7 +148,11 @@ where
140
148
A : FactCell ,
141
149
B : FactCell ,
142
150
{
143
- fn write ( & self , out : & mut File , location_table : & LocationTable ) -> Result < ( ) , Box < dyn Error > > {
151
+ fn write (
152
+ & self ,
153
+ out : & mut dyn Write ,
154
+ location_table : & LocationTable ,
155
+ ) -> Result < ( ) , Box < dyn Error > > {
144
156
write_row ( out, location_table, & [ & self . 0 , & self . 1 ] )
145
157
}
146
158
}
@@ -151,7 +163,11 @@ where
151
163
B : FactCell ,
152
164
C : FactCell ,
153
165
{
154
- fn write ( & self , out : & mut File , location_table : & LocationTable ) -> Result < ( ) , Box < dyn Error > > {
166
+ fn write (
167
+ & self ,
168
+ out : & mut dyn Write ,
169
+ location_table : & LocationTable ,
170
+ ) -> Result < ( ) , Box < dyn Error > > {
155
171
write_row ( out, location_table, & [ & self . 0 , & self . 1 , & self . 2 ] )
156
172
}
157
173
}
@@ -163,7 +179,11 @@ where
163
179
C : FactCell ,
164
180
D : FactCell ,
165
181
{
166
- fn write ( & self , out : & mut File , location_table : & LocationTable ) -> Result < ( ) , Box < dyn Error > > {
182
+ fn write (
183
+ & self ,
184
+ out : & mut dyn Write ,
185
+ location_table : & LocationTable ,
186
+ ) -> Result < ( ) , Box < dyn Error > > {
167
187
write_row ( out, location_table, & [ & self . 0 , & self . 1 , & self . 2 , & self . 3 ] )
168
188
}
169
189
}
0 commit comments