summary refs log tree commit diff
path: root/src/libcore/option.rs
AgeCommit message (Collapse)AuthorLines
2017-12-07Rollup merge of #46548 - jonathanstrong:master, r=dtolnayGuillaume Gomez-0/+17
Recommends lazily evaluated alternatives for `Option::or` and `Result::or` Adds language to docs for `Option` and `Result` recommending the use of lazily evaluated alternatives when appropriate. These comments are intended to echo a [clippy lint] on the same topic. The [reddit discussion] may also be of interest. [clippy lint]: https://rust-lang-nursery.github.io/rust-clippy/master/index.html#or_fun_call [reddit discussion]: https://www.reddit.com/r/rust/comments/7hutqn/perils_of_optionor_and_resultor/
2017-12-07adds links to methods, removes trailing whitespaceJonathan Strong-5/+10
2017-12-06Adds language to the documentation for `Option` and `Result` suggestingJonathan Strong-0/+12
the use of lazily evaluated alternatives when appropriate. These comments are intended to echo a clippy lint on the same topic (see https://rust-lang-nursery.github.io/rust-clippy/master/index.html#or_fun_call)
2017-11-11Refactor Option::filter methodShanavas M-8/+4
2017-11-08Add `Option::filter()` according to RFC 2124Lukas Kalbertodt-0/+39
2017-09-27Rename option::Missing to NoneErrorHunter Praska-6/+9
2017-09-27Add docs for Missing, correct Option's Try testHunter Praska-1/+1
2017-09-27Impl Try for OptionHunter Praska-1/+24
2017-08-29Rollup merge of #43705 - panicbit:option_ref_mut_cloned, r=aturonAriel Ben-Yehuda-0/+20
libcore: Implement cloned() for Option<&mut T> None
2017-08-08Assign tracking issue to option_ref_mut_clonedpanicbit-1/+1
2017-08-07Fix Option<&mut T>::cloned doc testpanicbit-0/+1
2017-08-07libcore: Implement cloned() for Option<&mut T>panicbit-0/+19
2017-08-01Fixed all unnecessary muts in language coreIsaac van Bakel-1/+1
2017-07-25std: Stabilize `option_entry` featureAlex Crichton-6/+2
Stabilized: * `Option::get_or_insert` * `Option::get_or_insert_with` Closes #39288
2017-05-22Adding links to option::Optionprojektir-26/+60
2017-05-04Simplify types in `std::option` doc comment example.Corey Farwell-6/+6
2017-04-02Minor changes to core::option docsIrfan Hudda-6/+6
2017-04-01Improve docs of core::option::IterIrfan Hudda-1/+7
2017-04-01Improve docs of core::option::IterMutIrfan Hudda-1/+7
2017-04-01Improve docs of core::option::IntoIterIrfan Hudda-1/+7
2017-03-20Add missing urls in Option enumGuillaume Gomez-4/+13
2017-02-05Rollup merge of #39289 - shahn:option_entry, r=alexcrichtonCorey Farwell-0/+70
Provide Entry-like API for Option This implements #39288. I am wondering whether to use std::intrinsics::unreachable!() here. Both seems fine to me (the second match optimizes away in release mode).
2017-02-05Provide Entry-like API for OptionSebastian Hahn-0/+70
This implements #39288. Thanks to @steveklabnik and @oli-obk for their review comments :)
2017-01-30doc: minor Option improvementsTshepang Lekhonkhobe-3/+3
2016-11-30Add cloned example for OptionGuillaume Gomez-0/+10
2016-11-04Auto merge of #37306 - bluss:trusted-len, r=alexcrichtonbors-1/+10
Add Iterator trait TrustedLen to enable better FromIterator / Extend This trait attempts to improve FromIterator / Extend code by enabling it to trust the iterator to produce an exact number of elements, which means that reallocation needs to happen only once and is moved out of the loop. `TrustedLen` differs from `ExactSizeIterator` in that it attempts to include _more_ iterators by allowing for the case that the iterator's len does not fit in `usize`. Consumers must check for this case (for example they could panic, since they can't allocate a collection of that size). For example, chain can be TrustedLen and all numerical ranges can be TrustedLen. All they need to do is to report an exact size if it fits in `usize`, and `None` as the upper bound otherwise. The trait describes its contract like this: ``` An iterator that reports an accurate length using size_hint. The iterator reports a size hint where it is either exact (lower bound is equal to upper bound), or the upper bound is `None`. The upper bound must only be `None` if the actual iterator length is larger than `usize::MAX`. The iterator must produce exactly the number of elements it reported. This trait must only be implemented when the contract is upheld. Consumers of this trait must inspect `.size_hint()`’s upper bound. ``` Fixes #37232
2016-11-04Link the tracking issue for TrustedLenUlrik Sverdrup-3/+3
2016-10-31Changed most vec! invocations to use square bracesiirelu-2/+2
Most of the Rust community agrees that the vec! macro is clearer when called using square brackets [] instead of regular brackets (). Most of these ocurrences are from before macros allowed using different types of brackets. There is one left unchanged in a pretty-print test, as the pretty printer still wants it to have regular brackets.
2016-10-20Implement TrustedLen for more iteratorsUlrik Sverdrup-1/+10
2016-09-19fixed the safety header/wording in option.rsjacobpadkins-6/+4
2016-09-14Rollup merge of #36396 - athulappadan:Default-docs, r=blussGuillaume Gomez-0/+1
Documentation of what Default does for each type Addresses #36265 I haven't changed the following types due to doubts: 1)src/libstd/ffi/c_str.rs 2)src/libcore/iter/sources.rs 3)src/libcore/hash/mod.rs 4)src/libcore/hash/mod.rs 5)src/librustc/middle/privacy.rs r? @steveklabnik
2016-09-11Documentation for default types modifiedathulappadan-1/+1
2016-09-11Documentation of what does for each typeathulappadan-0/+1
2016-09-11Improve Option docggomez-28/+50
2016-08-24Use `#[prelude_import]` in `libcore`.Jeffrey Seyfried-10/+1
2016-08-18Add a FusedIterator trait.Steven Allen-2/+12
This trait can be used to avoid the overhead of a fuse wrapper when an iterator is already well-behaved. Conforming to: RFC 1581 Closes: #35602
2016-07-20core: impl From<T> for Option<T>Sean McArthur-0/+8
2016-04-12Remove unused trait importsSeo Sanghyeon-1/+0
2016-03-24Improve some Option code exampleGuillaume Gomez-7/+3
2016-03-20libcore: add Debug implementations to most missing typesSean McArthur-2/+4
2016-03-04End stdlib module summaries with a full stop.Steve Klabnik-1/+1
Fixes #9447
2016-02-23Register new snapshotsAaron Turon-1/+1
2016-01-22Move cold panic functions in Option and ResultUlrik Sverdrup-7/+9
Move functions out of their impl blocks; avoids unnecessary monomorphization by type parameters that are irrelevant to the message output.
2016-01-22Use cold functions for panic formatting Option::expect, Result::unwrap etcUlrik Sverdrup-1/+7
Option::expect, Result::unwrap, unwrap_err, expect These methods are marked inline, but insert a big chunk of formatting code, as well as other error path related code, such as deallocating a std::io::Error if you have one. We can explicitly separate out that code path into a function that is never inline, since the panicking case should always be rare.
2016-01-14Require stability annotations on fields of tuple variantsVadim Petrochenkov-1/+1
2015-12-10Auto merge of #30182 - alexcrichton:remove-deprecated, r=aturonbors-53/+0
This is a standard "clean out libstd" commit which removes all 1.5-and-before deprecated functionality as it's now all been deprecated for at least one entire cycle.
2015-12-10std: Remove deprecated functionality from 1.5Alex Crichton-53/+0
This is a standard "clean out libstd" commit which removes all 1.5-and-before deprecated functionality as it's now all been deprecated for at least one entire cycle.
2015-12-10fix missing Panics tag and missing periodLetheed-1/+1
2015-11-20Rename #[deprecated] to #[rustc_deprecated]Vadim Petrochenkov-2/+2
2015-11-12libcore: deny warnings in doctestsKevin Butler-0/+1