chore: updating newfound lints
This commit is contained in:
parent
e9c809bf28
commit
485497973f
2 changed files with 264 additions and 270 deletions
|
|
@ -17,7 +17,7 @@ use winit::{
|
|||
fn main() {
|
||||
env_logger::init();
|
||||
|
||||
let path = env::args().nth(1).unwrap_or(String::new());
|
||||
let path = env::args().nth(1).unwrap_or_default();
|
||||
|
||||
let event_loop = EventLoop::new().unwrap();
|
||||
let window = Rc::new(WindowBuilder::new().build(&event_loop).unwrap());
|
||||
|
|
@ -71,8 +71,10 @@ fn main() {
|
|||
.run(|event, elwt| {
|
||||
elwt.set_control_flow(ControlFlow::Wait);
|
||||
|
||||
match event {
|
||||
Event::WindowEvent { window_id, event } => {
|
||||
let Event::WindowEvent { window_id, event } = event else {
|
||||
return;
|
||||
};
|
||||
|
||||
match event {
|
||||
WindowEvent::ScaleFactorChanged { scale_factor, .. } => {
|
||||
log::info!("Updated scale factor for {window_id:?}");
|
||||
|
|
@ -115,16 +117,17 @@ fn main() {
|
|||
)
|
||||
});
|
||||
|
||||
let mut paint = Paint::default();
|
||||
paint.anti_alias = false;
|
||||
let mut paint = Paint {
|
||||
anti_alias: false,
|
||||
..Default::default()
|
||||
};
|
||||
editor.shape_as_needed(true);
|
||||
editor.draw(&mut swash_cache, |x, y, w, h, color| {
|
||||
// Note: due to softbuffer and tiny_skia having incompatible internal color representations we swap
|
||||
// the red and blue channels here
|
||||
paint.set_color_rgba8(color.b(), color.g(), color.r(), color.a());
|
||||
pixmap.fill_rect(
|
||||
Rect::from_xywh(x as f32, y as f32, w as f32, h as f32)
|
||||
.unwrap(),
|
||||
Rect::from_xywh(x as f32, y as f32, w as f32, h as f32).unwrap(),
|
||||
&paint,
|
||||
Transform::identity(),
|
||||
None,
|
||||
|
|
@ -198,9 +201,7 @@ fn main() {
|
|||
Key::Named(NamedKey::Home) => {
|
||||
editor.action(Action::Motion(Motion::Home))
|
||||
}
|
||||
Key::Named(NamedKey::End) => {
|
||||
editor.action(Action::Motion(Motion::End))
|
||||
}
|
||||
Key::Named(NamedKey::End) => editor.action(Action::Motion(Motion::End)),
|
||||
Key::Named(NamedKey::PageUp) => {
|
||||
editor.action(Action::Motion(Motion::PageUp))
|
||||
}
|
||||
|
|
@ -209,9 +210,7 @@ fn main() {
|
|||
}
|
||||
Key::Named(NamedKey::Escape) => editor.action(Action::Escape),
|
||||
Key::Named(NamedKey::Enter) => editor.action(Action::Enter),
|
||||
Key::Named(NamedKey::Backspace) => {
|
||||
editor.action(Action::Backspace)
|
||||
}
|
||||
Key::Named(NamedKey::Backspace) => editor.action(Action::Backspace),
|
||||
Key::Named(NamedKey::Delete) => editor.action(Action::Delete),
|
||||
Key::Named(key) => {
|
||||
if let Some(text) = key.to_text() {
|
||||
|
|
@ -227,8 +226,7 @@ fn main() {
|
|||
font_size_i = font_size_default;
|
||||
editor.with_buffer_mut(|buffer| {
|
||||
buffer.set_metrics(
|
||||
font_sizes[font_size_i]
|
||||
.scale(display_scale),
|
||||
font_sizes[font_size_i].scale(display_scale),
|
||||
)
|
||||
});
|
||||
}
|
||||
|
|
@ -310,9 +308,7 @@ fn main() {
|
|||
button,
|
||||
} => {
|
||||
if button == MouseButton::Left {
|
||||
if state == ElementState::Pressed
|
||||
&& mouse_left == ElementState::Released
|
||||
{
|
||||
if state == ElementState::Pressed && mouse_left == ElementState::Released {
|
||||
editor.action(Action::Click {
|
||||
x: mouse_x as i32,
|
||||
y: mouse_y as i32,
|
||||
|
|
@ -347,9 +343,6 @@ fn main() {
|
|||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
})
|
||||
.unwrap();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1249,7 +1249,8 @@ impl ShapeLine {
|
|||
let trailing_blank = span
|
||||
.words
|
||||
.get(i + 1)
|
||||
.map_or(false, |previous_word| previous_word.blank);
|
||||
.is_some_and(|previous_word| previous_word.blank);
|
||||
|
||||
if trailing_blank {
|
||||
number_of_blanks = number_of_blanks.saturating_sub(1);
|
||||
add_to_visual_line(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue