Use `fs_err` in more places (#644)

This commit is contained in:
Charlie Marsh 2023-12-13 20:11:45 -05:00 committed by GitHub
parent 4fd69c74b6
commit e0127581b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -1,14 +1,15 @@
use std::borrow::Cow;
use std::env;
use std::fmt::Write;
use std::io::stdout;
use std::path::Path;
use std::str::FromStr;
use std::{env, fs};
use anstream::AutoStream;
use anyhow::{anyhow, Result};
use chrono::{DateTime, Utc};
use colored::Colorize;
use fs_err as fs;
use itertools::Itertools;
use tracing::debug;
@ -191,7 +192,7 @@ pub(crate) async fn pip_compile(
// Write the resolved dependencies to the output channel.
let mut writer: Box<dyn std::io::Write> = if let Some(output_file) = output_file {
Box::new(AutoStream::auto(fs::File::create(output_file)?))
Box::new(AutoStream::auto(std::fs::File::create(output_file)?))
} else {
Box::new(AutoStream::auto(stdout()))
};

View File

@ -1,10 +1,10 @@
use std::fs;
use std::io::{BufWriter, Write};
use std::path::PathBuf;
use anstream::println;
use anyhow::{Context, Result};
use clap::{Parser, ValueEnum};
use fs_err as fs;
use fs_err::File;
use itertools::Itertools;
use petgraph::dot::{Config as DotConfig, Dot};

View File

@ -9,7 +9,6 @@
#![allow(clippy::cast_sign_loss)]
use std::{
fs::File,
io::{BufReader, Cursor, Read, Seek, SeekFrom},
sync::{Arc, Mutex},
};
@ -117,7 +116,7 @@ impl<R: HasLength> HasLength for BufReader<R> {
}
}
impl HasLength for File {
impl HasLength for std::fs::File {
fn len(&self) -> u64 {
self.metadata().unwrap().len()
}