mirror of
https://github.com/servo/servo.git
synced 2025-07-03 05:23:38 +01:00
Auto merge of #13652 - frewsxcv:variant-naming, r=jdm
Fix capitalization for enum variants. <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13652) <!-- Reviewable:end -->
This commit is contained in:
commit
3768ea2cc7
3 changed files with 30 additions and 30 deletions
|
@ -24,8 +24,8 @@ pub enum MediaType {
|
|||
}
|
||||
|
||||
pub enum ApacheBugFlag {
|
||||
ON,
|
||||
OFF
|
||||
On,
|
||||
Off
|
||||
}
|
||||
|
||||
impl ApacheBugFlag {
|
||||
|
@ -35,17 +35,17 @@ impl ApacheBugFlag {
|
|||
|| last_raw_content_type == b"text/plain; charset=ISO-8859-1"
|
||||
|| last_raw_content_type == b"text/plain; charset=iso-8859-1"
|
||||
|| last_raw_content_type == b"text/plain; charset=UTF-8" {
|
||||
ApacheBugFlag::ON
|
||||
ApacheBugFlag::On
|
||||
} else {
|
||||
ApacheBugFlag::OFF
|
||||
ApacheBugFlag::Off
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(PartialEq)]
|
||||
pub enum NoSniffFlag {
|
||||
ON,
|
||||
OFF
|
||||
On,
|
||||
Off
|
||||
}
|
||||
|
||||
pub type MimeType = (String, String);
|
||||
|
@ -70,10 +70,10 @@ impl MimeClassifier {
|
|||
self.sniff_unknown_type(no_sniff_flag, data)
|
||||
} else {
|
||||
match no_sniff_flag {
|
||||
NoSniffFlag::ON => supplied_type.clone(),
|
||||
NoSniffFlag::OFF => match apache_bug_flag {
|
||||
ApacheBugFlag::ON => self.sniff_text_or_data(data),
|
||||
ApacheBugFlag::OFF => match MimeClassifier::get_media_type(media_type,
|
||||
NoSniffFlag::On => supplied_type.clone(),
|
||||
NoSniffFlag::Off => match apache_bug_flag {
|
||||
ApacheBugFlag::On => self.sniff_text_or_data(data),
|
||||
ApacheBugFlag::Off => match MimeClassifier::get_media_type(media_type,
|
||||
media_subtype) {
|
||||
Some(MediaType::Html) => self.feeds_classifier.classify(data),
|
||||
Some(MediaType::Image) => self.image_classifier.classify(data),
|
||||
|
@ -180,7 +180,7 @@ impl MimeClassifier {
|
|||
|
||||
//some sort of iterator over the classifiers might be better?
|
||||
fn sniff_unknown_type(&self, no_sniff_flag: NoSniffFlag, data: &[u8]) -> MimeType {
|
||||
let should_sniff_scriptable = no_sniff_flag == NoSniffFlag::OFF;
|
||||
let should_sniff_scriptable = no_sniff_flag == NoSniffFlag::Off;
|
||||
let sniffed = if should_sniff_scriptable {
|
||||
self.scriptable_classifier.classify(data)
|
||||
} else {
|
||||
|
|
|
@ -101,8 +101,8 @@ pub fn start_sending_sniffed_opt(start_chan: LoadConsumer, mut metadata: Metadat
|
|||
-> Result<ProgressSender, ()> {
|
||||
if PREFS.get("network.mime.sniff").as_boolean().unwrap_or(false) {
|
||||
// TODO: should be calculated in the resource loader, from pull requeset #4094
|
||||
let mut no_sniff = NoSniffFlag::OFF;
|
||||
let mut check_for_apache_bug = ApacheBugFlag::OFF;
|
||||
let mut no_sniff = NoSniffFlag::Off;
|
||||
let mut check_for_apache_bug = ApacheBugFlag::Off;
|
||||
|
||||
if let Some(ref headers) = metadata.headers {
|
||||
if let Some(ref content_type) = headers.get_raw("content-type").and_then(|c| c.last()) {
|
||||
|
@ -110,7 +110,7 @@ pub fn start_sending_sniffed_opt(start_chan: LoadConsumer, mut metadata: Metadat
|
|||
}
|
||||
if let Some(ref raw_content_type_options) = headers.get_raw("X-content-type-options") {
|
||||
if raw_content_type_options.iter().any(|ref opt| *opt == b"nosniff") {
|
||||
no_sniff = NoSniffFlag::ON
|
||||
no_sniff = NoSniffFlag::On
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,8 +99,8 @@ fn test_sniff_full(filename_orig: &path::Path, type_string: &str, subtype_string
|
|||
type_string,
|
||||
subtype_string,
|
||||
supplied_type,
|
||||
NoSniffFlag::OFF,
|
||||
ApacheBugFlag::OFF)
|
||||
NoSniffFlag::Off,
|
||||
ApacheBugFlag::Off)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
@ -494,8 +494,8 @@ fn test_sniff_atom_feed_with_no_sniff_flag_on() {
|
|||
"text",
|
||||
"html",
|
||||
Some(("text", "html")),
|
||||
NoSniffFlag::ON,
|
||||
ApacheBugFlag::OFF);
|
||||
NoSniffFlag::On,
|
||||
ApacheBugFlag::Off);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -504,8 +504,8 @@ fn test_sniff_with_no_sniff_flag_on_and_apache_flag_on() {
|
|||
"text",
|
||||
"html",
|
||||
Some(("text", "html")),
|
||||
NoSniffFlag::ON,
|
||||
ApacheBugFlag::ON);
|
||||
NoSniffFlag::On,
|
||||
ApacheBugFlag::On);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -514,8 +514,8 @@ fn test_sniff_utf_8_bom_with_apache_flag_on() {
|
|||
"text",
|
||||
"plain",
|
||||
Some(("dummy", "text")),
|
||||
NoSniffFlag::OFF,
|
||||
ApacheBugFlag::ON);
|
||||
NoSniffFlag::Off,
|
||||
ApacheBugFlag::On);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -524,8 +524,8 @@ fn test_sniff_utf_16be_bom_with_apache_flag_on() {
|
|||
"text",
|
||||
"plain",
|
||||
Some(("dummy", "text")),
|
||||
NoSniffFlag::OFF,
|
||||
ApacheBugFlag::ON);
|
||||
NoSniffFlag::Off,
|
||||
ApacheBugFlag::On);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -534,8 +534,8 @@ fn test_sniff_utf_16le_bom_with_apache_flag_on() {
|
|||
"text",
|
||||
"plain",
|
||||
Some(("dummy", "text")),
|
||||
NoSniffFlag::OFF,
|
||||
ApacheBugFlag::ON);
|
||||
NoSniffFlag::Off,
|
||||
ApacheBugFlag::On);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -544,8 +544,8 @@ fn test_sniff_octet_stream_apache_flag_on() {
|
|||
"application",
|
||||
"octet-stream",
|
||||
Some(("dummy", "binary")),
|
||||
NoSniffFlag::OFF,
|
||||
ApacheBugFlag::ON);
|
||||
NoSniffFlag::Off,
|
||||
ApacheBugFlag::On);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -554,6 +554,6 @@ fn test_sniff_mp4_video_apache_flag_on() {
|
|||
"application",
|
||||
"octet-stream",
|
||||
Some(("video", "mp4")),
|
||||
NoSniffFlag::OFF,
|
||||
ApacheBugFlag::ON);
|
||||
NoSniffFlag::Off,
|
||||
ApacheBugFlag::On);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue