Ralf Jung
d10366fe27
avoid unnecessary use of MaybeUninit::get_ref, and expand comment on the others
2019-02-22 23:05:58 +01:00
kennytm
a68a1c758d
Rollup merge of #58538 - GuillaumeGomez:fmt-examples, r=Centril
...
Add missing fmt structs examples
r? @rust-lang/docs
2019-02-20 11:58:52 +08:00
Guillaume Gomez
31ee20db3e
Add missing fmt structs examples
2019-02-19 11:20:00 +01:00
Mazdak Farrokhzad
c0d507d73b
Rollup merge of #58272 - fitzgen:num-format-code-size, r=Mark-Simulacrum
...
Cut down on number formating code size
r? @alexcrichton
2019-02-13 18:12:31 +01:00
Alexander Regueiro
99ed06eb88
libs: doc comments
2019-02-10 23:57:25 +00:00
Nick Fitzgerald
8fea7054b9
Use write_char for writing padding characters
...
Removes some unsafe *and* saves almost half a kilobyte of code size.
2019-02-08 10:07:08 +01:00
Nick Fitzgerald
c104b5c897
Also de-duplicate 32- and 64-bit number formatting on wasm32
2019-02-08 10:07:08 +01:00
Nick Fitzgerald
e633f15239
Un-monomorphize and inline formatting with padding
...
The generic `F` in `with_padding` was causing a bunch of stuff to get inlined
that otherwise needn't be, blowing up code size.
2019-02-07 15:01:30 +01:00
Nick Fitzgerald
ed2157a38f
De-duplicate write_prefix lambda in pad_integral
...
For smaller code size.
2019-02-07 13:02:27 +01:00
Nick Fitzgerald
da5a0cd69c
De-duplicate number formatting implementations for smaller code size
...
Instead of inlining the same logic into every number formatting implementation,
pull it out into a function that each of the number formatting impls call into.
2019-02-07 12:33:27 +01:00
Ralf Jung
6a52ca3fb4
rename first_mut_ptr -> first_ptr_mut
2019-01-28 12:37:29 +01:00
Ralf Jung
22a947f3aa
add macro for creating uninitialized array
2019-01-28 10:48:38 +01:00
Ralf Jung
a88414e007
libcore: avoid mem::uninitialized and raw ptr casts
2019-01-28 10:39:49 +01:00
Ralf Jung
c775c2fe96
libcore: remove unneeded allow(deprecated)
2019-01-28 10:39:49 +01:00
Mazdak Farrokhzad
e437861d27
Rollup merge of #57537 - sinkuu:fmt_perf, r=alexcrichton
...
Small perf improvement for fmt
Added benchmark is based on #10761
2019-01-22 12:20:23 +01:00
Mazdak Farrokhzad
286ce3c36a
Rollup merge of #57452 - steveklabnik:improve-formatter-docs, r=frewsxcv
...
Improve docs for Formatter
Some improvements to `std::fmt::Formatter` to make it a bit more consistent with other documentation, as well as calling out that you don't ever instantiate one yourself.
2019-01-19 19:41:20 +01:00
Shotaro Yamada
d7a7ce9edd
Utilize specialized zip iterator impl
...
name old ns/iter new ns/iter diff ns/iter diff % speedup
fmt::write_str_macro1 13,927 12,489 -1,438 -10.33% x 1.12
fmt::write_str_macro2 24,633 23,418 -1,215 -4.93% x 1.05
fmt::write_str_macro_debug 234,633 233,092 -1,541 -0.66% x 1.01
fmt::write_str_ref 5,819 5,823 4 0.07% x 1.00
fmt::write_str_value 6,012 5,828 -184 -3.06% x 1.03
fmt::write_vec_macro1 18,550 17,143 -1,407 -7.58% x 1.08
fmt::write_vec_macro2 30,369 28,920 -1,449 -4.77% x 1.05
fmt::write_vec_macro_debug 244,338 244,901 563 0.23% x 1.00
fmt::write_vec_ref 5,952 5,885 -67 -1.13% x 1.01
fmt::write_vec_value 5,944 5,894 -50 -0.84% x 1.01
2019-01-12 19:15:23 +09:00
Steve Klabnik
5fc6fc3d90
Improve docs for Formatter
2019-01-09 14:46:42 -05:00
Shotaro Yamada
12ae3651f8
Misc cleanups
2019-01-09 06:31:09 +09:00
Shotaro Yamada
f67124245c
Derive Clone for ArgumentV1
...
manual impl was a workaround for #28229 .
2019-01-06 15:33:42 +09:00
Shotaro Yamada
ddff2ed649
Remove unnecessary adapter
2019-01-06 15:33:11 +09:00
Mark Rousskov
2a663555dd
Remove licenses
2018-12-25 21:08:33 -07:00
Esteban Küber
33a34b06ac
Wording changes
2018-12-13 09:55:16 -08:00
Esteban Küber
c7f1b977ed
Suggest using .display() when trying to print a Path
2018-12-12 16:54:27 -08:00
ljedrz
d0c64bb296
cleanup: remove static lifetimes from consts
2018-12-04 12:46:10 +01:00
Ralf Jung
f4f8b211a8
let FIXME refer to tracking issue
2018-12-02 12:29:54 +01:00
Ralf Jung
a4f12344c6
add comments explaining our uses of get_ref/get_mut for MaybeUninit
2018-11-27 16:12:08 +01:00
Ralf Jung
44c135b6a9
use MaybeUninit in core::fmt
...
Code by @japaric, I just split it into individual commits
2018-11-23 22:50:20 +01:00
Tshepang Lekhonkhobe
af6c871fa1
doc: make core::fmt::Error example more simple
2018-10-13 19:28:18 +02:00
Scott McMurray
0a3bd9b6ab
Use impl_header_lifetime_elision in libcore
2018-09-29 21:33:35 -07:00
Ralf Jung
e37d6d37e7
Revert "Auto merge of #53508 - japaric:maybe-uninit, r=RalfJung"
...
This reverts commit c6e3d7fa31 , reversing
changes made to 4591a245c7 .
2018-09-29 09:50:50 +02:00
Jorge Aparicio
851acdd22d
core: fix deprecated warnings
2018-09-22 21:01:21 +02:00
kennytm
9dfb95b11f
Rollup merge of #53636 - frewsxcv:frewsxcv-nth, r=rkruppe
...
Prefer `.nth(n)` over `.skip(n).next()`.
Found by clippy.
2018-08-24 19:24:44 +08:00
Guillaume Gomez
2cc2e01e04
Add missing fmt examples
2018-08-23 20:20:58 +02:00
Corey Farwell
9e0ff24b6d
Prefer .nth(n) over .skip(n).next().
...
Found by clippy.
2018-08-23 09:35:49 -04:00
ljedrz
8646a17143
Enforce #![deny(bare_trait_objects)] in src/libcore
2018-07-25 10:21:41 +09:00
Zack M. Davis
057715557b
migrate codebase to ..= inclusive range patterns
...
These were stabilized in March 2018's #47813 , and are the Preferred Way
to Do It going forward (q.v. #51043 ).
2018-06-26 07:53:30 -07:00
Guillaume Gomez
804984836e
Reexport fmt::Alignment into std
2018-06-03 17:04:48 +02:00
Guillaume Gomez
fb447f118d
Stabilize Formatter alignment
2018-05-27 14:07:43 +02:00
Guillaume Gomez
6ff9409637
Add more missing examples for Formatter
2018-05-24 22:27:19 +02:00
Manish Goregaokar
6e49c837f6
Add explanation for #[must_use] on Debug builders
2018-05-07 10:26:28 -07:00
Kornel
1e38eee63b
Suggest more helpful formatting string
2018-05-05 11:50:02 +01:00
Guillaume Gomez
30e3f1a620
Add more doc aliases
2018-04-26 12:56:10 +02:00
Felix S. Klock II
fadabd6fbb
Revert stabilization of feature(never_type).
...
This commit is just covering the feature gate itself and the tests
that made direct use of `!` and thus need to opt back into the
feature.
A follow on commit brings back the other change that motivates the
revert: Namely, going back to the old rules for falling back to `()`.
2018-04-20 18:09:28 +02:00
Alex Crichton
2bb5b5c07c
core: Remove an implicit panic from Formatter::pad
...
The expression `&s[..i]` in general can panic if `i` is out of bounds or not on
a character boundary for a string, and this caused the codegen for
`Formatter::pad` to be a bit larger than it otherwise needed to be. This commit
replaces this with `s.get(..i).unwrap_or(&s)` which while having different
behavior if `i` is out of bounds has a much smaller code footprint and otherwise
avoids the need for `unsafe` code.
2018-04-13 07:04:24 -07:00
Alex Burka
93a3e93bf3
tweak fmt::Arguments docs
...
Remove an outdated claim about passing something or other to a function. Also swap the variable names in the example.
2018-04-03 09:11:41 -04:00
Tim Neumann
fc9dfda6ad
Rollup merge of #49103 - glandium:uninitialized, r=cramertj
...
Use an uninitialized buffer in GenericRadix::fmt_int, like in Display::fmt for numeric types
The code using a slice of that buffer is only ever going to use
bytes that are subsequently initialized.
2018-03-26 15:14:56 +02:00
kennytm
8c1535f115
Rollup merge of #49229 - Centril:doc/format_args_display_debug, r=steveklabnik
...
Document format_args! / Arguments<'a> behavior wrt. Display and Debug
This is a follow up PR to #49067 , this documents the behavior of `format_args!` (i.e: `Argument<'a>`) wrt. `Display` and `Debug`.
r? @steveklabnik
2018-03-25 01:26:37 +08:00
Alex Crichton
db2dde9a41
Rollup merge of #49102 - glandium:decimal, r=aturon
...
Remove core::fmt::num::Decimal
Before ebf9e1aaf6 , it was used for Display::fmt, but ebf9e1aaf6 replaced
that with a faster implementation, and nothing else uses it.
2018-03-23 10:16:09 -07:00
Mazdak Farrokhzad
613fb8bc2c
document format_args! - fix trailing whitespace
2018-03-22 10:06:17 +01:00