Commit graph

357 commits

Author SHA1 Message Date
Stu 4d7c606a75 Remove no_inline from Spanned import 2020-11-13 20:42:06 +01:00
Alex Tokarev 39dcf1384c Improve error message when parsing unquoted string (#385)
* Improve error message when parsing unquoted string

* Remove conversion to lowercase in parse_keylike()

Converting keys to lowercase goes against
TOML specification for floats.

* Change error message for unquoted string
2020-10-11 12:30:55 -05:00
pyfisch af05f537d8 Allow delimiter quotes at the end of multiline strings (#393)
TOML allows (unlike many other formats) up to 2
additonal quotes that are part of the string:

basic = """2 extra quotes -->"""""
literal = '''here too ''''

Changed in TOML v1.0.0-rc.1

See also #392
2020-05-28 10:39:55 -05:00
Bram Geron b84615a24c Apply some Clippy suggestions. (#378) 2020-02-25 12:08:29 -06:00
Bram Geron f12a16274b Rustdoc: Add links. Show all reexports as reexports. (#377)
* Rustdoc: Add links. Show all reexports as reexports.

* Reformat.
2020-02-25 12:07:55 -06:00
Michael Sloan cd96581730 Fix roundtripping of \u001f and \u007f in toml string literals (#372) 2020-01-30 08:55:36 +01:00
Zeeshan Ali 66728e147f Fix a small typo in docs 2020-01-19 21:01:22 +01:00
Michael Sloan 13107f621b Fix a couple errors in DateStrEmitter (#368) 2020-01-15 10:58:12 -06:00
Andrii Radyk dea4b79a71 remove deprecated Error::description 2019-12-22 00:06:00 +01:00
daubaris c822128a02 Mixed type arrays (#358)
* Added support of mixed-type arrays

* Add tests cases

* Replaced &'static str type for type_ and created a new enum instead

* Restored ArrayMixedType
2019-11-22 10:28:29 -06:00
Maxim Vorobjov 9e3cd1d431 replace copied wit filter_map for rustc 1.35 compatibility (#354) 2019-11-01 09:58:09 -05:00
est31 34ef67bee2 Decrease deserialization complexity from quadratic to linear (#349)
* Speed up array code

* Speed up map code too

Also add regression test

* Use more obvious closure notation

* Document the builder functions
2019-10-28 10:05:13 -05:00
est31 52586279ce Support for dotted table spans (#340)
* "Support" spans for maps

In toml you can declare maps via {} and via [name].
We can't obtain spans for [] maps but at least we
can emit fake spans to make SpannedValue work.

We also add a regression test.

* Don't regress the inline table case

* Also support arrays
2019-10-28 09:01:23 -05:00
Alex Crichton bf1c4ce44f Switch from linked-hash-map to indexmap
Follow the footsteps of serde_json!

Closes #348
2019-10-25 12:08:28 -07:00
est31 e89d255cbf Spanned: impl PartialEq, Eq, Hash, PartialOrd, Ord in terms of the value (#344)
* Spanned: impl PartialEq, Eq, Hash, PartialOrd, Ord in terms of the value

This is because we want to be able to index into HashMap<Spanned<String>, T>
with a dummy span and get results where only the content has to match.

* Add Borrow impl

* Add tests
2019-10-25 14:05:31 -05:00
Kyle Clemens b517e36d8f feat: support tabs in basic strings (#343)
Close #310.
2019-10-15 08:45:17 -05:00
Guillaume Fraux 83147d3530 get_mut should return a mutable reference (#338) 2019-10-03 10:29:50 -05:00
Sergey "Shnatsel" Davidoff ef8cca002a Forbid unsafe code (#332)
* Forbid unsafe code

* Add badge advertising that unsafe code is forbidden

* Revert "Add badge advertising that unsafe code is forbidden"

This reverts commit e8d35d20d016a341d37969b975463588d3143528.

* Comment on #![forbid(unsafe_code)]

* Run rustfmt
2019-09-30 09:57:16 -05:00
est31 12db6aa93f Support deserializing spanned keys (#333)
* Store key spans in the deserializer

* Support deserializing spanned keys

* Store key spans of the table header as well

* Support nested table key spans as well
2019-09-16 16:32:45 -05:00
est31 55ca6c5e30 Remove redundant #[doc(hidden)] attributes (#331) 2019-09-09 13:04:47 -05:00
James Kay d083e58357 Nested dotted-table enums (#329)
Add support for deserializing enums from nested dotted tables.
2019-09-05 09:18:26 -05:00
est31 5fef3914cf Suppport deserialization of Spanned<> at the top level (#328) 2019-09-05 08:38:54 -05:00
Erich Gubler 57aea7dfad Make de::Error Eq in addition to current PartialEq (#330)
Not sure why this wasn't implemented before, since `ser::Error` has implemented `PartialEq` and `Eq` as of PR #144.
2019-09-04 18:44:32 -05:00
Eric Huss f822f4661b Allow zero-prefixed float exponents. (#322) 2019-08-23 09:55:15 -07:00
Nick Hackman c18d474acf Propogate write! errors to ser::Error
std::fmt::Errors are now converted to ser::Errors via ser::Error::custom
2019-08-20 12:59:28 -04:00
Nick Hackman 9f25cfa17b Fixed Clippy warning of long return type
Created an alias named TablePair being a (Cow<'a, str>, Value<'a>)
2019-08-18 21:07:23 -04:00
Nick Hackman 6699b5be03 Potential Solution to drop clippy errors
Calling the write!, the result that it returns doesn't matter or wasn't
deemed as important and was dropped before. This was just removed and
then the unused Result is ignored via clippy attribute. This is a
plausible solution to get past the Clippy Error, but others may be more
ideal.
2019-08-18 20:23:40 -04:00
Nick Hackman 8b88c96cfc Removed all warnings besides two
Majority of warnings removed via RustFix
Two remain one being a long return type and another being a name
suggestion from Clippy `to_owned` for MaybeString
2019-08-14 23:05:30 -04:00
Eric Huss 514b8ca8f2 Fix error line/column when using CRLF line endings. 2019-08-13 13:48:54 -07:00
Nick Hackman 64e2f4742f Simplified Logic when comparing discriminants
Removed matches that were used to compare Enum variants for equality in
favor of using discriminant from https://doc.rust-lang.org/std/mem/fn.discriminant.html
introduced in Rust 1.21.0
2019-08-13 14:13:01 -04:00
Jason Priest 4018ebc65a Derive Clone+PartialEq for Spanned
Should any other traits be derived?
2019-08-12 21:27:26 -05:00
Alex Crichton fd39bc7412 Run cargo fmt 2019-08-12 13:50:59 -07:00
Alex Crichton 59c0d52600 Fix a bad merge 2019-08-12 13:50:44 -07:00
Alex Crichton 7a11ed691a Merge pull request #315 from jwdeitch/master
Allow conversion from de::Error to std::io::error
2019-08-12 15:35:55 -05:00
Alex Crichton 7e8b40b025 Merge pull request #314 from zertosh/add-line-and-col-to-errors
Add line and column to all Errors
2019-08-12 15:35:35 -05:00
Eric Huss 5cb9b37b99 Squelch explicit_outlives_requirements warning. 2019-08-12 09:12:39 -07:00
Pietro Albini c6745eeaeb include Spanned in the docs
The `Spanned` struct was originally included in the docs as a re-export,
but rustdoc doesn't render re-exports if the module from which it's
exported isn't documented.

Since `Spanned` is the only public item inside the `spanned` module this
commit shows the struct as a normal item in the index, and moves the
example from the module docs to the struct docs.
2019-08-09 20:48:46 +02:00
Jordan Deitch d3eedc52ba convert toml error to std::io error 2019-08-01 20:43:05 -04:00
Andres Suarez b09bb78352 Add line and column to all Errors 2019-07-30 13:35:08 -04:00
Andres Suarez 8c1b49f66f Show "column" in Error messages 2019-07-28 13:41:17 -04:00
Eric Huss 8f115c98d3 cargo fmt 2019-05-08 17:45:39 -07:00
Eric Huss 0737f0b27a 2018 edition idioms. 2019-05-08 17:37:38 -07:00
Eric Huss 68fd59c78d Migrate to 2018 edition. 2019-05-08 12:12:14 -07:00
Eric Huss 10fb80090c Bump html_root_url version. 2019-04-25 11:15:42 -07:00
Constantin Nickel a622bd414c implement From<toml::value::Table> for toml::Value 2019-04-08 23:58:16 +02:00
Eric Huss 816b457c84 Fix float with invalid suffix. 2019-04-05 13:51:28 -07:00
Eric Huss 743cfcef05 Merge pull request #295 from ErichDonGubler/fix_warnings
Fix warnings for deprecated usages of trim_{left,right}_matches.
2019-04-02 10:50:33 -07:00
Erich Gubler d34e734b39 Fix warnings for deprecated usages of trim_{left,right}_matches. 2019-04-02 09:35:28 -06:00
Erich Gubler a6071c7aac Make importing toml_internal macro unnecessary when using the toml macro 2019-04-02 09:32:51 -06:00
Tomasz Miąsko a5046008e5 Fix parsing of repeated delimiters inside multi-line strings
The previous implementation of `read_string`, when looking for
delimiters ending the multi-line string and failing to find exactly
three in succession, always put a single delimiter back. This is
incorrect when exactly two delimiters are present.

Put back the correct number of delimiters depending on how many have
been already consumed from input.

The issue could be triggered only with `Owned` representation of
`MaybeString`, since otherwise `push` operation is no-op.
2019-03-20 17:58:14 +01:00