Skip to content

Commit

Permalink
Cleanup lofty imports
Browse files Browse the repository at this point in the history
  • Loading branch information
martpie committed Apr 22, 2024
1 parent 803118e commit 0effbe8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions src-tauri/src/plugins/cover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ use std::path::PathBuf;
use std::str::FromStr;

use base64::prelude::*;
use lofty::{
file::TaggedFileExt as _,
picture::{MimeType, PictureType},
};
use lofty::picture::{MimeType, PictureType};
use lofty::prelude::*;

This comment has been minimized.

Copy link
@uklotzde

uklotzde Apr 22, 2024

Contributor

I prefer to keep the local namespace clean by not importing unused names/types. When using traits an unnamed import often suffices.

This comment has been minimized.

Copy link
@martpie

martpie Apr 22, 2024

Author Owner

That was something I was reading about last night, I added them because we use preludes in other places. But I am curious and I will build two binaries, one with preludes and one with dedicated imports, so I can check if there is a worthy size reduction.

me rust noob.

This comment has been minimized.

Copy link
@uklotzde

uklotzde Apr 22, 2024

Contributor

Doesn't affect the binary. Just less symbols in scope and more control.

This comment has been minimized.

Copy link
@martpie

martpie Apr 22, 2024

Author Owner

ah I see, right. I'd be happy to stamp a PR that would get rid of all preludes in the app then.

This comment has been minimized.

Copy link
@martpie

martpie Apr 22, 2024

Author Owner

(we have some for rayon and itertools I believe)

use tauri::plugin::{Builder, TauriPlugin};
use tauri::Runtime;

Expand Down
6 changes: 2 additions & 4 deletions src-tauri/src/plugins/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ use bonsaidb::local::config::{Builder as BonsaiBuilder, StorageConfiguration};
use bonsaidb::local::AsyncDatabase;
use bonsaidb::local::AsyncStorage;
use itertools::Itertools;
use lofty::{
file::{AudioFile, TaggedFileExt as _},
tag::{Accessor as _, ItemKey},
};
use lofty::prelude::*;
use lofty::tag::ItemKey;
use log::{error, info, warn};
use rayon::prelude::*;
use serde::{Deserialize, Serialize};
Expand Down

0 comments on commit 0effbe8

Please sign in to comment.