Skip to content

Conversation

alocquet
Copy link
Contributor

fix #370

let new_width = r.width.max(width);
let new_height = r.height.max(height);
/// makes sure Rect `r` at least stays as big as min and not bigger than max
pub fn rect_inside(min: &Size, max: &Size, r: Rect) -> Rect {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these params do not need to be borrowed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have borrowed it because of clippy. I don't remember why. I'll check

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error: this argument is passed by value, but not consumed in the function body
--> src/ui/mod.rs:75:25
|
75 | pub fn rect_inside(min: Size, max: Size, r: Rect) -> Rect {
| ^^^^ help: consider taking a reference instead: &Size
|
note: the lint level is defined here
--> src/main.rs:4:9
|
4 | #![deny(clippy::pedantic)]
| ^^^^^^^^^^^^^^^^
= note: #[deny(clippy::needless_pass_by_value)] implied by #[deny(clippy::pedantic)]
help: consider marking this type as Copy

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

damn you clippy :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alocquet the important tip is at the bottom btw.: help: consider marking this type as Copy see 6df98ad

@extrawurst extrawurst merged commit 603fd75 into gitui-org:master Oct 27, 2020
@extrawurst
Copy link
Collaborator

@alocquet thanks man! hope you don't stop now that you have hacktoberfest fulfilled :P

@alocquet
Copy link
Contributor Author

I will have less time because I'm starting a new job next week. But I'll try to continue working on gitui.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

panic on small terminal when textinput for stash name is open

2 participants