2376 Commits

Author SHA1 Message Date
Corey Farwell
eb6f09ce24 Rollup merge of #40790 - stepancheg:btreemap-drop, r=alexcrichton
Unnecessary iteration in BTreeMap::drop

`IntoIter::drop` already iterates.
2017-03-24 18:13:14 -05:00
Stepan Koltsov
f97b3f08cd Unnecessary iteration in BTreeMap::drop
`IntoIter::drop` already iterates.
2017-03-24 06:18:23 +03:00
Stjepan Glavina
49c408e679 Fix markdown links to pdqsort 2017-03-23 12:20:13 +01:00
Stjepan Glavina
b7a3d46efa Add 'the' before 'start'/'end' 2017-03-22 18:42:42 +01:00
Stjepan Glavina
d6da1d9b46 Various fixes to wording consistency in the docs 2017-03-22 17:19:52 +01:00
Stjepan Glavina
c4454a5507 Tweak the constants a bit 2017-03-21 20:46:20 +01:00
Stjepan Glavina
f0e5868627 Fix a doctest 2017-03-21 20:46:20 +01:00
Stjepan Glavina
e365974750 Address Alex's PR comments 2017-03-21 20:46:20 +01:00
Stjepan Glavina
f1913e2a30 Implement feature sort_unstable 2017-03-21 20:46:20 +01:00
Corey Farwell
e5221f9397 Rollup merge of #40241 - Sawyer47:fix-39997, r=alexcrichton
Change how the `0` flag works in format!

Now it always implies right-alignment, so that padding zeroes are placed after the sign (if any) and before the digits. In other words, it always takes precedence over explicitly specified `[[fill]align]`. This also affects the '#' flag: zeroes are placed after the prefix (0b, 0o, 0x) and before the digits.

Here's a short summary of how similar format strings work in Python and Rust:

```
              :05     :<05    :>05    :^05
Python 3.6  |-0001| |-1000| |000-1| |0-100|
Rust before |-0001| |-1000| |-0001| |-0100|
Rust after  |-0001| |-0001| |-0001| |-0001|

             :#05x   :<#05x  :>#05x  :^#05x
Python 3.6  |0x001| |0x100| |000x1| |00x10|
Rust before |0x001| |0x100| |000x1| |0x010|
Rust after  |0x001| |0x001| |0x001| |0x001|
```

Fixes #39997 [breaking-change]
2017-03-19 20:51:06 -04:00
Corey Farwell
35cf2f96ce Rollup merge of #40646 - russmack:issue-40435-mention-none, r=frewsxcv
Add mention of None as possible return. Closes #40435.

This commit adds a small mention to some methods that None is returned when the slice is empty.
2017-03-19 10:18:23 -04:00
Corey Farwell
969e625a19 Rollup merge of #40603 - QuietMisdreavus:slice-ptr-docs, r=GuillaumeGomez
minor wording tweak to slice::{as_ptr, as_mut_ptr}

Per #37334, the slice-as-pointer methods mentioned that "modifying the slice may cause its buffer to be reallocated", when in fact modifying the *slice* itself would cause no such change. (It is a borrow, after all!) This is a tweak to the wording of that line to stress it's the *collection* that could cause the buffer to be reallocated.

r? @steveklabnik
2017-03-19 10:18:19 -04:00
Russell Mackenzie
b77d31ac61 Add mention of None as possible return. Closes #40435. 2017-03-19 01:41:44 +00:00
Alex Crichton
1241a88fa9 Minor fixups to fix tidy errors 2017-03-17 13:28:53 -07:00
Aaron Turon
a8f4a1bd98 Stabilize rc_raw feature, closes #37197 2017-03-17 13:28:53 -07:00
Aaron Turon
37b38a2f75 Stabilize btree_range, closes #27787 2017-03-17 13:28:37 -07:00
QuietMisdreavus
963d4dfdde minor wording tweak to slice::{as_ptr, as_mut_ptr} 2017-03-17 12:24:44 -05:00
Corey Farwell
dc1deeb9b4 Rollup merge of #40536 - kevinmehall:dedup_docs_for_dedup_by, r=steveklabnik
Fix documentation for Vec::dedup_by.

The previous docstring was copied from dedup_by_key.
2017-03-17 08:49:08 -04:00
Corey Farwell
4fbd8849d9 Rollup merge of #40495 - llogiq:format-docs, r=steveklabnik
fix format grammar

This is just a trivial change to get the escaped squigglies into the grammar.

r? @steveklabnik
2017-03-17 08:48:57 -04:00
Corey Farwell
69717170a4 Rollup merge of #40456 - frewsxcv:frewsxcv-docs-function-parens, r=GuillaumeGomez
Remove function invokation parens from documentation links.

This was never established as a convention we should follow in the 'More
API Documentation Conventions' RFC:

https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md
2017-03-17 08:48:51 -04:00
Kevin Mehall
e66b3a20c8 Fix documentation for Vec::dedup_by.
The previous docstring was copied from dedup_by_key.
2017-03-15 07:56:33 -07:00
Piotr Jawniak
ff63866edb Change how the 0 flag works in format!
Now it always implies right-alignment, so that padding zeroes are placed after the sign (if any) and before the digits. In other words, it always takes precedence over explicitly specified `[[fill]align]`. This also affects the '#' flag: zeroes are placed after the prefix (0b, 0o, 0x) and before the digits.

           :05     :<05    :>05    :^05
before   |-0001| |-1000| |-0001| |-0100|
after    |-0001| |-0001| |-0001| |-0001|
          :#05x   :<#05x  :>#05x  :^#05x
before   |0x001| |0x100| |000x1| |0x010|
after    |0x001| |0x001| |0x001| |0x001|

Fixes #39997 [breaking-change]
2017-03-15 07:50:44 -07:00
bors
71d7b29475 Auto merge of #40009 - clarcharr:box_to_buf, r=alexcrichton
Leftovers from #39594; From<Box> impls

These are a few more impls that follow the same reasoning as those from #39594.

What's included:
* `From<Box<str>> for String`
* `From<Box<[T]>> for Vec<T>`
* `From<Box<CStr>> for CString`
* `From<Box<OsStr>> for OsString`
* `From<Box<Path>> for PathBuf`
* `Into<Box<str>> for String`
* `Into<Box<[T]>> for Vec<T>`
* `Into<Box<CStr>> for CString`
* `Into<Box<OsStr>> for OsString`
* `Into<Box<Path>> for PathBuf`
* `<Box<CStr>>::into_c_string`
* `<Box<OsStr>>::into_os_string`
* `<Box<Path>>::into_path_buf`
* Tracking issue for latter three methods + three from previous PR.

Currently, the opposite direction isn't doable with `From` (only `Into`) because of the separation between `liballoc` and `libcollections`. I'm holding off on those for a later PR.
2017-03-15 04:24:10 +00:00
Corey Farwell
e7b0f2badf Remove function invokation parens from documentation links.
This was never established as a convention we should follow in the 'More
API Documentation Conventions' RFC:

https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md
2017-03-13 21:43:18 -04:00
Andre Bogus
adba642a38 fix format grammar 2017-03-13 23:56:27 +01:00
Alex Crichton
b32393c889 Rollup merge of #40423 - DirkyJerky:patch-2, r=BurntSushi
Clarify docs in `VecDeque::resize`
2017-03-10 20:05:06 -08:00
Alex Crichton
dcf41821b8 Rollup merge of #40389 - F001:placementVecDeque, r=nagisa
Implement placement-in protocol for `VecDeque`

CC #30172

r? @nagisa
2017-03-10 20:05:04 -08:00
Clar Charr
560944b982 Add From<Box<..>> implementations. 2017-03-10 14:57:57 -05:00
Geoff Yoerger
384ee48a1a Clarify docs in VecDeque::resize 2017-03-10 12:11:13 -06:00
Charlie Fan
8062cfb372 Implement placement-in protocol for and VecDeque 2017-03-09 22:46:20 +08:00
Ariel Ben-Yehuda
f2886e8bda Rollup merge of #40335 - tbu-:pr_doc_str_to_somecase, r=steveklabnik
Document why `str.to_{lower,upper}case` return `String`

Fixes #39201.
2017-03-08 20:54:10 +02:00
Ariel Ben-Yehuda
99aad021ce Rollup merge of #40325 - eddyb:pr38143, r=alexcrichton
Added remove_from to vec.rs (#38143)

Turns out that if you push to someone's PR branch and cause the PR to close, you lose delegation 😞.

@madseagames I'm really sorry about that 😭
2017-03-08 20:54:05 +02:00
Tobias Bucher
f3a2f90c88 Document why str.to_{lower,upper}case return String
Fixes #39201.
2017-03-08 00:06:09 +01:00
madseagames
df617195f0 Added remove_from to vec.rs 2017-03-07 19:44:51 +02:00
Joshua Horwitz
86bad49ec1 Issue #39688 - Help people find String::as_bytes() for UTF-8 r? @steveklabnik 2017-03-05 19:56:51 -05:00
bors
1476105dd3 Auto merge of #40189 - SimonSapin:one-width, r=alexcrichton
Reduce std_unicode’s public API

 * Only keep one copy of the `UTF8_CHAR_WIDTH` table instead of one of each of libcore and libstd_unicode.
* Move the `utf8_char_width` function to `core::str` under the `str_internals` unstable feature.
* Remove `std_unicode::str::is_utf16`. It was only accessible through the `#[unstable]` crate std_unicode. It has never been used in the compiler or standard library since 47e7a05 added it in 2012 “for OS API interop”. It can be replaced with a one-liner:

   ```rust
   fn is_utf16(slice: &[u16]) -> bool {
       std::char::decode_utf16(s).all(|r| r.is_ok())
   }
   ```
2017-03-03 09:57:57 +00:00
Corey Farwell
0536fd6396 Rollup merge of #40117 - SimonSapin:to-err-is-for-the-formatter, r=alexcrichton
Panic on errors in `format!` or `<T: Display>::to_string`

… instead of silently ignoring a result.

`fmt::Write for String` never returns `Err`, so implementations of `Display` (or other traits of that family) never should either.

Fixes #40103
2017-03-02 14:53:44 -05:00
Simon Sapin
f2017f4561 Panic on errors in format! or <T: Display>::to_string
… instead of silently ignoring a result.

`fmt::Write for String` never returns `Err`,
so implementations of `Display` (or other traits of that family)
never should either.

Fixes #40103
2017-03-01 23:47:59 +01:00
Simon Sapin
031f9b15df Only keep one copy of the UTF8_CHAR_WIDTH table.
… instead of one of each of libcore and libstd_unicode.

Move the `utf8_char_width` function to `core::str`
under the `str_internals` unstable feature.
2017-03-01 23:25:27 +01:00
Corey Farwell
0a008b949e Rollup merge of #40028 - withoutboats:string_from_iter, r=alexcrichton
impl FromIterator<&char> for String
2017-02-28 22:55:30 -05:00
Corey Farwell
43df65fb3f Rollup merge of #39936 - djzin:inclusive_rangeargument, r=alexcrichton
impl RangeArgument for RangeInclusive and add appropriate tests

Now that `RangeArgument` returns a `Bound`, the impl for `RangeInclusive` is natural to implement and all that's required are tests around it.
2017-02-28 22:55:27 -05:00
bors
60a0edc6c2 Auto merge of #39738 - keeperofdakeys:vec-docs, r=GuillaumeGomez
Add notes about capacity effects to Vec::truncate()

Add notes about the effects of Vec::truncate() and Vec::clear() on the capacity of a vector.
2017-02-26 20:36:10 +00:00
Guillaume Gomez
173b725b89 Rollup merge of #40048 - jimblandy:fmt-arg-types-doc, r=alexcrichton
Update std::fmt module docs for landing of #33642.

Since #33642, it's no longer true that all references to a given format argument must use the same type. The docs don't seem to have been updated.
2017-02-24 13:22:58 +01:00
Guillaume Gomez
3b10300e0a Rollup merge of #39886 - mbrubeck:doc-edit, r=steveklabnik
Additional docs for Vec, String, and slice trait impls

r? @steveklabnik
2017-02-24 13:22:54 +01:00
Jim Blandy
6b8e1756c7 Update std::fmt module docs for landing of #33642. 2017-02-22 21:18:52 -08:00
Without Boats
097398e383 impl FromIter<&char> for String 2017-02-22 00:06:40 -08:00
Djzin
43382903a1 add impl for RangeToInclusive 2017-02-18 20:58:12 +00:00
Djzin
328818934b impl RangeArgument for RangeInclusive and add appropriate tests 2017-02-18 18:57:18 +00:00
Steven Allen
eec9e988e1 Fixup String::split_off documentation
1. Clarify that `String::split_off` returns one string and modifies self
   in-place. The documentation implied that it returns two new strings.

2. Make the documentation mirror `Vec::split_off`.
2017-02-16 22:49:46 -08:00
Matt Brubeck
b2ac1c9c6b Additional docs for Vec, String, and slice trait impls 2017-02-16 12:12:17 -08:00