Skip to content

Commit

Permalink
remove fs-err crate (#1253)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaplanelad authored Feb 14, 2025
1 parent 1b58868 commit 46c2309
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ async-trait = { workspace = true }
axum = { workspace = true }
axum-extra = { version = "0.10", features = ["cookie"] }
regex = { workspace = true }
fs-err = "2.11.0"
# mailer
tera = { workspace = true }
thousands = "0.2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ Notes:
***/
use std::{
collections::BTreeMap,
fs,
path::{Path, PathBuf},
sync::OnceLock,
};

use fs_err as fs;
use serde::{Deserialize, Serialize};
use serde_json::json;
use tracing::info;
Expand Down
21 changes: 14 additions & 7 deletions src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
//! This module defines functions and operations related to the application's
//! database interactions.
use std::{collections::HashMap, fs::File, io::Write, path::Path, sync::OnceLock, time::Duration};
use std::{
collections::HashMap, fs, fs::File, io::Write, path::Path, sync::OnceLock, time::Duration,
};

use chrono::{DateTime, Utc};
use duct::cmd;
use fs_err::{self as fs, create_dir_all};
use regex::Regex;
use sea_orm::{
ActiveModelTrait, ConnectOptions, ConnectionTrait, Database, DatabaseBackend,
Expand Down Expand Up @@ -467,11 +468,17 @@ pub async fn entities<M: MigratorTrait>(ctx: &AppContext) -> AppResult<String> {
// also we are generating an extension module from the get go
fn fix_entities() -> AppResult<()> {
let dir = fs::read_dir("src/models/_entities")?
.flatten()
.filter(|ent| {
ent.path().is_file() && ent.file_name() != "mod.rs" && ent.file_name() != "prelude.rs"
.filter_map(|ent| {
let ent = ent.unwrap();
if ent.path().is_file()
&& ent.file_name() != "mod.rs"
&& ent.file_name() != "prelude.rs"
{
Some(ent.path())
} else {
None
}
})
.map(|ent| ent.path())
.collect::<Vec<_>>();

// remove activemodel impl from all generated entities, and make note to
Expand Down Expand Up @@ -690,7 +697,7 @@ pub async fn dump_tables(

if !to.exists() {
tracing::info!("the specified dump folder does not exist. creating the folder now");
create_dir_all(to)?;
fs::create_dir_all(to)?;
}

for row in data_result {
Expand Down
3 changes: 2 additions & 1 deletion src/doctor.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{
collections::{BTreeMap, HashMap},
fs,
process::Command,
sync::OnceLock,
};
Expand Down Expand Up @@ -191,7 +192,7 @@ pub async fn run_all(config: &Config, production: bool) -> Result<BTreeMap<Resou
/// # Errors
/// Returns error if fails
pub fn check_deps() -> Result<Check> {
let cargolock = fs_err::read_to_string("Cargo.lock")?;
let cargolock = fs::read_to_string("Cargo.lock")?;

let crate_statuses =
depcheck::check_crate_versions(&cargolock, get_min_dep_versions().clone())?;
Expand Down

0 comments on commit 46c2309

Please sign in to comment.