Skip to content
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

Rollup of 10 pull requests #77867

Merged
merged 23 commits into from
Oct 12, 2020
Merged
Changes from 3 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
536674f
cleanup WithOptConstParam queries
lcnr Oct 4, 2020
8160bfa
query_name_of_opt_const_arg -> query_name_opt_const_arg
lcnr Oct 5, 2020
ce45b4f
Remove unused class rule
GuillaumeGomez Oct 8, 2020
8d2c622
Implement `AsRawFd` for `StdinLock` etc. on WASI.
sunfishcode Oct 8, 2020
d5b7143
Fix intra-docs link
aDotInTheVoid Oct 10, 2020
0a2a68e
Use range instead of tuple of ints
bugadani Oct 10, 2020
83c790f
Make some functions private that don't need to be public
jyn514 Oct 11, 2020
e533bb7
Don't duplicate char::is_ascii_digit
LingMan Sep 23, 2020
a56b0e9
Simplify using is_ascii_alphabetic and is_ascii_alphanumeric
LingMan Sep 23, 2020
d7494af
Mostly print statements to see where things are
winnsterx Oct 6, 2020
5d44402
update url in bootstrap README
12101111 Oct 12, 2020
9f1048d
Add word-wrap rule for short descriptions
GuillaumeGomez Oct 8, 2020
cabedfe
Remove `mark-i-m` from rustc-dev-guide maintainers
JohnTitor Oct 12, 2020
687d764
Rollup merge of #77550 - lcnr:ty-dep-path-ct-cleanup, r=ecstatic-morse
JohnTitor Oct 12, 2020
a6cc660
Rollup merge of #77699 - GuillaumeGomez:word-wrap, r=XAMPPRocky
JohnTitor Oct 12, 2020
ad6e179
Rollup merge of #77724 - sunfishcode:stdinlock-asrawfd, r=alexcrichton
JohnTitor Oct 12, 2020
dde9977
Rollup merge of #77746 - winnayx:issue-77572-fix, r=jyn514
JohnTitor Oct 12, 2020
71d8c10
Rollup merge of #77784 - aDotInTheVoid:ffi-sealed_trait-intra-docs, r…
JohnTitor Oct 12, 2020
fe0d5b6
Rollup merge of #77811 - jyn514:private, r=GuillaumeGomez
JohnTitor Oct 12, 2020
233319f
Rollup merge of #77818 - bugadani:range, r=oli-obk
JohnTitor Oct 12, 2020
e40ae08
Rollup merge of #77831 - LingMan:use_std, r=jonas-schievink
JohnTitor Oct 12, 2020
93ec29b
Rollup merge of #77852 - 12101111:fix-bootstrap-doc, r=jonas-schievink
JohnTitor Oct 12, 2020
984f78b
Rollup merge of #77863 - JohnTitor:remove-mark-i-m, r=pietroalbini
JohnTitor Oct 12, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 10 additions & 23 deletions compiler/rustc_builtin_macros/src/format_foreign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ pub mod printf {
if let Start = state {
match c {
'1'..='9' => {
let end = at_next_cp_while(next, is_digit);
let end = at_next_cp_while(next, char::is_ascii_digit);
match end.next_cp() {
// Yes, this *is* the parameter.
Some(('$', end2)) => {
Expand Down Expand Up @@ -427,7 +427,7 @@ pub mod printf {
move_to!(next);
}
'1'..='9' => {
let end = at_next_cp_while(next, is_digit);
let end = at_next_cp_while(next, char::is_ascii_digit);
state = Prec;
width = Some(Num::from_str(at.slice_between(end).unwrap(), None));
move_to!(end);
Expand All @@ -441,7 +441,7 @@ pub mod printf {
}

if let WidthArg = state {
let end = at_next_cp_while(at, is_digit);
let end = at_next_cp_while(at, char::is_ascii_digit);
match end.next_cp() {
Some(('$', end2)) => {
state = Prec;
Expand Down Expand Up @@ -473,7 +473,7 @@ pub mod printf {
if let PrecInner = state {
match c {
'*' => {
let end = at_next_cp_while(next, is_digit);
let end = at_next_cp_while(next, char::is_ascii_digit);
match end.next_cp() {
Some(('$', end2)) => {
state = Length;
Expand All @@ -488,7 +488,7 @@ pub mod printf {
}
}
'0'..='9' => {
let end = at_next_cp_while(next, is_digit);
let end = at_next_cp_while(next, char::is_ascii_digit);
state = Length;
precision = Some(Num::from_str(at.slice_between(end).unwrap(), None));
move_to!(end);
Expand Down Expand Up @@ -563,12 +563,12 @@ pub mod printf {

fn at_next_cp_while<F>(mut cur: Cur<'_>, mut pred: F) -> Cur<'_>
where
F: FnMut(char) -> bool,
F: FnMut(&char) -> bool,
{
loop {
match cur.next_cp() {
Some((c, next)) => {
if pred(c) {
if pred(&c) {
cur = next;
} else {
return cur;
Expand All @@ -579,14 +579,7 @@ pub mod printf {
}
}

fn is_digit(c: char) -> bool {
match c {
'0'..='9' => true,
_ => false,
}
}

fn is_flag(c: char) -> bool {
fn is_flag(c: &char) -> bool {
match c {
'0' | '-' | '+' | ' ' | '#' | '\'' => true,
_ => false,
Expand Down Expand Up @@ -723,17 +716,11 @@ pub mod shell {
}

fn is_ident_head(c: char) -> bool {
match c {
'a'..='z' | 'A'..='Z' | '_' => true,
_ => false,
}
c.is_ascii_alphabetic() || c == '_'
}

fn is_ident_tail(c: char) -> bool {
match c {
'0'..='9' => true,
c => is_ident_head(c),
}
c.is_ascii_alphanumeric() || c == '_'
}

#[cfg(test)]
Expand Down