Commit ffabb33a authored by Andy Barron's avatar Andy Barron
Browse files

appease clippy

parent f659ba5d
......@@ -98,8 +98,7 @@ impl std::error::Error for AppDirsError {
use AppDirsError::*;
match *self {
Io(ref e) => Some(e),
NotSupported => None,
InvalidAppInfo => None,
NotSupported | InvalidAppInfo => None,
}
}
}
......
......@@ -39,7 +39,7 @@ mod platform {
/// create the full hierarchy. Therefore, a result of `Ok` guarantees that the
/// returned path exists.
pub fn app_dir(t: AppDataType, app: &AppInfo, path: &str) -> Result<PathBuf, AppDirsError> {
let path = try!(get_app_dir(t, app, &path));
let path = try!(get_app_dir(t, app, path));
match fs::create_dir_all(&path) {
Ok(..) => Ok(path),
Err(e) => Err(e.into()),
......@@ -56,11 +56,11 @@ pub fn app_dir(t: AppDataType, app: &AppInfo, path: &str) -> Result<PathBuf, App
/// it DOES NOT guarantee that the directory actually exists. (See
/// [`app_dir`](fn.app_dir.html).)
pub fn get_app_dir(t: AppDataType, app: &AppInfo, path: &str) -> Result<PathBuf, AppDirsError> {
if app.author.len() == 0 || app.name.len() == 0 {
if app.author.is_empty() || app.name.is_empty() {
return Err(AppDirsError::InvalidAppInfo);
}
app_root(t, app).map(|mut root| {
for component in path.split("/").filter(|s| s.len() > 0) {
for component in path.split('/').filter(|s| !s.is_empty()) {
root.push(utils::sanitized(component));
}
root
......@@ -88,7 +88,7 @@ pub fn app_root(t: AppDataType, app: &AppInfo) -> Result<PathBuf, AppDirsError>
/// it DOES NOT guarantee that the directory actually exists. (See
/// [`app_root`](fn.app_root.html).)
pub fn get_app_root(t: AppDataType, app: &AppInfo) -> Result<PathBuf, AppDirsError> {
if app.author.len() == 0 || app.name.len() == 0 {
if app.author.is_empty() || app.name.is_empty() {
return Err(AppDirsError::InvalidAppInfo);
}
data_root(t).map(|mut root| {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment