Fix formatting and clippy warnings

This commit is contained in:
Adrian Wozniak 2019-12-20 20:49:40 +01:00
parent 42820c52f5
commit 7cf3e9de18
5 changed files with 15 additions and 19 deletions

View File

@ -101,7 +101,7 @@ impl Config {
impl Config {
pub fn load_theme(&self, theme_name: String) -> Theme {
let home_dir = dirs::config_dir().unwrap();
let mut config_dir = home_dir.clone();
let mut config_dir = home_dir;
config_dir.push("rider");
fs::create_dir_all(&config_dir)
.unwrap_or_else(|_| panic!("Cannot create config directory"));
@ -238,5 +238,4 @@ mod test_getters {
expected.sort();
assert_eq!(result, expected);
}
}

View File

@ -74,7 +74,7 @@ pub fn project_dir() -> PathBuf {
#[cfg_attr(tarpaulin, skip)]
pub fn binaries_directory() -> Result<PathBuf, String> {
let mut exec_dir = PathBuf::new();
exec_dir.push(dirs::executable_dir().unwrap().clone());
exec_dir.push(dirs::executable_dir().unwrap());
let mut rider_editor = exec_dir.clone();
rider_editor.push("rider-editor");
if rider_editor.exists() {

View File

@ -29,7 +29,7 @@ fn init_logger(directories: &Directories) {
let mut log_file_path = directories.log_dir.clone();
log_file_path.push("rider.log");
let mut outputs: Vec<Box<SharedLogger>> = vec![WriteLogger::new(
let mut outputs: Vec<Box<dyn SharedLogger>> = vec![WriteLogger::new(
LevelFilter::Info,
Config::default(),
File::create(log_file_path).unwrap(),

View File

@ -1,7 +1,7 @@
use crate::app::UpdateResult as UR;
use crate::renderer::renderer::Renderer;
use crate::ui::RenderContext as RC;
use crate::ui::*;
use crate::ui::{RenderContext as RC, UpdateContext as UC};
use rider_config::ConfigAccess;
use rider_config::ConfigHolder;
use sdl2::pixels::Color;
@ -54,7 +54,7 @@ impl Settings {
character_size_label: Label::new("Character size".into(), config.clone()),
character_size_value: Label::new(
format!("{}", c.editor_config().character_size()).to_owned(),
config.clone()
config.clone(),
),
config: config.clone(),
}
@ -127,10 +127,7 @@ impl Settings {
renderer,
&RC::ParentPosition(
self.render_start_point()
+ Point::new(
CONTENT_MARGIN_LEFT + LABEL_WIDTH,
CONTENT_MARGIN_TOP,
)
+ Point::new(CONTENT_MARGIN_LEFT + LABEL_WIDTH, CONTENT_MARGIN_TOP)
+ self.scroll(),
),
);
@ -143,7 +140,7 @@ impl Settings {
self.render_start_point()
+ Point::new(
CONTENT_MARGIN_LEFT,
CONTENT_MARGIN_TOP + self.font_label.dest().height() as i32
CONTENT_MARGIN_TOP + self.font_label.dest().height() as i32,
)
+ self.scroll(),
),
@ -181,12 +178,12 @@ impl Settings {
impl ClickHandler for Settings {
#[inline]
fn on_left_click(&mut self, _point: &Point, context: &UpdateContext) -> UR {
fn on_left_click(&mut self, _point: &Point, _context: &UpdateContext) -> UR {
UR::NoOp
}
#[inline]
fn is_left_click_target(&self, _point: &Point, context: &UpdateContext) -> bool {
fn is_left_click_target(&self, _point: &Point, _context: &UpdateContext) -> bool {
false
}
}

View File

@ -17,7 +17,7 @@ fn write_theme(theme: &Theme, directories: &Directories) -> std::io::Result<()>
theme_path.push(directories.themes_dir.clone());
theme_path.push(format!("{}.json", theme.name()));
let contents = serde_json::to_string_pretty(&theme).unwrap();
fs::write(&theme_path, contents.clone())?;
fs::write(&theme_path, contents)?;
Ok(())
}