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