summaryrefslogtreecommitdiffstats
path: root/vendor/percent-encoding
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/percent-encoding')
-rw-r--r--vendor/percent-encoding/.cargo-checksum.json2
-rw-r--r--vendor/percent-encoding/Cargo.toml6
-rw-r--r--vendor/percent-encoding/src/lib.rs17
3 files changed, 18 insertions, 7 deletions
diff --git a/vendor/percent-encoding/.cargo-checksum.json b/vendor/percent-encoding/.cargo-checksum.json
index e37d79346..2c386c100 100644
--- a/vendor/percent-encoding/.cargo-checksum.json
+++ b/vendor/percent-encoding/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"Cargo.toml":"7330cca9fe75c0f7cadf87d42f1af587e57d7f3e90efad7b4476d8d78580e435","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"76e972ac0f4ddb116e86e10100132a783931a596e7b9872eaa31be15cd4d751d","src/lib.rs":"5eafa40dda1d5de9770181b836c37b078f790ccdee4f461d4601fc5bc17716b8"},"package":"478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"} \ No newline at end of file
+{"files":{"Cargo.toml":"876192ec0c492d9e09d2835252e1f75c7988cebb0b9bc9cfcfe47250d9481429","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"76e972ac0f4ddb116e86e10100132a783931a596e7b9872eaa31be15cd4d751d","src/lib.rs":"9f55aebbabb7e07c64382218a16477b95ba7120d5655d318c3d4dfe7721aa531"},"package":"9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"} \ No newline at end of file
diff --git a/vendor/percent-encoding/Cargo.toml b/vendor/percent-encoding/Cargo.toml
index 53d0b6307..048ffc900 100644
--- a/vendor/percent-encoding/Cargo.toml
+++ b/vendor/percent-encoding/Cargo.toml
@@ -13,12 +13,14 @@
edition = "2018"
rust-version = "1.51"
name = "percent-encoding"
-version = "2.2.0"
+version = "2.3.0"
authors = ["The rust-url developers"]
description = "Percent encoding and decoding"
+categories = ["no_std"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/servo/rust-url/"
[features]
alloc = []
-default = ["alloc"]
+default = ["std"]
+std = ["alloc"]
diff --git a/vendor/percent-encoding/src/lib.rs b/vendor/percent-encoding/src/lib.rs
index 46a5d747c..e02a43949 100644
--- a/vendor/percent-encoding/src/lib.rs
+++ b/vendor/percent-encoding/src/lib.rs
@@ -36,8 +36,12 @@
//!
//! assert_eq!(utf8_percent_encode("foo <bar>", FRAGMENT).to_string(), "foo%20%3Cbar%3E");
//! ```
-
#![no_std]
+
+// For forwards compatibility
+#[cfg(feature = "std")]
+extern crate std as _;
+
#[cfg(feature = "alloc")]
extern crate alloc;
@@ -180,9 +184,9 @@ pub const NON_ALPHANUMERIC: &AsciiSet = &CONTROLS
/// assert_eq!("foo bar".bytes().map(percent_encode_byte).collect::<String>(),
/// "%66%6F%6F%20%62%61%72");
/// ```
+#[inline]
pub fn percent_encode_byte(byte: u8) -> &'static str {
- let index = usize::from(byte) * 3;
- &"\
+ static ENC_TABLE: &[u8; 768] = b"\
%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F\
%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F\
%20%21%22%23%24%25%26%27%28%29%2A%2B%2C%2D%2E%2F\
@@ -199,7 +203,12 @@ pub fn percent_encode_byte(byte: u8) -> &'static str {
%D0%D1%D2%D3%D4%D5%D6%D7%D8%D9%DA%DB%DC%DD%DE%DF\
%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE%EF\
%F0%F1%F2%F3%F4%F5%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF\
- "[index..index + 3]
+ ";
+
+ let index = usize::from(byte) * 3;
+ // SAFETY: ENC_TABLE is ascii-only, so any subset if it should be
+ // ascii-only too, which is valid utf8.
+ unsafe { str::from_utf8_unchecked(&ENC_TABLE[index..index + 3]) }
}
/// Percent-encode the given bytes with the given set.