mirror of
https://github.com/hannobraun/Fornjot
synced 2025-06-17 08:48:58 +00:00
remove unused 'self' parameters
This commit is contained in:
parent
70bfdf5698
commit
de34df777b
@ -7,7 +7,7 @@ use crate::parse::{
|
||||
};
|
||||
|
||||
impl Initializer {
|
||||
fn register(&self) -> TokenStream {
|
||||
fn register() -> TokenStream {
|
||||
quote! {
|
||||
const _: () = {
|
||||
fj::register_model!(|host| {
|
||||
@ -30,13 +30,13 @@ impl ToTokens for Initializer {
|
||||
fn to_tokens(&self, tokens: &mut TokenStream) {
|
||||
let Self { model } = self;
|
||||
|
||||
tokens.extend(self.register());
|
||||
tokens.extend(Self::register());
|
||||
model.to_tokens(tokens);
|
||||
}
|
||||
}
|
||||
|
||||
impl Model {
|
||||
fn definition(&self) -> TokenStream {
|
||||
fn definition() -> TokenStream {
|
||||
quote! { struct Model; }
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ impl Model {
|
||||
|
||||
impl ToTokens for Model {
|
||||
fn to_tokens(&self, tokens: &mut TokenStream) {
|
||||
tokens.extend(self.definition());
|
||||
tokens.extend(Self::definition());
|
||||
tokens.extend(self.trait_implementation());
|
||||
}
|
||||
}
|
||||
|
@ -4,40 +4,26 @@ use crate::camera::{Camera, FocusPoint};
|
||||
/// Input handling abstraction
|
||||
///
|
||||
/// Takes user input and applies them to application state.
|
||||
pub struct InputHandler {
|
||||
movement: Movement,
|
||||
rotation: Rotation,
|
||||
zoom: Zoom,
|
||||
}
|
||||
#[derive(Default)]
|
||||
pub struct InputHandler;
|
||||
|
||||
impl InputHandler {
|
||||
/// Handle an input event
|
||||
pub fn handle_event(
|
||||
&mut self,
|
||||
event: InputEvent,
|
||||
focus_point: FocusPoint,
|
||||
camera: &mut Camera,
|
||||
) {
|
||||
match event {
|
||||
InputEvent::Translation { previous, current } => {
|
||||
self.movement.apply(previous, current, focus_point, camera);
|
||||
Movement::apply(previous, current, focus_point, camera);
|
||||
}
|
||||
InputEvent::Rotation { angle_x, angle_y } => {
|
||||
self.rotation.apply(angle_x, angle_y, focus_point, camera);
|
||||
Rotation::apply(angle_x, angle_y, focus_point, camera);
|
||||
}
|
||||
InputEvent::Zoom(zoom_delta) => {
|
||||
self.zoom.apply(zoom_delta, focus_point, camera);
|
||||
Zoom::apply(zoom_delta, focus_point, camera);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for InputHandler {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
movement: Movement,
|
||||
rotation: Rotation,
|
||||
zoom: Zoom,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ pub struct Movement;
|
||||
|
||||
impl Movement {
|
||||
pub fn apply(
|
||||
&mut self,
|
||||
previous: NormalizedScreenPosition,
|
||||
current: NormalizedScreenPosition,
|
||||
focus_point: FocusPoint,
|
||||
|
@ -6,7 +6,6 @@ pub struct Rotation;
|
||||
|
||||
impl Rotation {
|
||||
pub fn apply(
|
||||
&self,
|
||||
angle_x: f64,
|
||||
angle_y: f64,
|
||||
focus_point: FocusPoint,
|
||||
|
@ -6,7 +6,6 @@ pub struct Zoom;
|
||||
|
||||
impl Zoom {
|
||||
pub fn apply(
|
||||
&mut self,
|
||||
zoom_delta: f64,
|
||||
focus_point: FocusPoint,
|
||||
camera: &mut Camera,
|
||||
|
@ -88,11 +88,7 @@ impl Viewer {
|
||||
/// Handle an input event
|
||||
pub fn handle_input_event(&mut self, event: InputEvent) {
|
||||
if let Some(focus_point) = self.focus_point {
|
||||
self.input_handler.handle_event(
|
||||
event,
|
||||
focus_point,
|
||||
&mut self.camera,
|
||||
);
|
||||
InputHandler::handle_event(event, focus_point, &mut self.camera);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ impl Release {
|
||||
"Could not find a pull request with hash {sha} and label \
|
||||
{label}",
|
||||
);
|
||||
return self.miss();
|
||||
return Self::miss();
|
||||
}
|
||||
|
||||
let commit: String = cmd_lib::run_fun!(git log -n 1 "${sha}")?;
|
||||
@ -47,18 +47,18 @@ impl Release {
|
||||
let version = find_version_in_str(&commit)?;
|
||||
|
||||
match version {
|
||||
Some(v) => self.hit(&v.to_string()),
|
||||
Some(v) => Self::hit(&v.to_string()),
|
||||
None => {
|
||||
log::info!(
|
||||
"Commit message is missing version number:\n\
|
||||
{commit}",
|
||||
);
|
||||
self.miss()
|
||||
Self::miss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn hit(&self, tag: &str) -> anyhow::Result<()> {
|
||||
fn hit(tag: &str) -> anyhow::Result<()> {
|
||||
let tag = format!("v{tag}");
|
||||
log::info!("detected release of {tag}");
|
||||
|
||||
@ -70,7 +70,7 @@ impl Release {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn miss(&self) -> anyhow::Result<()> {
|
||||
fn miss() -> anyhow::Result<()> {
|
||||
log::info!("no release detected");
|
||||
Actions::set_output([(Outputs::ReleaseDetected, "false")])?;
|
||||
Ok(())
|
||||
|
Loading…
Reference in New Issue
Block a user