perf: remove unused enum member
This commit is contained in:
		
							parent
							
								
									794a2f8f7e
								
							
						
					
					
						commit
						1b43717a31
					
				
					 2 changed files with 3 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -3,7 +3,6 @@ use std::{error::Error, io::prelude::*, net::TcpStream};
 | 
			
		|||
use super::requests::Request;
 | 
			
		||||
 | 
			
		||||
pub enum Body {
 | 
			
		||||
    String(String),
 | 
			
		||||
    Static(&'static str),
 | 
			
		||||
    Bytes(Vec<u8>, &'static str),
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -57,7 +56,6 @@ fn send_response(mut stream: TcpStream, status: u16, body: Body) -> UnitOrBoxedE
 | 
			
		|||
    response.push_str(&format!(
 | 
			
		||||
        "Content-Length: {}\r\n",
 | 
			
		||||
        match &body {
 | 
			
		||||
            Body::String(s) => s.len(),
 | 
			
		||||
            Body::Static(s) => s.len(),
 | 
			
		||||
            Body::Bytes(b, _) => b.len(),
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -68,16 +66,11 @@ fn send_response(mut stream: TcpStream, status: u16, body: Body) -> UnitOrBoxedE
 | 
			
		|||
            response.push_str("Cache-Control: immutable, public, max-age=604800\r\n");
 | 
			
		||||
        }
 | 
			
		||||
        Body::Static(_) => response.push_str("Content-Type: text/plain; charset=utf-8\r\n"),
 | 
			
		||||
        _ => {}
 | 
			
		||||
    }
 | 
			
		||||
    response.push_str("\r\n");
 | 
			
		||||
 | 
			
		||||
    // Body
 | 
			
		||||
    match &body {
 | 
			
		||||
        Body::String(s) => response.push_str(s),
 | 
			
		||||
        Body::Static(s) => response.push_str(s),
 | 
			
		||||
        _ => {}
 | 
			
		||||
    }
 | 
			
		||||
    if let Body::Static(s) = &body { response.push_str(s) }
 | 
			
		||||
 | 
			
		||||
    match stream.write(response.as_bytes()) {
 | 
			
		||||
        Ok(_) => {}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -133,7 +133,7 @@ fn main() {
 | 
			
		|||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if let Some(_) = req.url.query.get("discord_compatibility") {
 | 
			
		||||
            if req.url.query.contains_key("discord_compatibility") {
 | 
			
		||||
                padding = 8;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -162,7 +162,7 @@ fn main() {
 | 
			
		|||
            icon_string = icon_string.replace("currentColor", svg_stroke);
 | 
			
		||||
 | 
			
		||||
            let mut backwards_compatibility = false;
 | 
			
		||||
            if let Some(_) = req.url.query.get("backwards_compatibility") {
 | 
			
		||||
            if req.url.query.contains_key("backwards_compatibility") {
 | 
			
		||||
                backwards_compatibility = true;
 | 
			
		||||
                // Icons were 80x80 plus 8px of padding; Icons start at 24x24 now so: 80 - 8 = 72, 72 / 24 = 3 therefore scale is 3x.
 | 
			
		||||
                scale = 3;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue