diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:57:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:57:31 +0000 |
commit | dc0db358abe19481e475e10c32149b53370f1a1c (patch) | |
tree | ab8ce99c4b255ce46f99ef402c27916055b899ee /vendor/form_urlencoded/src/lib.rs | |
parent | Releasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff) | |
download | rustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip |
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/form_urlencoded/src/lib.rs')
-rw-r--r-- | vendor/form_urlencoded/src/lib.rs | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/vendor/form_urlencoded/src/lib.rs b/vendor/form_urlencoded/src/lib.rs index 477594bf7..30221ad22 100644 --- a/vendor/form_urlencoded/src/lib.rs +++ b/vendor/form_urlencoded/src/lib.rs @@ -12,10 +12,21 @@ //! //! Converts between a string (such as an URL’s query string) //! and a sequence of (name, value) pairs. +#![no_std] +// For forwards compatibility +#[cfg(feature = "std")] +extern crate std as _; + +extern crate alloc; + +#[cfg(not(feature = "alloc"))] +compile_error!("the `alloc` feature must currently be enabled"); + +use alloc::borrow::{Borrow, Cow, ToOwned}; +use alloc::string::String; +use core::str; use percent_encoding::{percent_decode, percent_encode_byte}; -use std::borrow::{Borrow, Cow}; -use std::str; /// Convert a byte string in the `application/x-www-form-urlencoded` syntax /// into a iterator of (name, value) pairs. @@ -186,7 +197,7 @@ impl Target for String { impl<'a> Target for &'a mut String { fn as_mut_string(&mut self) -> &mut String { - &mut **self + self } fn finish(self) -> Self { self @@ -282,7 +293,7 @@ impl<'a, T: Target> Serializer<'a, T> { { let string = string(&mut self.target); for pair in iter { - let &(ref k, ref v) = pair.borrow(); + let (k, v) = pair.borrow(); append_pair( string, self.start_position, |