Skip to content

Commit c5a6dd8

Browse files
ref(proguard): Directly open paths as ByteView
There is no need to first open the file metadata. All the information we get from the metadata is the length, which we can already get from the `ByteView`.
1 parent a279801 commit c5a6dd8

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/commands/upload_proguard.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,8 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
167167
// request to figure out if any of the checksums are missing. We just ship
168168
// them all up.
169169
for path in &paths {
170-
match fs::metadata(path) {
171-
Ok(md) => {
172-
let byteview = ByteView::open(path).map_err(Error::new)?;
170+
match ByteView::open(path) {
171+
Ok(byteview) => {
173172
let mapping = ProguardMapping::new(&byteview);
174173
if !mapping.has_line_info() {
175174
eprintln!(
@@ -179,7 +178,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
179178
} else {
180179
mappings.push(MappingRef {
181180
path: PathBuf::from(path),
182-
size: md.len(),
181+
size: byteview.len() as u64,
183182
uuid: forced_uuid.copied().unwrap_or_else(|| mapping.uuid()),
184183
});
185184
}

0 commit comments

Comments
 (0)