diff --git a/fontique/src/backend/fontconfig/config.rs b/fontique/src/backend/fontconfig/config.rs index 20a99bd6..dd3d04d5 100644 --- a/fontique/src/backend/fontconfig/config.rs +++ b/fontique/src/backend/fontconfig/config.rs @@ -4,7 +4,7 @@ //! Extremely naive fontconfig xml parser to extract the data we need. use roxmltree::Node; -use std::path::Path; +use std::path::{Path, PathBuf}; pub trait ParserSink { fn include_path(&mut self, path: &Path); @@ -175,7 +175,7 @@ fn include_config(path: &Path, sink: &mut impl ParserSink) -> std::io::Result<() Ok(()) } -fn resolve_dir(node: Node, config_file_path: impl AsRef) -> Option { +fn resolve_dir(node: Node, config_file_path: impl AsRef) -> Option { let dir_path = node.text()?; let (xdg_env, xdg_fallback) = match node.tag_name().name() { "include" => ("XDG_CONFIG_HOME", "~/.config"), @@ -184,7 +184,7 @@ fn resolve_dir(node: Node, config_file_path: impl AsRef) -> Option { - std::path::PathBuf::from(std::env::var(xdg_env).unwrap_or_else(|_| xdg_fallback.into())) + PathBuf::from(std::env::var(xdg_env).unwrap_or_else(|_| xdg_fallback.into())) .join(dir_path) } _ => { @@ -193,14 +193,14 @@ fn resolve_dir(node: Node, config_file_path: impl AsRef) -> Option parent.join(dir_path), - None => std::path::Path::new(".").join(dir_path), + None => Path::new(".").join(dir_path), } } } }; Some(if let Ok(stripped_path) = path.strip_prefix("~") { let home = config_home().unwrap_or("/".to_string()); - std::path::Path::new(&home).join(stripped_path) + Path::new(&home).join(stripped_path) } else { path }) diff --git a/fontique/src/backend/fontconfig/mod.rs b/fontique/src/backend/fontconfig/mod.rs index 69c03e7d..c08c3750 100644 --- a/fontique/src/backend/fontconfig/mod.rs +++ b/fontique/src/backend/fontconfig/mod.rs @@ -2,7 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 OR MIT use hashbrown::HashMap; -use std::{path::PathBuf, sync::Arc}; +use std::path::{Path, PathBuf}; +use std::sync::Arc; use super::{ super::{Stretch, Style, Weight}, @@ -91,7 +92,7 @@ impl SystemFonts { config::parse_config("/etc/fonts/fonts.conf".as_ref(), &mut config); if let Ok(xdg_config_home) = std::env::var("XDG_CONFIG_HOME") { config::parse_config( - std::path::PathBuf::from(xdg_config_home) + PathBuf::from(xdg_config_home) .as_path() .join("fontconfig/fonts.conf") .as_path(), @@ -99,7 +100,7 @@ impl SystemFonts { ); } else if let Ok(user_home) = std::env::var("HOME") { config::parse_config( - std::path::PathBuf::from(user_home) + PathBuf::from(user_home) .as_path() .join(".config/fontconfig/fonts.conf") .as_path(), @@ -300,9 +301,9 @@ impl config::ParserSink for Config { } } - fn include_path(&mut self, _path: &std::path::Path) {} + fn include_path(&mut self, _path: &Path) {} - fn cache_path(&mut self, path: &std::path::Path) { + fn cache_path(&mut self, path: &Path) { self.cache_dirs.push(path.into()); }