-
Notifications
You must be signed in to change notification settings - Fork 342
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
Fix some clippy warnings #948
base: main
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 |
---|---|---|
|
@@ -80,7 +80,7 @@ enum State { | |
|
||
impl ReadDir { | ||
/// Creates an asynchronous `ReadDir` from a synchronous handle. | ||
pub(crate) fn new(inner: std::fs::ReadDir) -> ReadDir { | ||
pub(crate) const fn new(inner: std::fs::ReadDir) -> ReadDir { | ||
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. Can this even be const? Even 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. I'm not sure I understand your reasoning here |
||
ReadDir(State::Idle(Some(inner))) | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -485,7 +485,7 @@ mod tests { | |
#[test] | ||
fn test_read_by_ref() { | ||
crate::task::block_on(async { | ||
let mut f = io::Cursor::new(vec![0u8, 1, 2, 3, 4, 5, 6, 7, 8]); | ||
let mut f = io::Cursor::new(vec![0_u8, 1, 2, 3, 4, 5, 6, 7, 8]); | ||
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. This seems like churn... 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. Just more readable, and idiomatic/conventional to have an underscore in Rust. I agree that its not strictly necessary at all |
||
let mut buffer = Vec::new(); | ||
let mut other_buffer = Vec::new(); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,7 +67,7 @@ where | |
let this = self.project(); | ||
match this.future.poll(cx) { | ||
Poll::Pending => {} | ||
other => return other, | ||
other @ Poll::Ready(..) => return other, | ||
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. Unnecessary, if 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. I think the goal here is to make clearer to readers that the only possibility is |
||
} | ||
|
||
if this.timeout.poll(cx).is_ready() { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ use crate::path::Path; | |
/// | ||
/// [`ancestors`]: struct.Path.html#method.ancestors | ||
/// [`Path`]: struct.Path.html | ||
#[derive(Copy, Clone, Debug)] | ||
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. This is a breaking change. What is the reasoning? 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. I think this might have been a mistake, I'll revert. |
||
#[derive(Clone, Debug)] | ||
pub struct Ancestors<'a> { | ||
pub(crate) next: Option<&'a Path>, | ||
} | ||
|
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.
What is the benefit of making this const?
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.
The benefit of making this const is that
DirBuilder::new
can now be used in const declarations, as well as anything that depends on it also now has a chance to be made const.