Commit Graph

38 Commits

Author SHA1 Message Date
Mark Rousskov a06baa56b9 Format the world 2019-12-22 17:42:47 -05:00
Ashley Mannix 959a6c1ca8 move debug_map assertions after check for err 2019-10-10 10:01:47 +10:00
Matthew Jasper 0280e8ffcc Make fmt-internal functions private 2019-08-17 08:59:36 +01:00
Ashley Mannix 70d630fd5a add feature to docs 2019-07-09 08:30:20 +10:00
Ashley Mannix e98ea52762 add key and value methods to DebugMap 2019-07-08 09:56:02 +10:00
Mazdak Farrokhzad dbfbadeac4 libcore: deny more... 2019-04-19 01:37:12 +02:00
Taiki Endo 360432f1e8 libcore => 2018 2019-04-18 14:47:35 +09:00
David Tolnay cfd31fb4df
Include trailing comma in multiline Debug representation
This commit changes the behavior of Formatter::debug_struct,
debug_tuple, debug_list, debug_set, and debug_map to render trailing
commas in {:#?} mode, which is the dominant style in modern Rust code.

Before:

    Language {
        name: "Rust",
        trailing_commas: false
    }

After:

    Language {
        name: "Rust",
        trailing_commas: true,
    }
2019-04-05 06:45:40 -07:00
Guillaume Gomez 31ee20db3e Add missing fmt structs examples 2019-02-19 11:20:00 +01:00
Mark Rousskov 2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Scott McMurray 0a3bd9b6ab Use impl_header_lifetime_elision in libcore 2018-09-29 21:33:35 -07:00
ljedrz 8646a17143 Enforce #![deny(bare_trait_objects)] in src/libcore 2018-07-25 10:21:41 +09:00
Manish Goregaokar 6e49c837f6 Add explanation for #[must_use] on Debug builders 2018-05-07 10:26:28 -07:00
Simon Sapin bf08789510 Keep access to private Formatter fields in Formatter methods 2017-11-27 14:37:40 +01:00
Simon Sapin e0e7ac37b2 Make fmt::DebugList and friends forward formatting parameters
For example, formatting slice of integers with `{:04?}`
should zero-pad each integer.
2017-11-24 14:17:31 +01:00
Tamir Duberstein 19dcf9190c
fmt: DRY 2017-10-07 05:48:21 -04:00
lukaramu 49ee9f3f08 Fix inconsistent doc headings
This fixes headings reading "Unsafety" and "Example", they should be
"Safety" and "Examples" according to RFC 1574.
2017-08-24 18:42:53 +02:00
Zack M. Davis 1b6c9605e4 use field init shorthand EVERYWHERE
Like #43008 (f668999), but _much more aggressive_.
2017-08-15 15:29:17 -07:00
Ryan Thomas d1316b468f Add docs for Debug* structs. #29355
This adds docs for the Debug* structs as well as examples from the
Formatter::debug_* methods, so that a user knows how to construct them.

I added these examples as the builders module is not public and hence
the debug_*_new() functions are not available to a user.

r? @steveklabnik

Review comments.

Mainly adding in the links for all of the structs and functions.

Remove rust tag on code blocks.
2017-07-02 17:42:02 +01:00
Jeffrey Seyfried e2ad3be178 Use `#[prelude_import]` in `libcore`. 2016-08-24 22:12:23 +00:00
Seo Sanghyeon 01fb27f648 Remove unused trait imports 2016-04-12 22:58:55 +09:00
Jorge Aparicio 0f02309e4b try! -> ?
Automated conversion using the untry tool [1] and the following command:

```
$ find -name '*.rs' -type f | xargs untry
```

at the root of the Rust repo.

[1]: https://github.com/japaric/untry
2016-03-22 22:01:37 -05:00
Sean McArthur e0945937c4 libcore: add Debug implementations to most missing types 2016-03-20 10:04:55 -07:00
Alex Crichton b53764c73b std: Clean out deprecated APIs
Removes all unstable and deprecated APIs prior to the 1.8 release. All APIs that
are deprecated in the 1.8 release are sticking around for the rest of this
cycle.

Some notable changes are:

* The `dynamic_lib` module was moved into `rustc_back` as the compiler still
  relies on a few bits and pieces.
* The `DebugTuple` formatter now special-cases an empty struct name with only
  one field to append a trailing comma.
2016-03-12 12:31:13 -08:00
Alex Crichton 9a4f43b9b6 std: Stabilize APIs for the 1.7 release
This commit stabilizes and deprecates the FCP (final comment period) APIs for
the upcoming 1.7 beta release. The specific APIs which changed were:

Stabilized

* `Path::strip_prefix` (renamed from `relative_from`)
* `path::StripPrefixError` (new error type returned from `strip_prefix`)
* `Ipv4Addr::is_loopback`
* `Ipv4Addr::is_private`
* `Ipv4Addr::is_link_local`
* `Ipv4Addr::is_multicast`
* `Ipv4Addr::is_broadcast`
* `Ipv4Addr::is_documentation`
* `Ipv6Addr::is_unspecified`
* `Ipv6Addr::is_loopback`
* `Ipv6Addr::is_unique_local`
* `Ipv6Addr::is_multicast`
* `Vec::as_slice`
* `Vec::as_mut_slice`
* `String::as_str`
* `String::as_mut_str`
* `<[T]>::clone_from_slice` - the `usize` return value is removed
* `<[T]>::sort_by_key`
* `i32::checked_rem` (and other signed types)
* `i32::checked_neg` (and other signed types)
* `i32::checked_shl` (and other signed types)
* `i32::checked_shr` (and other signed types)
* `i32::saturating_mul` (and other signed types)
* `i32::overflowing_add` (and other signed types)
* `i32::overflowing_sub` (and other signed types)
* `i32::overflowing_mul` (and other signed types)
* `i32::overflowing_div` (and other signed types)
* `i32::overflowing_rem` (and other signed types)
* `i32::overflowing_neg` (and other signed types)
* `i32::overflowing_shl` (and other signed types)
* `i32::overflowing_shr` (and other signed types)
* `u32::checked_rem` (and other unsigned types)
* `u32::checked_neg` (and other unsigned types)
* `u32::checked_shl` (and other unsigned types)
* `u32::saturating_mul` (and other unsigned types)
* `u32::overflowing_add` (and other unsigned types)
* `u32::overflowing_sub` (and other unsigned types)
* `u32::overflowing_mul` (and other unsigned types)
* `u32::overflowing_div` (and other unsigned types)
* `u32::overflowing_rem` (and other unsigned types)
* `u32::overflowing_neg` (and other unsigned types)
* `u32::overflowing_shl` (and other unsigned types)
* `u32::overflowing_shr` (and other unsigned types)
* `ffi::IntoStringError`
* `CString::into_string`
* `CString::into_bytes`
* `CString::into_bytes_with_nul`
* `From<CString> for Vec<u8>`
* `From<CString> for Vec<u8>`
* `IntoStringError::into_cstring`
* `IntoStringError::utf8_error`
* `Error for IntoStringError`

Deprecated

* `Path::relative_from` - renamed to `strip_prefix`
* `Path::prefix` - use `components().next()` instead
* `os::unix::fs` constants - moved to the `libc` crate
* `fmt::{radix, Radix, RadixFmt}` - not used enough to stabilize
* `IntoCow` - conflicts with `Into` and may come back later
* `i32::{BITS, BYTES}` (and other integers) - not pulling their weight
* `DebugTuple::formatter` - will be removed
* `sync::Semaphore` - not used enough and confused with system semaphores

Closes #23284
cc #27709 (still lots more methods though)
Closes #27712
Closes #27722
Closes #27728
Closes #27735
Closes #27729
Closes #27755
Closes #27782
Closes #27798
2016-01-16 11:03:10 -08:00
Michael Pankov 17033a62b4 rustfmt part of libcore/fmt
Rest is blocked by https://github.com/nrc/rustfmt/issues/413
2015-10-08 01:02:45 +03:00
Alex Crichton b7dcf272d9 core: Fill out issues for unstable features 2015-08-15 18:09:16 -07:00
Alex Crichton 5cccf3cd25 syntax: Implement #![no_core]
This commit is an implementation of [RFC 1184][rfc] which tweaks the behavior of
the `#![no_std]` attribute and adds a new `#![no_core]` attribute. The
`#![no_std]` attribute now injects `extern crate core` at the top of the crate
as well as the libcore prelude into all modules (in the same manner as the
standard library's prelude). The `#![no_core]` attribute disables both std and
core injection.

[rfc]: https://github.com/rust-lang/rfcs/pull/1184
2015-08-03 17:23:01 -07:00
Steven Fackler b0ab164b80 Add trailing , for 1-tuples 2015-07-10 11:03:52 -08:00
Steven Fackler e161d5cf73 Stabilize debug builders for 1.2.0 2015-05-19 21:57:39 -07:00
Steven Fackler fb526cf3a1 Fix finish docs 2015-05-17 18:09:35 -07:00
Steven Fackler bd85983d05 Make debug builders take &mut self, add entries method
[breaking-change]
2015-05-17 17:33:29 -07:00
Steven Fackler 4037f2a368 Update debug helpers and add list builder
The collections debug helpers no longer prefix output with the
collection name, in line with the current conventions for Debug
implementations. Implementations that want to preserve the current
behavior can simply add a `try!(write!(fmt, "TypeName "));` at the
beginning of the `fmt` method.

[breaking-change]
2015-03-28 10:33:51 -07:00
Steven Fackler 905a611b94 Switch to a specific feature 2015-03-11 12:58:01 -07:00
Steven Fackler 4181d43c4b Remove inline silliness from debug builders
Turns out it's basically a wash, codegen wise.
2015-03-10 21:33:04 -07:00
Steven Fackler bd6ed22fdf Switch derive(Debug) to use the debug builders 2015-03-09 23:24:34 -07:00
Steven Fackler 8121cf077c Restructure debug builders to minimize codegen
Switching from generic bounds to trait objects and having un-inlined
inner methods should cut down on the size of Debug impls, since we care
about the speed of a Debug implementation way less than binary bloat.
2015-03-09 23:24:34 -07:00
Steven Fackler e3656bd81b Implement RFC 640 2015-03-09 23:24:34 -07:00