-
Notifications
You must be signed in to change notification settings - Fork 78
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 clippy and tests fail due to simple problems #415
Changes from 6 commits
97da9e4
0a6644e
efadefc
88f7cf6
a41eb54
df1270a
7aece9f
2086f17
ec8e9be
16cb6e8
a378138
a99b27b
257e58b
8554cac
8ef3a04
ff4c61d
9c346d4
5918067
35f78f6
8fb764a
c082733
4c4f28f
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 |
---|---|---|
|
@@ -306,9 +306,17 @@ fn chunks(s: &str, width: usize, prefix: &str, suffix: &str) -> Vec<String> { | |
let _ = write!(&mut line, "{}", text_style.start()); | ||
|
||
while !text_slice.is_empty() { | ||
let available_space = width - line_width; | ||
let available_space = if width > line_width { | ||
width - line_width | ||
} else { | ||
list.push(line); | ||
line = String::with_capacity(width); | ||
line_width = 0; | ||
continue; | ||
}; | ||
|
||
let part_width = unicode_width::UnicodeWidthStr::width(text_slice); | ||
|
||
if part_width <= available_space { | ||
line.push_str(text_slice); | ||
line_width += part_width; | ||
|
@@ -1431,7 +1439,7 @@ mod tests { | |
"\u{1b}[37m(l\u{1b}[39m\u{1b}[37m\u{1b}[41marg\u{1b}[39m\u{1b}[49m\u{1b}[37mest \u{1b}[39m \n", | ||
"\u{1b}[37minteger \u{1b}[39m \n", | ||
"\u{1b}[37mless than \u{1b}[39m\n", | ||
"\u{1b}[37more equal \u{1b}[39m \n", | ||
"\u{1b}[37mor equal \u{1b}[39m \n", | ||
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. that's my fault, sorry folks 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've re-reviewed my previous At the same time, I fix newly found typos I hope you pardon my mistake and appreciate the |
||
"\u{1b}[37mto that \u{1b}[39m \n", | ||
"\u{1b}[37mnumber).\u{1b}[39m ", | ||
) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ pub fn parse_field_attributes( | |
} | ||
|
||
pub struct FieldAttr { | ||
#[allow(dead_code)] | ||
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. why choose to allow 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'd like to hear from @zhiburt on this. As for those 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.
correct;
Will be all right. |
||
pub ident: Ident, | ||
pub kind: FieldAttrKind, | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ pub fn parse_type_attributes( | |
} | ||
|
||
pub struct TypeAttr { | ||
#[allow(dead_code)] | ||
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. shouldn't we also remove this 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. Damn, missed it, thanks 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. that's what |
||
pub ident: Ident, | ||
pub kind: TypeAttrKind, | ||
} | ||
|
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.
We do not support formatting using complex expressions like
self.id[0]
so I simplified this code a bitThere 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.
That's actually one of my endless (not released patches) 😄
I did rewrite this support more then a few times.
I wonder what do you think in this regard.
Shall we support functions calls, array index etc?
Why I did rewrote it is cause it's impossible to support in inline enums 😞
And having 2 different approaches in 2 different places seeeems like not the right approach.
So anyway maybe you have some thoughts
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 do you mean by rewriting? What do we have now if this is not possible to implement for inline structs? Is this the same functionality I assumed for the test fix? If so, I'm sure that supporting more advanced formatting functionality is a good feature, but obviously, there are many complications that can affect the decision of whether it's worth implementing or not.
If you have patches that extend this functionality beyond the scope of the changed test, what should this test look like to test as much of
#[tabled(format()]
as possible?