Skip to content

Commit

Permalink
chore: fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
amr-crabnebula committed Sep 12, 2023
1 parent 967bf35 commit f19be31
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
13 changes: 6 additions & 7 deletions crates/packager/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl ConfigExt for Config {
pub(crate) trait ConfigExtInternal {
fn main_binary(&self) -> crate::Result<&Binary>;
fn main_binary_name(&self) -> crate::Result<&String>;
fn resources_from_dir(src_dir: &PathBuf, target_dir: &Path) -> crate::Result<Vec<IResource>>;
fn resources_from_dir(src_dir: &Path, target_dir: &Path) -> crate::Result<Vec<IResource>>;
fn resources_from_glob(glob: &str) -> crate::Result<Vec<IResource>>;
fn resources(&self) -> crate::Result<Vec<IResource>>;
fn find_ico(&self) -> Option<PathBuf>;
Expand All @@ -122,7 +122,7 @@ impl ConfigExtInternal for Config {
}

#[inline]
fn resources_from_dir(src_dir: &PathBuf, target_dir: &Path) -> crate::Result<Vec<IResource>> {
fn resources_from_dir(src_dir: &Path, target_dir: &Path) -> crate::Result<Vec<IResource>> {
let mut out = Vec::new();
for entry in walkdir::WalkDir::new(src_dir) {
let entry = entry?;
Expand Down Expand Up @@ -161,7 +161,7 @@ impl ConfigExtInternal for Config {
let target_dir = Path::new(src_dir.file_name().unwrap());
out.extend(Self::resources_from_dir(&src_dir, target_dir)?);
} else {
out.extend(Self::resources_from_glob(&src)?);
out.extend(Self::resources_from_glob(src)?);
}
}
Resource::Mapped { src, target } => {
Expand All @@ -175,7 +175,7 @@ impl ConfigExtInternal for Config {
target: sanitize_path(target),
});
} else {
let globbed_res = Self::resources_from_glob(&src)?;
let globbed_res = Self::resources_from_glob(src)?;
let retargetd_res = globbed_res.into_iter().map(|mut r| {
r.target = target_dir.join(r.target);
r
Expand Down Expand Up @@ -238,9 +238,8 @@ impl ConfigExtInternal for Config {
fn sanitize_path<P: AsRef<Path>>(path: P) -> PathBuf {
let mut dest = PathBuf::new();
for c in path.as_ref().components() {
match c {
std::path::Component::Normal(s) => dest.push(s),
_ => {}
if let std::path::Component::Normal(s) = c {
dest.push(s)
}
}
dest
Expand Down
6 changes: 3 additions & 3 deletions crates/packager/src/nsis/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ const NSIS_REQUIRED_FILES: &[&str] = &[
"Plugins/x86-unicode/nsis_tauri_utils.dll",
];

fn generate_resource_data(
config: &Config,
) -> crate::Result<(BTreeSet<PathBuf>, Vec<(PathBuf, PathBuf)>)> {
type DirectoriesSet = BTreeSet<PathBuf>;
type ResourcesMap = Vec<(PathBuf, PathBuf)>;
fn generate_resource_data(config: &Config) -> crate::Result<(DirectoriesSet, ResourcesMap)> {
let mut directories = BTreeSet::new();
let mut resources_map = Vec::new();
for r in config.resources()? {
Expand Down

0 comments on commit f19be31

Please sign in to comment.