Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/core/src/document/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ pub fn sys_info_as_html() -> String {
buf.push_str("\t\t\t<tr class=\"sep\"></tr>\n");

let output = Command::new("/bin/ntx_hwconfig")
.args(&["-s", "/dev/mmcblk0"])
.args(["-s", "/dev/mmcblk0"])
.output()
.map_err(|e| eprintln!("Can't execute command: {:#}.", e))
.ok();
Expand Down
4 changes: 2 additions & 2 deletions crates/core/src/library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ impl Library {
continue;
}

let kind = file_kind(&path).unwrap_or_default();
let kind = file_kind(path).unwrap_or_default();
let md = entry.metadata().unwrap();
let size = md.len();
let fp = md.fingerprint(self.fat32_epoch).unwrap();
Expand Down Expand Up @@ -303,7 +303,7 @@ impl Library {
}
// We found a new file: add it to the db.
} else {
let kind = file_kind(&path).unwrap_or_default();
let kind = file_kind(path).unwrap_or_default();
if !settings.allowed_kinds.contains(&kind) {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/view/calculator/code_area.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ impl View for CodeArea {
x = self.rect.min.x + padding;
}
if y >= rect.min.y {
let plan = font.plan(&c.to_string(), None, None);
let plan = font.plan(c.to_string(), None, None);
font.render(fb, TEXT_NORMAL[1], &plan, pt!(x, y));
}
x += char_width;
Expand Down
4 changes: 2 additions & 2 deletions crates/core/src/view/clock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl Clock {
let time = Local::now();
let format = context.settings.time_format.clone();
let font = font_from_style(&mut context.fonts, &NORMAL_STYLE, CURRENT_DEVICE.dpi);
let width = font.plan(&time.format(&format).to_string(), None, None).width + font.em() as i32;
let width = font.plan(time.format(&format).to_string(), None, None).width + font.em() as i32;
rect.min.x = rect.max.x - width;
Clock {
id: ID_FEEDER.next(),
Expand Down Expand Up @@ -56,7 +56,7 @@ impl View for Clock {
fn render(&self, fb: &mut dyn Framebuffer, _rect: Rectangle, fonts: &mut Fonts) {
let dpi = CURRENT_DEVICE.dpi;
let font = font_from_style(fonts, &NORMAL_STYLE, dpi);
let plan = font.plan(&self.time.format(&self.format).to_string(), None, None);
let plan = font.plan(self.time.format(&self.format).to_string(), None, None);
let dx = (self.rect.width() as i32 - plan.width) / 2;
let dy = (self.rect.height() as i32 - font.x_heights.0 as i32) / 2;
let pt = pt!(self.rect.min.x + dx, self.rect.max.y - dy);
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/view/home/library_label.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl View for LibraryLabel {
let font = font_from_style(fonts, &NORMAL_STYLE, dpi);
let padding = font.em() as i32 / 2;
let max_width = self.rect.width().saturating_sub(2 * padding as u32) as i32;
let plan = font.plan(&self.text(), Some(max_width), None);
let plan = font.plan(self.text(), Some(max_width), None);
let dx = padding + (max_width - plan.width) / 2;
let dy = (self.rect.height() as i32 - font.x_heights.0 as i32) / 2;
let pt = pt!(self.rect.min.x + dx, self.rect.max.y - dy);
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/view/icon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ lazy_static! {
"arrow-left", "arrow-right", "angle-down", "angle-up", "crop", "toc", "font_family",
"font_size", "line_height", "align-justify", "align-left", "align-right",
"align-center", "margin", "plug", "cover", "enclosed_menu", "contrast", "gray"].iter().cloned() {
let path = dir.join(&format!("{}.svg", name));
let path = dir.join(format!("{}.svg", name));
let doc = PdfOpener::new().and_then(|o| o.open(path)).unwrap();
let pixmap = doc.page(0).and_then(|p| p.pixmap(scale, 1)).unwrap();
m.insert(name, pixmap);
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/view/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ impl View for Key {
match self.kind.label(ratio) {
KeyLabel::Char(ch) => {
let font = font_from_style(fonts, &KBD_CHAR, dpi);
let plan = font.plan(&ch.to_string(), None, None);
let plan = font.plan(ch.to_string(), None, None);
let dx = (self.rect.width() as i32 - plan.width) / 2;
let dy = (self.rect.height() - font.x_heights.0) as i32 / 2;
let pt = pt!(self.rect.min.x + dx, self.rect.max.y - dy);
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/view/named_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl NamedInput {
let padding = font.em() as i32;

let mut label_width = font.plan(&text, None, None).width;
let mut input_width = font.plan(&"0".repeat(input_size), None, None).width;
let mut input_width = font.plan("0".repeat(input_size), None, None).width;
let mut total_width = 5 * padding + label_width + input_width;
let delta = width as i32 - total_width;

Expand Down
4 changes: 2 additions & 2 deletions crates/core/src/view/page_label.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ impl View for PageLabel {
let font = font_from_style(fonts, &NORMAL_STYLE, dpi);
let padding = font.em() as i32 / 2;
let max_width = self.rect.width().saturating_sub(2 * padding as u32) as i32;
let mut plan = font.plan(&self.text(0), None, None);
let mut plan = font.plan(self.text(0), None, None);
for size in 1..=4 {
if plan.width <= max_width {
break;
}
plan = font.plan(&self.text(size), None, None);
plan = font.plan(self.text(size), None, None);
}
font.crop_right(&mut plan, max_width);
let dx = padding + (max_width - plan.width) / 2;
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/view/presets_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl PresetsList {
let x_height = font.x_heights.0 as i32;
let preset_height = 4 * x_height;
let padding = font.em() as i32;
let preset_width = font.plan(&presets[0].name(), None, None).width + padding;
let preset_width = font.plan(presets[0].name(), None, None).width + padding;
let max_per_line = (self.rect.width() as i32 + padding) / (preset_width + padding);

self.pages.clear();
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/view/reader/chapter_label.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl View for ChapterLabel {
let padding = font.em() as i32 / 2;
let max_width = self.rect.width().saturating_sub(2 * padding as u32) as i32;
let max_progress_width = max_width - font.ellipsis.width;
let progress_plan = font.plan(&format!(" ({:.1}%)", 100.0 * self.progress),
let progress_plan = font.plan(format!(" ({:.1}%)", 100.0 * self.progress),
Some(max_progress_width),
None);
let max_title_width = max_width - progress_plan.width;
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/view/reader/results_label.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl View for ResultsLabel {
let font = font_from_style(fonts, &NORMAL_STYLE, dpi);
let padding = font.em() as i32 / 2;
let max_width = self.rect.width().saturating_sub(2 * padding as u32) as i32;
let plan = font.plan(&self.text(), Some(max_width), None);
let plan = font.plan(self.text(), Some(max_width), None);
let dx = padding + (max_width - plan.width) / 2;
let dy = (self.rect.height() as i32 - font.x_heights.0 as i32) / 2;
let pt = pt!(self.rect.min.x + dx, self.rect.max.y - dy);
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/view/slider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl View for Slider {
&fill_color);

let font = font_from_style(fonts, &SLIDER_VALUE, dpi);
let plan = font.plan(&format!("{:.1}", self.value), None, None);
let plan = font.plan(format!("{:.1}", self.value), None, None);
let x_height = font.x_heights.1 as i32;

let x_drift = if self.value > (self.min_value + self.max_value) / 2.0 {
Expand Down
2 changes: 1 addition & 1 deletion crates/fetcher/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ fn main() -> Result<(), Error> {

session.since = updated_at.timestamp();

let epub_path = save_path.join(&format!("{}.epub", id));
let epub_path = save_path.join(format!("{}.epub", id));
if epub_path.exists() {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion crates/importer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fn main() -> Result<(), Error> {
}
}).unwrap_or(LibraryMode::Database);

let mut library = Library::new(&library_path, mode)?;
let mut library = Library::new(library_path, mode)?;

if matches.opt_present("I") {
library.import(&import_settings);
Expand Down