diff options
Diffstat (limited to 'vendor/toml')
-rw-r--r-- | vendor/toml/.cargo-checksum.json | 2 | ||||
-rw-r--r-- | vendor/toml/Cargo.lock | 40 | ||||
-rw-r--r-- | vendor/toml/Cargo.toml | 16 | ||||
-rw-r--r-- | vendor/toml/LICENSE-APACHE | 403 | ||||
-rw-r--r-- | vendor/toml/LICENSE-MIT | 38 | ||||
-rw-r--r-- | vendor/toml/src/fmt.rs | 32 | ||||
-rw-r--r-- | vendor/toml/src/macros.rs | 6 | ||||
-rw-r--r-- | vendor/toml/src/value.rs | 126 | ||||
-rw-r--r-- | vendor/toml/tests/decoder.rs | 5 | ||||
-rw-r--r-- | vendor/toml/tests/decoder_compliance.rs | 12 | ||||
-rw-r--r-- | vendor/toml/tests/encoder.rs | 5 | ||||
-rw-r--r-- | vendor/toml/tests/encoder_compliance.rs | 2 | ||||
-rw-r--r-- | vendor/toml/tests/testsuite/float.rs | 4 | ||||
-rw-r--r-- | vendor/toml/tests/testsuite/macros.rs | 15 | ||||
-rw-r--r-- | vendor/toml/tests/testsuite/pretty.rs | 12 | ||||
-rw-r--r-- | vendor/toml/tests/testsuite/serde.rs | 270 |
16 files changed, 667 insertions, 321 deletions
diff --git a/vendor/toml/.cargo-checksum.json b/vendor/toml/.cargo-checksum.json index cc7a62534..967afe2eb 100644 --- a/vendor/toml/.cargo-checksum.json +++ b/vendor/toml/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.lock":"299cfdfc7c8185d998fc55795eeb54532a673c7ea976174a40153c148d7abfac","Cargo.toml":"d80521a676e715a134422efdca2c63f2310bfe287ee9759390610dfefd76491e","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"a915ead738822da2d74b883c7519d8e558299286bb823e26c7fdece901c3267e","examples/decode.rs":"ebb019364720589b634fa47a3fc4c8ca7ae14c9a6df8c89cd086e421d442cd77","examples/enum_external.rs":"4878e249aa095264c7824fc7b6fd30f9b0ec6891b16fff734a0490d906e1abbe","examples/toml2json.rs":"f69cf930e7e16f57288c27a57de5bf8e4f991abb483114a6c226ac5a3bddef44","src/de.rs":"faf32d0e29f8140c1b62f175dffa3ac4ffbf13034b74222a9c26d0477cd2e2a3","src/edit.rs":"52f1959a6e5c177097372ea04439662262960f2eb41c2b9ef0ce9ce77ed43f60","src/fmt.rs":"f263687a2616b3140373a0809e905e6d2ae049fa516ab2a90e014e2c734c2e87","src/lib.rs":"21982e43114486005dd9a1d31b7e5da425b3fea0e724a437d89fe42d674b4696","src/macros.rs":"b017ca382f25a5e333ba32c091dcdc3a6cb7a254c65f4ee6b4ca758801c8d1cd","src/map.rs":"7a1b97ee1a2ab3fa933d24497066191a6760d118e6e4c8ba42cc891e4668c177","src/ser.rs":"f9c91c2f70c42152531143ae231c6130e4ce930c97b378011e5595ea123ff31b","src/table.rs":"60767350b69b8d74c23e5b57c9e58d2e9e1c19c6cf2ad08820b29515ace42ca0","src/value.rs":"0730f1abdac14c52f97e60a8f0d22566fde743ebe1ddec70a8d9e285017cb640","tests/decoder.rs":"16dff5be5a163a08dfaa8d13422a607f1e33ae4540366839a4c9a2af6c98ee0f","tests/decoder_compliance.rs":"73bde51b0d2051ea513688497543f890292d531327fbaeb90c453d3514786199","tests/encoder.rs":"68294978412df2babd5bb85e42dfc9be6366e0c9d3c9eb3a5196082fbeeb0171","tests/encoder_compliance.rs":"2ef9dec88a05d2b274a4cfd2b5b0fa219af8635eacd025ba63bdf69c6095f4a7","tests/testsuite/de_errors.rs":"1bc8521181f9fbe884db3313a8e8a044b4a1cf4b8956530a3cc8be9bcb5468f8","tests/testsuite/display.rs":"164de8f7108ce1055159a19884d23f770bd25cf0ead6b23f6ff4340931c7afc5","tests/testsuite/display_tricky.rs":"9806743d670e5cc46ee0ffda3f4c1f8ac63ee1e702250f07b7cd2098750d25d1","tests/testsuite/enum_external_deserialize.rs":"28b4705d904b58a973ef27c6cdc948f8d404105f98a55efa111cce9e7b4b1a67","tests/testsuite/float.rs":"5bbd383ac4fbcd276cd4500cba41b434fd70b024c8e78ac332eee5cf727368ec","tests/testsuite/formatting.rs":"3b279ab1f24ebeb07537764107c42be9a84731ead1a88596785186777aafd1ee","tests/testsuite/macros.rs":"8c6cee633eaf500a695f308a8f89703b04f19c0bddc379f81bf02dc4573628af","tests/testsuite/main.rs":"4e40c82147ccfc7094f2c4795b51b575c7d231a7da75814a08fd8e0c52d93f8b","tests/testsuite/pretty.rs":"98fb06578339c97b52a8454f48c19adb9860c54585767e8741268cc26782435f","tests/testsuite/serde.rs":"72921f9e9cc985eaf5b65c05bc5181b2ef947f67ba7fa8e6fe4b239db9037274","tests/testsuite/spanned.rs":"b7522afd8101ba5dd539118a43bccefef66fedef41926d9515f67590961ac7e3","tests/testsuite/spanned_impls.rs":"666c65679365451f67234d50bb3198ac52418ad7ef1dae6916faba78f92c9d02","tests/testsuite/tables_last.rs":"42271f9df94b28f36b934686d4a5c6196140a2975733d1344b6415cb9f1b92ed"},"package":"c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542"}
\ No newline at end of file +{"files":{"Cargo.lock":"a11a1bfc59f08a78cac57078ff566b7072a617d79b376b0c503f527bb6ba69c6","Cargo.toml":"d6b0c8142ebb5a03f15bf356caa24d8ab1b36d47edbc8e7350e2d8f37aef11e7","LICENSE-APACHE":"c6596eb7be8581c18be736c846fb9173b69eccf6ef94c5135893ec56bd92ba08","LICENSE-MIT":"6efb0476a1cc085077ed49357026d8c173bf33017278ef440f222fb9cbcb66e6","README.md":"a915ead738822da2d74b883c7519d8e558299286bb823e26c7fdece901c3267e","examples/decode.rs":"ebb019364720589b634fa47a3fc4c8ca7ae14c9a6df8c89cd086e421d442cd77","examples/enum_external.rs":"4878e249aa095264c7824fc7b6fd30f9b0ec6891b16fff734a0490d906e1abbe","examples/toml2json.rs":"f69cf930e7e16f57288c27a57de5bf8e4f991abb483114a6c226ac5a3bddef44","src/de.rs":"faf32d0e29f8140c1b62f175dffa3ac4ffbf13034b74222a9c26d0477cd2e2a3","src/edit.rs":"52f1959a6e5c177097372ea04439662262960f2eb41c2b9ef0ce9ce77ed43f60","src/fmt.rs":"eb19258f004a403da7fd310b30c8964bdf5867ecd145bf4fcba708af51cb378f","src/lib.rs":"21982e43114486005dd9a1d31b7e5da425b3fea0e724a437d89fe42d674b4696","src/macros.rs":"a2f320170bfc8e59e5dfda129bb953a15d8efc6b622c3894dce87db541ede413","src/map.rs":"7a1b97ee1a2ab3fa933d24497066191a6760d118e6e4c8ba42cc891e4668c177","src/ser.rs":"f9c91c2f70c42152531143ae231c6130e4ce930c97b378011e5595ea123ff31b","src/table.rs":"60767350b69b8d74c23e5b57c9e58d2e9e1c19c6cf2ad08820b29515ace42ca0","src/value.rs":"1fb23e59a61456a3ec5fa1727674b28eb1141e9e056cdeb794ec2647c4a55b71","tests/decoder.rs":"114e708adc1467c03212e52e2ffef42d08233ab74f69c553a6db73ddbb874414","tests/decoder_compliance.rs":"b0ed26b0762d8dfc23532efb724789366ca343f7354a76216b3fb426c6915e5a","tests/encoder.rs":"4c2430ad514fe64e28b89d0bd7ad7d299fbda8df903304ddcda704ce5db20382","tests/encoder_compliance.rs":"eeaa92f9cb4ee008830006e78277dfea9c041bc923a0ef5538d79aeb95f022c0","tests/testsuite/de_errors.rs":"1bc8521181f9fbe884db3313a8e8a044b4a1cf4b8956530a3cc8be9bcb5468f8","tests/testsuite/display.rs":"164de8f7108ce1055159a19884d23f770bd25cf0ead6b23f6ff4340931c7afc5","tests/testsuite/display_tricky.rs":"9806743d670e5cc46ee0ffda3f4c1f8ac63ee1e702250f07b7cd2098750d25d1","tests/testsuite/enum_external_deserialize.rs":"28b4705d904b58a973ef27c6cdc948f8d404105f98a55efa111cce9e7b4b1a67","tests/testsuite/float.rs":"6be604bb11adb315ad01fdf7117db620508d38caedaaea63e777d7ed2e5e4973","tests/testsuite/formatting.rs":"3b279ab1f24ebeb07537764107c42be9a84731ead1a88596785186777aafd1ee","tests/testsuite/macros.rs":"cf99ad3b191b68e044d0b01aa01ae959ed8b98ae466b9b0491bae1939af3832c","tests/testsuite/main.rs":"4e40c82147ccfc7094f2c4795b51b575c7d231a7da75814a08fd8e0c52d93f8b","tests/testsuite/pretty.rs":"e03df1f3ebe5bb98f6cc0888f0c6bcdcdb92c9c7ea2cd5acaa33ca751bf260e7","tests/testsuite/serde.rs":"9b5edf6ac8cfe8d5c96921f45b7cf6ab2c3d777c3889173e7a643903a626b599","tests/testsuite/spanned.rs":"b7522afd8101ba5dd539118a43bccefef66fedef41926d9515f67590961ac7e3","tests/testsuite/spanned_impls.rs":"666c65679365451f67234d50bb3198ac52418ad7ef1dae6916faba78f92c9d02","tests/testsuite/tables_last.rs":"42271f9df94b28f36b934686d4a5c6196140a2975733d1344b6415cb9f1b92ed"},"package":"8ff9e3abce27ee2c9a37f9ad37238c1bdd4e789c84ba37df76aa4d528f5072cc"}
\ No newline at end of file diff --git a/vendor/toml/Cargo.lock b/vendor/toml/Cargo.lock index 7bf050684..365e4b8ba 100644 --- a/vendor/toml/Cargo.lock +++ b/vendor/toml/Cargo.lock @@ -421,9 +421,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.56" +version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" +checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" dependencies = [ "unicode-ident", ] @@ -470,9 +470,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.11" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "same-file" @@ -516,9 +516,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" +checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" dependencies = [ "serde", ] @@ -608,13 +608,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.6" +version = "0.8.6" dependencies = [ "indexmap", "serde", "serde_json", "serde_spanned", "snapbox", + "toml-test-data", "toml-test-harness", "toml_datetime", "toml_edit", @@ -622,29 +623,30 @@ dependencies = [ [[package]] name = "toml-test" -version = "0.3.4" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37351256790aa1dbd6d60f4ff08e55e7f372e292f3e9040d6e077463d9a779c3" +checksum = "1ec3892835fb31e181a87e1758275a64b0d7c6c9e9618aeb61a647bd487314c0" dependencies = [ "chrono", + "ryu", "serde", "serde_json", ] [[package]] name = "toml-test-data" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f351b6d6005ee802b0d4a53ca1cdf05636f441df4d299e62cba57f1da52646" +checksum = "0082ae0d631f97530e98829c4101ae3ce3f1821a88f0a04be4fc3eaca5e7ed2d" dependencies = [ "include_dir", ] [[package]] name = "toml-test-harness" -version = "0.4.3" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e00fda5710922fe6b3005bf6a5050c303d6f9625249c37b7386e8818f4af675" +checksum = "1be4b8d761dee51b4694e9f1d622a1d7f9c135a8b8265459e16d09ac5b16a05d" dependencies = [ "ignore", "libtest-mimic", @@ -654,18 +656,18 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.19.12" +version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c500344a19072298cd05a7224b3c0c629348b78692bf48466c5238656e315a78" +checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" dependencies = [ "indexmap", "serde", @@ -883,9 +885,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.4.6" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61de7bac303dc551fe038e2b3cef0f571087a47571ea6e79a87692ac99b99699" +checksum = "81fac9742fd1ad1bd9643b991319f72dd031016d44b77039a26977eb667141e7" dependencies = [ "memchr", ] diff --git a/vendor/toml/Cargo.toml b/vendor/toml/Cargo.toml index 02f89eb0a..656d2af19 100644 --- a/vendor/toml/Cargo.toml +++ b/vendor/toml/Cargo.toml @@ -11,9 +11,9 @@ [package] edition = "2021" -rust-version = "1.64.0" +rust-version = "1.67" name = "toml" -version = "0.7.6" +version = "0.8.6" authors = ["Alex Crichton <alex@alexcrichton.com>"] include = [ "build.rs", @@ -47,6 +47,7 @@ license = "MIT OR Apache-2.0" repository = "https://github.com/toml-rs/toml" [package.metadata.docs.rs] +all-features = true rustdoc-args = [ "--cfg", "docsrs", @@ -124,15 +125,15 @@ optional = true version = "1.0.145" [dependencies.serde_spanned] -version = "0.6.3" +version = "0.6.4" features = ["serde"] [dependencies.toml_datetime] -version = "0.6.3" +version = "0.6.5" features = ["serde"] [dependencies.toml_edit] -version = "0.19.12" +version = "0.20.7" features = ["serde"] optional = true @@ -146,8 +147,11 @@ version = "1.0.96" [dev-dependencies.snapbox] version = "0.4.11" +[dev-dependencies.toml-test-data] +version = "1.4.0" + [dev-dependencies.toml-test-harness] -version = "0.4.3" +version = "0.4.8" [features] default = [ diff --git a/vendor/toml/LICENSE-APACHE b/vendor/toml/LICENSE-APACHE index 16fe87b06..8f71f43fe 100644 --- a/vendor/toml/LICENSE-APACHE +++ b/vendor/toml/LICENSE-APACHE @@ -1,201 +1,202 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/vendor/toml/LICENSE-MIT b/vendor/toml/LICENSE-MIT index 39e0ed660..a2d01088b 100644 --- a/vendor/toml/LICENSE-MIT +++ b/vendor/toml/LICENSE-MIT @@ -1,25 +1,19 @@ -Copyright (c) 2014 Alex Crichton +Copyright (c) Individual contributors -Permission is hereby granted, free of charge, to any -person obtaining a copy of this software and associated -documentation files (the "Software"), to deal in the -Software without restriction, including without -limitation the rights to use, copy, modify, merge, -publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software -is furnished to do so, subject to the following -conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice -shall be included in all copies or substantial portions -of the Software. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/toml/src/fmt.rs b/vendor/toml/src/fmt.rs index 0e96bf050..281cb59c1 100644 --- a/vendor/toml/src/fmt.rs +++ b/vendor/toml/src/fmt.rs @@ -1,6 +1,7 @@ #[derive(Copy, Clone, Default)] pub(crate) struct DocumentFormatter { pub(crate) multiline_array: bool, + is_value: bool, } impl toml_edit::visit_mut::VisitMut for DocumentFormatter { @@ -9,21 +10,26 @@ impl toml_edit::visit_mut::VisitMut for DocumentFormatter { } fn visit_item_mut(&mut self, node: &mut toml_edit::Item) { - let other = std::mem::take(node); - let other = match other.into_table().map(toml_edit::Item::Table) { - Ok(i) => i, - Err(i) => i, - }; - let other = match other - .into_array_of_tables() - .map(toml_edit::Item::ArrayOfTables) - { - Ok(i) => i, - Err(i) => i, - }; - *node = other; + let is_parent_value = self.is_value; + if !is_parent_value { + let other = std::mem::take(node); + let other = match other.into_table().map(toml_edit::Item::Table) { + Ok(i) => i, + Err(i) => i, + }; + let other = match other + .into_array_of_tables() + .map(toml_edit::Item::ArrayOfTables) + { + Ok(i) => i, + Err(i) => i, + }; + self.is_value = other.is_value(); + *node = other; + } toml_edit::visit_mut::visit_item_mut(self, node); + self.is_value = is_parent_value; } fn visit_table_mut(&mut self, node: &mut toml_edit::Table) { diff --git a/vendor/toml/src/macros.rs b/vendor/toml/src/macros.rs index d86cc52f5..a29597006 100644 --- a/vendor/toml/src/macros.rs +++ b/vendor/toml/src/macros.rs @@ -198,15 +198,15 @@ macro_rules! toml_internal { }}; (@value (-nan)) => { - $crate::Value::Float(-::std::f64::NAN) + $crate::Value::Float(::std::f64::NAN.copysign(-1.0)) }; (@value (nan)) => { - $crate::Value::Float(::std::f64::NAN) + $crate::Value::Float(::std::f64::NAN.copysign(1.0)) }; (@value nan) => { - $crate::Value::Float(::std::f64::NAN) + $crate::Value::Float(::std::f64::NAN.copysign(1.0)) }; (@value (-inf)) => { diff --git a/vendor/toml/src/value.rs b/vendor/toml/src/value.rs index 2785d9de9..e6f832a78 100644 --- a/vendor/toml/src/value.rs +++ b/vendor/toml/src/value.rs @@ -770,6 +770,13 @@ impl<'de> serde::de::VariantAccess<'de> for MapEnumDeserializer { fn unit_variant(self) -> Result<(), Self::Error> { use de::Error; match self.value { + Value::Array(values) => { + if values.is_empty() { + Ok(()) + } else { + Err(Error::custom("expected empty array")) + } + } Value::Table(values) => { if values.is_empty() { Ok(()) @@ -797,8 +804,15 @@ impl<'de> serde::de::VariantAccess<'de> for MapEnumDeserializer { { use de::Error; match self.value { + Value::Array(values) => { + if values.len() == len { + serde::de::Deserializer::deserialize_seq(values.into_deserializer(), visitor) + } else { + Err(Error::custom(format!("expected tuple with length {}", len))) + } + } Value::Table(values) => { - let tuple_values = values + let tuple_values: Result<Vec<_>, _> = values .into_iter() .enumerate() .map(|(index, (key, value))| match key.parse::<usize>() { @@ -808,17 +822,8 @@ impl<'de> serde::de::VariantAccess<'de> for MapEnumDeserializer { index, key ))), }) - // Fold all values into a `Vec`, or return the first error. - .fold(Ok(Vec::with_capacity(len)), |result, value_result| { - result.and_then(move |mut tuple_values| match value_result { - Ok(value) => { - tuple_values.push(value); - Ok(tuple_values) - } - // `Result<de::Value, Self::Error>` to `Result<Vec<_>, Self::Error>` - Err(e) => Err(e), - }) - })?; + .collect(); + let tuple_values = tuple_values?; if tuple_values.len() == len { serde::de::Deserializer::deserialize_seq( @@ -870,10 +875,10 @@ impl ser::Serializer for ValueSerializer { type SerializeSeq = ValueSerializeVec; type SerializeTuple = ValueSerializeVec; type SerializeTupleStruct = ValueSerializeVec; - type SerializeTupleVariant = ValueSerializeVec; + type SerializeTupleVariant = ValueSerializeTupleVariant; type SerializeMap = ValueSerializeMap; type SerializeStruct = ValueSerializeMap; - type SerializeStructVariant = ser::Impossible<Value, crate::ser::Error>; + type SerializeStructVariant = ValueSerializeStructVariant; fn serialize_bool(self, value: bool) -> Result<Value, crate::ser::Error> { Ok(Value::Boolean(value)) @@ -916,10 +921,14 @@ impl ser::Serializer for ValueSerializer { } fn serialize_f32(self, value: f32) -> Result<Value, crate::ser::Error> { - self.serialize_f64(value.into()) + self.serialize_f64(value as f64) } - fn serialize_f64(self, value: f64) -> Result<Value, crate::ser::Error> { + fn serialize_f64(self, mut value: f64) -> Result<Value, crate::ser::Error> { + // Discard sign of NaN. See ValueSerializer::serialize_f64. + if value.is_nan() { + value = value.copysign(1.0); + } Ok(Value::Float(value)) } @@ -1015,10 +1024,10 @@ impl ser::Serializer for ValueSerializer { self, _name: &'static str, _variant_index: u32, - _variant: &'static str, + variant: &'static str, len: usize, ) -> Result<Self::SerializeTupleVariant, crate::ser::Error> { - self.serialize_seq(Some(len)) + Ok(ValueSerializeTupleVariant::tuple(variant, len)) } fn serialize_map(self, _len: Option<usize>) -> Result<Self::SerializeMap, crate::ser::Error> { @@ -1040,12 +1049,12 @@ impl ser::Serializer for ValueSerializer { fn serialize_struct_variant( self, - name: &'static str, + _name: &'static str, _variant_index: u32, - _variant: &'static str, - _len: usize, + variant: &'static str, + len: usize, ) -> Result<Self::SerializeStructVariant, crate::ser::Error> { - Err(crate::ser::Error::unsupported_type(Some(name))) + Ok(ValueSerializeStructVariant::struct_(variant, len)) } } @@ -1453,3 +1462,76 @@ impl<'a, 'de> de::Visitor<'de> for DatetimeOrTable<'a> { } } } + +type ValueSerializeTupleVariant = ValueSerializeVariant<ValueSerializeVec>; +type ValueSerializeStructVariant = ValueSerializeVariant<ValueSerializeMap>; + +struct ValueSerializeVariant<T> { + variant: &'static str, + inner: T, +} + +impl ValueSerializeVariant<ValueSerializeVec> { + pub(crate) fn tuple(variant: &'static str, len: usize) -> Self { + Self { + variant, + inner: ValueSerializeVec { + vec: Vec::with_capacity(len), + }, + } + } +} + +impl ValueSerializeVariant<ValueSerializeMap> { + pub(crate) fn struct_(variant: &'static str, len: usize) -> Self { + Self { + variant, + inner: ValueSerializeMap { + ser: SerializeMap { + map: Table::with_capacity(len), + next_key: None, + }, + }, + } + } +} + +impl serde::ser::SerializeTupleVariant for ValueSerializeVariant<ValueSerializeVec> { + type Ok = crate::Value; + type Error = crate::ser::Error; + + fn serialize_field<T: ?Sized>(&mut self, value: &T) -> Result<(), Self::Error> + where + T: serde::ser::Serialize, + { + serde::ser::SerializeSeq::serialize_element(&mut self.inner, value) + } + + fn end(self) -> Result<Self::Ok, Self::Error> { + let inner = serde::ser::SerializeSeq::end(self.inner)?; + let mut table = Table::new(); + table.insert(self.variant.to_owned(), inner); + Ok(Value::Table(table)) + } +} + +impl serde::ser::SerializeStructVariant for ValueSerializeVariant<ValueSerializeMap> { + type Ok = crate::Value; + type Error = crate::ser::Error; + + #[inline] + fn serialize_field<T>(&mut self, key: &'static str, value: &T) -> Result<(), Self::Error> + where + T: serde::ser::Serialize + ?Sized, + { + serde::ser::SerializeStruct::serialize_field(&mut self.inner, key, value) + } + + #[inline] + fn end(self) -> Result<Self::Ok, Self::Error> { + let inner = serde::ser::SerializeStruct::end(self.inner)?; + let mut table = Table::new(); + table.insert(self.variant.to_owned(), inner); + Ok(Value::Table(table)) + } +} diff --git a/vendor/toml/tests/decoder.rs b/vendor/toml/tests/decoder.rs index fe6db3f5e..5af906f36 100644 --- a/vendor/toml/tests/decoder.rs +++ b/vendor/toml/tests/decoder.rs @@ -11,9 +11,10 @@ impl toml_test_harness::Decoder for Decoder { fn decode(&self, data: &[u8]) -> Result<toml_test_harness::Decoded, toml_test_harness::Error> { let data = std::str::from_utf8(data).map_err(toml_test_harness::Error::new)?; let document = data - .parse::<toml::Value>() + .parse::<toml::Table>() .map_err(toml_test_harness::Error::new)?; - value_to_decoded(&document) + let value = toml::Value::Table(document); + value_to_decoded(&value) } } diff --git a/vendor/toml/tests/decoder_compliance.rs b/vendor/toml/tests/decoder_compliance.rs index 5d4fc2a4d..582888371 100644 --- a/vendor/toml/tests/decoder_compliance.rs +++ b/vendor/toml/tests/decoder_compliance.rs @@ -4,16 +4,8 @@ mod decoder; fn main() { let decoder = decoder::Decoder; let mut harness = toml_test_harness::DecoderHarness::new(decoder); - harness - .ignore([ - "valid/spec/float-0.toml", - // Unreleased - "valid/string/escape-esc.toml", - "valid/string/hex-escape.toml", - "valid/datetime/no-seconds.toml", - "valid/inline-table/newline.toml", - ]) - .unwrap(); + harness.version("1.0.0"); + harness.ignore([]).unwrap(); harness.test(); } diff --git a/vendor/toml/tests/encoder.rs b/vendor/toml/tests/encoder.rs index eda62963c..e76a74a26 100644 --- a/vendor/toml/tests/encoder.rs +++ b/vendor/toml/tests/encoder.rs @@ -10,7 +10,10 @@ impl toml_test_harness::Encoder for Encoder { fn encode(&self, data: toml_test_harness::Decoded) -> Result<String, toml_test_harness::Error> { let value = from_decoded(&data)?; - let s = toml::to_string(&value).map_err(toml_test_harness::Error::new)?; + let toml::Value::Table(document) = value else { + return Err(toml_test_harness::Error::new("no root table")); + }; + let s = toml::to_string(&document).map_err(toml_test_harness::Error::new)?; Ok(s) } } diff --git a/vendor/toml/tests/encoder_compliance.rs b/vendor/toml/tests/encoder_compliance.rs index 380724831..c593e5967 100644 --- a/vendor/toml/tests/encoder_compliance.rs +++ b/vendor/toml/tests/encoder_compliance.rs @@ -6,7 +6,7 @@ fn main() { let encoder = encoder::Encoder; let decoder = decoder::Decoder; let mut harness = toml_test_harness::EncoderHarness::new(encoder, decoder); - harness.ignore(["valid/spec/float-0.toml"]).unwrap(); + harness.version("1.0.0"); harness.test(); } diff --git a/vendor/toml/tests/testsuite/float.rs b/vendor/toml/tests/testsuite/float.rs index d00813471..1d9ce1a32 100644 --- a/vendor/toml/tests/testsuite/float.rs +++ b/vendor/toml/tests/testsuite/float.rs @@ -47,7 +47,7 @@ macro_rules! float_inf_tests { assert!(inf.sf5.is_nan()); assert!(inf.sf5.is_sign_positive()); assert!(inf.sf6.is_nan()); - assert!(inf.sf6.is_sign_negative()); + assert!(inf.sf6.is_sign_negative()); // NOTE: serializes to just `nan` assert_eq!(inf.sf7, 0.0); assert!(inf.sf7.is_sign_positive()); @@ -63,7 +63,7 @@ sf2 = inf sf3 = -inf sf4 = nan sf5 = nan -sf6 = -nan +sf6 = nan sf7 = 0.0 sf8 = -0.0 " diff --git a/vendor/toml/tests/testsuite/macros.rs b/vendor/toml/tests/testsuite/macros.rs index 510070510..e002cd914 100644 --- a/vendor/toml/tests/testsuite/macros.rs +++ b/vendor/toml/tests/testsuite/macros.rs @@ -198,9 +198,18 @@ fn test_nan() { sf5 = +nan sf6 = -nan }; - assert!(actual["sf4"].as_float().unwrap().is_nan()); - assert!(actual["sf5"].as_float().unwrap().is_nan()); - assert!(actual["sf6"].as_float().unwrap().is_nan()); + + let sf4 = actual["sf4"].as_float().unwrap(); + assert!(sf4.is_nan()); + assert!(sf4.is_sign_positive()); + + let sf5 = actual["sf5"].as_float().unwrap(); + assert!(sf5.is_nan()); + assert!(sf5.is_sign_positive()); + + let sf6 = actual["sf6"].as_float().unwrap(); + assert!(sf6.is_nan()); + assert!(sf6.is_sign_negative()); } #[test] diff --git a/vendor/toml/tests/testsuite/pretty.rs b/vendor/toml/tests/testsuite/pretty.rs index 3ae772b4f..369888fbb 100644 --- a/vendor/toml/tests/testsuite/pretty.rs +++ b/vendor/toml/tests/testsuite/pretty.rs @@ -47,7 +47,7 @@ fn pretty_std() { assert_eq(toml, &result); } -const PRETTY_TRICKY: &str = r##"[example] +const PRETTY_TRICKY: &str = r#"[example] f = "\f" glass = """ Nothing too unusual, except that I can eat glass in: @@ -72,7 +72,7 @@ This has a ''' in it and \"\"\" cuz it's tricky yo Also ' and \" because why not this is the fourth line """ -"##; +"#; #[test] fn pretty_tricky() { @@ -85,7 +85,7 @@ fn pretty_tricky() { assert_eq(toml, &result); } -const PRETTY_TABLE_ARRAY: &str = r##"[[array]] +const PRETTY_TABLE_ARRAY: &str = r#"[[array]] key = "foo" [[array]] @@ -96,7 +96,7 @@ doc = "this is a table" [example] single = "this is a single line string" -"##; +"#; #[test] fn pretty_table_array() { @@ -109,7 +109,7 @@ fn pretty_table_array() { assert_eq(toml, &result); } -const TABLE_ARRAY: &str = r##"[[array]] +const TABLE_ARRAY: &str = r#"[[array]] key = "foo" [[array]] @@ -120,7 +120,7 @@ doc = "this is a table" [example] single = "this is a single line string" -"##; +"#; #[test] fn table_array() { diff --git a/vendor/toml/tests/testsuite/serde.rs b/vendor/toml/tests/testsuite/serde.rs index 6e927f733..d9d7a6db5 100644 --- a/vendor/toml/tests/testsuite/serde.rs +++ b/vendor/toml/tests/testsuite/serde.rs @@ -21,19 +21,26 @@ macro_rules! equivalent { let toml = $toml; let literal = $literal; - // In/out of Value is equivalent - println!("try_from"); - assert_eq!(t!(Table::try_from(literal.clone())), toml); - println!("try_into"); - assert_eq!(literal, t!(toml.clone().try_into())); - // Through a string equivalent println!("to_string"); - snapbox::assert_eq(t!(toml::to_string(&toml)), t!(toml::to_string(&literal))); + snapbox::assert_eq(t!(toml::to_string(&literal)), t!(toml::to_string(&toml))); println!("literal, from_str(toml)"); assert_eq!(literal, t!(toml::from_str(&t!(toml::to_string(&toml))))); - println!("toml, from_str(toml)"); - assert_eq!(toml, t!(toml::from_str(&t!(toml::to_string(&toml))))); + println!("toml, from_str(literal)"); + assert_eq!(toml, t!(toml::from_str(&t!(toml::to_string(&literal))))); + + // In/out of Value is equivalent + println!("Table::try_from(literal)"); + assert_eq!(toml, t!(Table::try_from(literal.clone()))); + println!("Value::try_from(literal)"); + assert_eq!( + Value::Table(toml.clone()), + t!(Value::try_from(literal.clone())) + ); + println!("toml.try_into()"); + assert_eq!(literal, t!(toml.clone().try_into())); + println!("Value::Table(toml).try_into()"); + assert_eq!(literal, t!(Value::Table(toml.clone()).try_into())); }}; } @@ -377,6 +384,106 @@ fn parse_enum_string() { } #[test] +fn parse_tuple_variant() { + #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] + struct Document { + inner: Vec<Enum>, + } + + #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] + enum Enum { + Int(i32, i32), + String(String, String), + } + + let input = Document { + inner: vec![ + Enum::Int(1, 1), + Enum::String("2".to_owned(), "2".to_owned()), + ], + }; + let expected = "[[inner]] +Int = [1, 1] + +[[inner]] +String = [\"2\", \"2\"] +"; + let raw = toml::to_string(&input).unwrap(); + snapbox::assert_eq(expected, raw); + + equivalent! { + Document { + inner: vec![ + Enum::Int(1, 1), + Enum::String("2".to_owned(), "2".to_owned()), + ], + }, + map! { + inner: vec![ + map! { Int: [1, 1] }, + map! { String: ["2".to_owned(), "2".to_owned()] }, + ] + }, + } +} + +#[test] +fn parse_struct_variant() { + #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] + struct Document { + inner: Vec<Enum>, + } + + #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] + enum Enum { + Int { first: i32, second: i32 }, + String { first: String, second: String }, + } + + let input = Document { + inner: vec![ + Enum::Int { + first: 1, + second: 1, + }, + Enum::String { + first: "2".to_owned(), + second: "2".to_owned(), + }, + ], + }; + let expected = "[[inner]] + +[inner.Int] +first = 1 +second = 1 + +[[inner]] + +[inner.String] +first = \"2\" +second = \"2\" +"; + let raw = toml::to_string(&input).unwrap(); + snapbox::assert_eq(expected, raw); + + equivalent! { + Document { + inner: vec![ + Enum::Int { first: 1, second: 1 }, + Enum::String { first: "2".to_owned(), second: "2".to_owned() }, + ], + }, + map! { + inner: vec![ + map! { Int: map! { first: 1, second: 1 } }, + map! { String: map! { first: "2".to_owned(), second: "2".to_owned() } }, + ] + }, + } +} + +#[test] #[cfg(feature = "preserve_order")] fn map_key_unit_variants() { #[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone, PartialOrd, Ord)] @@ -635,6 +742,25 @@ fn newtype_variant() { } } +#[test] +fn newtype_key() { + #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Serialize, Deserialize)] + struct NewType(String); + + type CustomKeyMap = std::collections::BTreeMap<NewType, u32>; + + equivalent! { + [ + (NewType("x".to_owned()), 1), + (NewType("y".to_owned()), 2), + ].into_iter().collect::<CustomKeyMap>(), + map! { + x: Value::Integer(1), + y: Value::Integer(2) + }, + } +} + #[derive(Debug, Default, PartialEq, Serialize, Deserialize)] struct CanBeEmpty { a: Option<String>, @@ -1094,3 +1220,129 @@ fn datetime_offset_issue_496() { let output = toml.to_string(); snapbox::assert_eq(original, output); } + +#[test] +fn serialize_array_with_none_value() { + #[derive(Serialize)] + struct Document { + values: Vec<Option<usize>>, + } + + let input = Document { + values: vec![Some(1), Some(2), Some(3)], + }; + let expected = "values = [1, 2, 3]\n"; + let raw = toml::to_string(&input).unwrap(); + snapbox::assert_eq(expected, raw); + + let input = Document { + values: vec![Some(1), None, Some(3)], + }; + let err = toml::to_string(&input).unwrap_err(); + snapbox::assert_eq("unsupported None value", err.to_string()); +} + +#[test] +fn serialize_array_with_optional_struct_field() { + #[derive(Debug, Deserialize, Serialize)] + struct Document { + values: Vec<OptionalField>, + } + + #[derive(Debug, Deserialize, Serialize)] + struct OptionalField { + x: u8, + y: Option<u8>, + } + + let input = Document { + values: vec![ + OptionalField { x: 0, y: Some(4) }, + OptionalField { x: 2, y: Some(5) }, + OptionalField { x: 3, y: Some(7) }, + ], + }; + let expected = "\ +[[values]] +x = 0 +y = 4 + +[[values]] +x = 2 +y = 5 + +[[values]] +x = 3 +y = 7 +"; + let raw = toml::to_string(&input).unwrap(); + snapbox::assert_eq(expected, raw); + + let input = Document { + values: vec![ + OptionalField { x: 0, y: Some(4) }, + OptionalField { x: 2, y: None }, + OptionalField { x: 3, y: Some(7) }, + ], + }; + let expected = "\ +[[values]] +x = 0 +y = 4 + +[[values]] +x = 2 + +[[values]] +x = 3 +y = 7 +"; + let raw = toml::to_string(&input).unwrap(); + snapbox::assert_eq(expected, raw); +} + +#[test] +fn serialize_array_with_enum_of_optional_struct_field() { + #[derive(Debug, Deserialize, Serialize)] + struct Document { + values: Vec<Choice>, + } + + #[derive(Debug, Deserialize, Serialize)] + enum Choice { + Optional(OptionalField), + Empty, + } + + #[derive(Debug, Deserialize, Serialize)] + struct OptionalField { + x: u8, + y: Option<u8>, + } + + let input = Document { + values: vec![ + Choice::Optional(OptionalField { x: 0, y: Some(4) }), + Choice::Empty, + Choice::Optional(OptionalField { x: 2, y: Some(5) }), + Choice::Optional(OptionalField { x: 3, y: Some(7) }), + ], + }; + let expected = "values = [{ Optional = { x = 0, y = 4 } }, \"Empty\", { Optional = { x = 2, y = 5 } }, { Optional = { x = 3, y = 7 } }] +"; + let raw = toml::to_string(&input).unwrap(); + snapbox::assert_eq(expected, raw); + + let input = Document { + values: vec![ + Choice::Optional(OptionalField { x: 0, y: Some(4) }), + Choice::Empty, + Choice::Optional(OptionalField { x: 2, y: None }), + Choice::Optional(OptionalField { x: 3, y: Some(7) }), + ], + }; + let expected = "values = [{ Optional = { x = 0, y = 4 } }, \"Empty\", { Optional = { x = 2 } }, { Optional = { x = 3, y = 7 } }] +"; + let raw = toml::to_string(&input).unwrap(); + snapbox::assert_eq(expected, raw); +} |