diff options
| author | Fuwn <[email protected]> | 2022-05-18 01:52:36 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-05-18 01:52:36 +0000 |
| commit | 11405ce0600d61f3772a7efe7fbd3de4cc2bf892 (patch) | |
| tree | 24ebda9cc59ae51b4e87fdde688fe009eaf420af /src/request/response.rs | |
| parent | chore(makefile): use --all-features (diff) | |
| download | germ-11405ce0600d61f3772a7efe7fbd3de4cc2bf892.tar.xz germ-11405ce0600d61f3772a7efe7fbd3de4cc2bf892.zip | |
fix: global clippy lint fixes
Diffstat (limited to 'src/request/response.rs')
| -rw-r--r-- | src/request/response.rs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/request/response.rs b/src/request/response.rs index 0202967..e96cee0 100644 --- a/src/request/response.rs +++ b/src/request/response.rs @@ -29,21 +29,18 @@ pub struct Response { pub suite: Option<SupportedCipherSuite>, } impl Response { - pub(super) fn new( - data: Vec<u8>, - suite: Option<SupportedCipherSuite>, - ) -> Self { - let string_form = String::from_utf8_lossy(&data).to_string(); + pub(super) fn new(data: &[u8], suite: Option<SupportedCipherSuite>) -> Self { + let string_form = String::from_utf8_lossy(data).to_string(); let mut content = None; let header; - if !string_form.ends_with("\r\n") { + if string_form.ends_with("\r\n") { + header = string_form; + } else { let mut string_split = string_form.split("\r\n"); header = string_split.next().unwrap_or("").to_string(); content = Some(string_split.collect()); - } else { - header = string_form; } let header_split = header.split_at(2); |