-
Notifications
You must be signed in to change notification settings - Fork 19
Apply Clippy fixes #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -95,7 +95,7 @@ pub struct Menu { | |
| /// The items, separators, and submenus in this menu | ||
| /// | ||
| /// Each item is in a Box, to allow callbacks to reference it. | ||
| children: RefCell<Vec<Box<Item>>>, | ||
| children: RefCell<Vec<Item>>, | ||
|
Comment on lines
97
to
+98
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comment above this line indicates that there was a reason for this additional boxing, although I do not entirely get what this comment wants to tell me... |
||
| /// The status of this menu | ||
| state: Cell<MenuState>, | ||
| } | ||
|
|
@@ -139,7 +139,7 @@ impl Menu { | |
| Rc<C>: Into<Item>, | ||
| { | ||
| let mut borrow = self.children.borrow_mut(); | ||
| borrow.push(Box::new(child.into().into())); | ||
| borrow.push(child.into().into()); | ||
| } | ||
|
|
||
| /// Adds this menu as a child of the plugins menu | ||
|
|
@@ -370,7 +370,7 @@ impl ActionItem { | |
|
|
||
| fn handle_click(&self) { | ||
| let mut borrow = self.handler.borrow_mut(); | ||
| borrow.item_clicked(&self); | ||
| borrow.item_clicked(self); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,9 +8,10 @@ use xplm_sys; | |
| use super::geometry::{Point, Rect}; | ||
|
|
||
| /// Cursor states that windows can apply | ||
| #[derive(Debug, Clone)] | ||
| #[derive(Debug, Clone, Default)] | ||
| pub enum Cursor { | ||
| /// X-Plane draws the default cursor | ||
| #[default] | ||
| Default, | ||
| /// X-Plane draws an arrow cursor (not any other cursor type) | ||
| Arrow, | ||
|
|
@@ -29,12 +30,6 @@ impl Cursor { | |
| } | ||
| } | ||
|
|
||
| impl Default for Cursor { | ||
| fn default() -> Self { | ||
| Cursor::Default | ||
| } | ||
| } | ||
|
|
||
| /// Trait for things that can define the behavior of a window | ||
| pub trait WindowDelegate: 'static { | ||
| /// Draws this window | ||
|
|
@@ -95,6 +90,8 @@ impl Window { | |
| /// Creates a new window with the provided geometry and returns a reference to it | ||
| /// | ||
| /// The window is originally not visible. | ||
| // TODO: determine if Clippy warning about `new` not returning `self` is applicable | ||
| #[allow(clippy::new_ret_no_self)] | ||
| pub fn new<R: Into<Rect<i32>>, D: WindowDelegate>(geometry: R, delegate: D) -> WindowRef { | ||
|
Comment on lines
+93
to
95
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should probably rename this function to |
||
| let geometry = geometry.into(); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably this should be renamed to
as_xplm