mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Use str::parse() rather than FromStr::from_str.
The former appears to be preferred.
This commit is contained in:
parent
3ece6bc166
commit
b49bd79625
5 changed files with 10 additions and 17 deletions
|
@ -13,7 +13,6 @@ use time::{Tm, now, at, Duration};
|
|||
use url::Url;
|
||||
use std::borrow::ToOwned;
|
||||
use std::net::{Ipv4Addr, Ipv6Addr};
|
||||
use std::str::FromStr;
|
||||
|
||||
/// A stored cookie that wraps the definition in cookie-rs. This is used to implement
|
||||
/// various behaviours defined in the spec that rely on an associated request URL,
|
||||
|
@ -128,8 +127,8 @@ impl Cookie {
|
|||
}
|
||||
if string.ends_with(domain_string)
|
||||
&& string.as_bytes()[string.len()-domain_string.len()-1] == b'.'
|
||||
&& Ipv4Addr::from_str(string).is_err()
|
||||
&& Ipv6Addr::from_str(string).is_err() {
|
||||
&& string.parse::<Ipv4Addr>().is_err()
|
||||
&& string.parse::<Ipv6Addr>().is_err() {
|
||||
return true;
|
||||
}
|
||||
false
|
||||
|
|
|
@ -184,7 +184,7 @@ impl Request {
|
|||
}
|
||||
// Step 2
|
||||
if self.context != Context::Fetch && !self.headers.has::<AcceptLanguage>() {
|
||||
self.headers.set(AcceptLanguage(vec![qitem(Language::from_str("en-US").unwrap())]));
|
||||
self.headers.set(AcceptLanguage(vec![qitem("en-US".parse().unwrap())]));
|
||||
}
|
||||
// TODO: Figure out what a Priority object is
|
||||
// Step 3
|
||||
|
|
|
@ -28,7 +28,6 @@ use std::collections::HashMap;
|
|||
use std::env;
|
||||
use std::fs::File;
|
||||
use std::io::{BufReader, Read};
|
||||
use std::str::FromStr;
|
||||
use std::sync::Arc;
|
||||
use std::sync::mpsc::{channel, Receiver, Sender};
|
||||
|
||||
|
@ -122,8 +121,8 @@ pub fn start_sending_sniffed_opt(start_chan: LoadConsumer, mut metadata: Metadat
|
|||
});
|
||||
metadata.content_type = classifier.classify(nosniff, check_for_apache_bug, &supplied_type,
|
||||
&partial_body).map(|(toplevel, sublevel)| {
|
||||
let mime_tp: TopLevel = FromStr::from_str(&toplevel).unwrap();
|
||||
let mime_sb: SubLevel = FromStr::from_str(&sublevel).unwrap();
|
||||
let mime_tp: TopLevel = toplevel.parse().unwrap();
|
||||
let mime_sb: SubLevel = sublevel.parse().unwrap();
|
||||
ContentType(Mime(mime_tp, mime_sb, vec!()))
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue