about summary refs log tree commit diff
path: root/src/libserialize/json.rs
AgeCommit message (Collapse)AuthorLines
2019-02-12Auto merge of #58341 - alexreg:cosmetic-2-doc-comments, r=steveklabnikbors-35/+35
Cosmetic improvements to doc comments This has been factored out from https://github.com/rust-lang/rust/pull/58036 to only include changes to documentation comments (throughout the rustc codebase). r? @steveklabnik Once you're happy with this, maybe we could get it through with r=1, so it doesn't constantly get invalidated? (I'm not sure this will be an issue, but just in case...) Anyway, thanks for your advice so far!
2019-02-10rustc: doc commentsAlexander Regueiro-35/+35
2019-02-09Cleanup importsTaiki Endo-1/+0
2019-02-09Move some tests into the tests directoryTaiki Endo-1281/+4
This moves tests in opaque.rs and tests other than tests that require private items in json.rs into tests/opaque.rs and tests/json.rs.
2019-02-07Transition libserialize to 2018 editionHirokazu Hata-30/+30
2019-01-13Cosmetic improvementsAlexander Regueiro-1/+1
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-12Bump to 1.33.0Alex Crichton-1/+1
* Update bootstrap compiler * Update version to 1.33.0 * Remove some `#[cfg(stage0)]` annotations Actually updating the version number is blocked on updating Cargo
2018-09-11renamed emit_nil to emit_unitkenta7777-5/+5
2018-09-11Revert "renamed emit_nil to emit_unit"kenta7777-5/+5
This reverts commit d02a5ffaed9c395ae62ee12d0f4e04946c62edb1.
2018-09-11Revert "renamed read_nil to read_unit"kenta7777-1/+1
This reverts commit 37d0600c23ba1890346078bd7f310e15915417b2.
2018-09-10renamed read_nil to read_unitkenta7777-1/+1
2018-09-10renamed emit_nil to emit_unitkenta7777-5/+5
2018-08-17Rollup merge of #53313 - llogiq:two-small-improvements, r=estebankkennytm-4/+3
Two small improvements In `librustc_apfloat/ieee.rs`, use the iterator.[r]find methods to simplify the code. In `libserialize/json.rs`, make use of the fact that `Vec.last` on an empty `Vec` returns `None` to simplify the code to a single match.
2018-08-17Rollup merge of #52946 - Ajacmac:doc-impl-from, r=GuillaumeGomezkennytm-0/+3
Documented impl From on line 367 of libserialize/json.rs This is for the impl From mentioned in #51430 assigned to @skade . Hopefully I didn't miss anything/get anything wrong. I looked over another PR for another part of this same issue to see what the proper formatting was, etc. Thanks!
2018-08-15Two small improvementsAndre Bogus-4/+3
In `librustc_apfloat/ieee.rs`, use the iterator.[r]find methods to simplify the code. In `libserialize/json.rs`, make use of the fact that `Vec.last` on an empty `Vec` returns `None` to simplify the code to a single match.
2018-08-14Corrected typing description in docJacob-1/+1
2018-08-11A few cleanups for fmt_macros, graphviz, apfloat, target, serialize and termljedrz-30/+28
2018-08-01Documented impl From on line 367 of libserialize/json.rsStrategic Technologies-0/+3
2018-07-29Auto merge of #52738 - ljedrz:push_to_extend, r=eddybbors-9/+3
Replace push loops with extend() where possible Or set the vector capacity where I couldn't do it. According to my [simple benchmark](https://gist.github.com/ljedrz/568e97621b749849684c1da71c27dceb) `extend`ing a vector can be over **10 times** faster than `push`ing to it in a loop: 10 elements (6.1 times faster): ``` test bench_extension ... bench: 75 ns/iter (+/- 23) test bench_push_loop ... bench: 458 ns/iter (+/- 142) ``` 100 elements (11.12 times faster): ``` test bench_extension ... bench: 87 ns/iter (+/- 26) test bench_push_loop ... bench: 968 ns/iter (+/- 3,528) ``` 1000 elements (11.04 times faster): ``` test bench_extension ... bench: 311 ns/iter (+/- 9) test bench_push_loop ... bench: 3,436 ns/iter (+/- 233) ``` Seems like a good idea to use `extend` as much as possible.
2018-07-29Replace push loops with collect() and extend() where possibleljedrz-9/+3
2018-07-27Prefer to_string() to format!()ljedrz-15/+15
2018-07-12Deny bare trait objects in src/libserializeljedrz-8/+8
2018-06-26migrate codebase to `..=` inclusive range patternsZack M. Davis-11/+11
These were stabilized in March 2018's #47813, and are the Preferred Way to Do It going forward (q.v. #51043).
2017-12-09Use Try syntax for Option in place of macros or matchMatt Brubeck-4/+1
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-2/+2
Like #43008 (f668999), but _much more aggressive_.
2017-06-23Removed as many "```ignore" as possible.kennytm-1/+1
Replaced by adding extra imports, adding hidden code (`# ...`), modifying examples to be runnable (sorry Homura), specifying non-Rust code, and converting to should_panic, no_run, or compile_fail. Remaining "```ignore"s received an explanation why they are being ignored.
2017-02-03Bump version, upgrade bootstrapAlex Crichton-2/+0
This commit updates the version number to 1.17.0 as we're not on that version of the nightly compiler, and at the same time this updates src/stage0.txt to bootstrap from freshly minted beta compiler and beta Cargo.
2016-12-30Implement emit_iu128 for json serialiserSimonas Kazlauskas-4/+4
Causes ICEs otherwise while trying to dump AST
2016-12-30Such large. Very 128. Much bits.Simonas Kazlauskas-0/+8
This commit introduces 128-bit integers. Stage 2 builds and produces a working compiler which understands and supports 128-bit integers throughout. The general strategy used is to have rustc_i128 module which provides aliases for iu128, equal to iu64 in stage9 and iu128 later. Since nowhere in rustc we rely on large numbers being supported, this strategy is good enough to get past the first bootstrap stages to end up with a fully working 128-bit capable compiler. In order for this strategy to work, number of locations had to be changed to use associated max_value/min_value instead of MAX/MIN constants as well as the min_value (or was it max_value?) had to be changed to use xor instead of shift so both 64-bit and 128-bit based consteval works (former not necessarily producing the right results in stage1). This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-10-31Changed most vec! invocations to use square bracesiirelu-3/+3
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-10Avoid allocations in `Decoder::read_str`.Nicholas Nethercote-4/+3
`opaque::Decoder::read_str` is very hot within `rustc` due to its use in the reading of crate metadata, and it currently returns a `String`. This commit changes it to instead return a `Cow<str>`, which avoids a heap allocation. This change reduces the number of calls to `malloc` by almost 10% in some benchmarks. This is a [breaking-change] to libserialize.
2016-09-28[breaking-change] std: change `encode_utf{8,16}()` to take a buffer and ↵tormol-3/+1
return a slice They panic if the buffer is too small.
2016-09-11Use question_mark feature in libserialize.Ahmed Charles-6/+5
2016-08-31Rollup merge of #36123 - nagisa:unignore-json-tests, r=alexcrichtonJonathan Turner-3/+0
Unignore the json tests on 32-bit platforms cc #14064 r? @alexcrichton
2016-08-30Unignore the json tests on 32-bit platformsSimonas Kazlauskas-3/+0
cc #14064
2016-08-25Rename {uint,int} methods to {usize,isize}.Corey Farwell-6/+6
2016-07-03prefer `if let` to match with `None => {}` arm in some placesZack M. Davis-6/+4
This is a spiritual succesor to #34268/8531d581, in which we replaced a number of matches of None to the unit value with `if let` conditionals where it was judged that this made for clearer/simpler code (as would be recommended by Manishearth/rust-clippy's `single_match` lint). The same rationale applies to matches of None to the empty block.
2016-05-09Utilize `Result::unwrap_err` in more places.Corey Farwell-1/+1
2016-03-22try! -> ?Jorge Aparicio-90/+90
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-22std: Change `encode_utf{8,16}` to return iteratorsAlex Crichton-4/+3
Currently these have non-traditional APIs which take a buffer and report how much was filled in, but they're not necessarily ergonomic to use. Returning an iterator which *also* exposes an underlying slice shouldn't result in any performance loss as it's just a lazy version of the same implementation, and it's also much more ergonomic! cc #27784
2016-02-18Remove unnecessary explicit lifetime bounds.Corey Farwell-4/+4
These explicit lifetimes can be ommitted because of lifetime elision rules. Instances were found using rust-clippy.
2016-01-26Fix warnings during testsAlex Crichton-1/+0
The deny(warnings) attribute is now enabled for tests so we need to weed out these warnings as well.
2015-11-12libserialize: deny warnings in doctestsKevin Butler-3/+6
2015-09-20Miscellaneous cleanup for old issues.Lee Jeffery-6/+3
2015-09-08fixes/improvements thanks to @ManishearthAndre Bogus-3/+3
2015-09-08some more clippy-based improvementsAndre Bogus-53/+52
2015-08-23Refactor low-level UTF-16 decoding.Simon Sapin-6/+6
* Rename `utf16_items` to `decode_utf16`. "Items" is meaningless. * Move it to `rustc_unicode::char`, exposed in `std::char`. * Generalize it to any `u16` iterable, not just `&[u16]`. * Make it yield `Result` instead of a custom `Utf16Item` enum that was isomorphic to `Result`. This enable using the `FromIterator for Result` impl. * Add a `REPLACEMENT_CHARACTER` constant. * Document how `result.unwrap_or(REPLACEMENT_CHARACTER)` replaces `Utf16Item::to_char_lossy`.
2015-08-12Remove all unstable deprecated functionalityAlex Crichton-1/+0
This commit removes all unstable and deprecated functions in the standard library. A release was recently cut (1.3) which makes this a good time for some spring cleaning of the deprecated functions.
2015-06-08Replace usage of String::from_str with String:fromSimon Sapin-1/+1