Skip to content

Commit ccf3ac4

Browse files
committed
make code a bit more readable
1 parent a174c6c commit ccf3ac4

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/core.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,30 @@ use crate::url::{clean_url, create_data_url, get_referer_url, parse_data_url, re
2020

2121
#[derive(Default)]
2222
pub struct Options {
23-
pub no_audio: bool,
2423
pub base_url: Option<String>,
2524
pub blacklist_domains: bool,
26-
pub no_css: bool,
2725
// pub cache: Option<Cache>,
2826
pub cookies: Vec<Cookie>,
2927
pub domains: Option<Vec<String>>,
30-
pub ignore_errors: bool,
3128
pub encoding: Option<String>,
32-
pub no_frames: bool,
29+
pub ignore_errors: bool,
30+
pub insecure: bool,
31+
pub isolate: bool,
32+
pub no_audio: bool,
33+
pub no_color: bool,
34+
pub no_css: bool,
3335
pub no_fonts: bool,
36+
pub no_frames: bool,
3437
pub no_images: bool,
35-
pub isolate: bool,
3638
pub no_js: bool,
37-
pub insecure: bool,
3839
pub no_metadata: bool,
40+
pub no_video: bool,
3941
pub output: String,
4042
pub silent: bool,
41-
pub timeout: u64,
42-
pub user_agent: Option<String>,
43-
pub no_video: bool,
4443
pub target: String,
45-
pub no_color: bool,
44+
pub timeout: u64,
4645
pub unwrap_noscript: bool,
46+
pub user_agent: Option<String>,
4747
}
4848

4949
enum Output {
@@ -84,7 +84,7 @@ impl Output {
8484

8585
const ANSI_COLOR_RED: &'static str = "\x1b[31m";
8686
const ANSI_COLOR_RESET: &'static str = "\x1b[0m";
87-
const MAGIC: [[&[u8]; 2]; 18] = [
87+
const FILE_SIGNATURES: [[&[u8]; 2]; 18] = [
8888
// Image
8989
[b"GIF87a", b"image/gif"],
9090
[b"GIF89a", b"image/gif"],
@@ -382,9 +382,9 @@ pub fn create_monolithic_file(options: &Options, mut cache: &mut Cache) {
382382

383383
pub fn detect_media_type(data: &[u8], url: &Url) -> String {
384384
// At first attempt to read file's header
385-
for magic_item in MAGIC.iter() {
386-
if data.starts_with(magic_item[0]) {
387-
return String::from_utf8(magic_item[1].to_vec()).unwrap();
385+
for file_signature in FILE_SIGNATURES.iter() {
386+
if data.starts_with(file_signature[0]) {
387+
return String::from_utf8(file_signature[1].to_vec()).unwrap();
388388
}
389389
}
390390

0 commit comments

Comments
 (0)