Fix some warnings

This commit is contained in:
Simon Sapin 2018-12-26 10:58:50 +01:00
parent be69f9c3e6
commit be2218a134
7 changed files with 10 additions and 10 deletions

View file

@ -66,7 +66,7 @@ impl PubDomainRules {
.collect()
}
fn suffix_pair<'a>(&self, domain: &'a str) -> (&'a str, &'a str) {
let domain = domain.trim_left_matches(".");
let domain = domain.trim_start_matches(".");
let mut suffix = domain;
let mut prev_suffix = domain;
for (index, _) in domain.match_indices(".") {
@ -96,7 +96,7 @@ impl PubDomainRules {
// Speeded-up version of
// domain != "" &&
// self.public_suffix(domain) == domain.
let domain = domain.trim_left_matches(".");
let domain = domain.trim_start_matches(".");
match domain.find(".") {
None => !domain.is_empty(),
Some(index) => {
@ -109,7 +109,7 @@ impl PubDomainRules {
// Speeded-up version of
// self.public_suffix(domain) != domain &&
// self.registrable_suffix(domain) == domain.
let domain = domain.trim_left_matches(".");
let domain = domain.trim_start_matches(".");
match domain.find(".") {
None => false,
Some(index) => {

View file

@ -69,7 +69,7 @@ where
digits[0] = (x % 10) as u8 + b'0';
let s = str::from_utf8(&digits[..]).unwrap();
fmt.write_str(s.trim_right_matches('0'))
fmt.write_str(s.trim_end_matches('0'))
},
}
}

View file

@ -548,7 +548,7 @@ pub fn parse_length(mut value: &str) -> LengthOrPercentageOrAuto {
// Steps 1 & 2 are not relevant
// Step 3
value = value.trim_left_matches(HTML_SPACE_CHARACTERS);
value = value.trim_start_matches(HTML_SPACE_CHARACTERS);
// Step 4
if value.is_empty() {

View file

@ -778,7 +778,7 @@ impl ToCss for FontLanguageOverride {
} else {
unsafe { str::from_utf8_unchecked(&buf) }
};
slice.trim_right().to_css(dest)
slice.trim_end().to_css(dest)
}
}

View file

@ -692,7 +692,7 @@ impl<'a> Iterator for TemplateAreasTokenizer<'a> {
type Item = Result<Option<&'a str>, ()>;
fn next(&mut self) -> Option<Self::Item> {
let rest = self.0.trim_left_matches(HTML_SPACE_CHARACTERS);
let rest = self.0.trim_start_matches(HTML_SPACE_CHARACTERS);
if rest.is_empty() {
return None;
}

View file

@ -252,7 +252,7 @@ pub fn value<'a>(variant: &'a VariantInfo, prefix: &str) -> (TokenStream, Vec<Bi
/// If the first Camel segment is "Moz", "Webkit", or "Servo", the result string
/// is prepended with "-".
pub fn to_css_identifier(mut camel_case: &str) -> String {
camel_case = camel_case.trim_right_matches('_');
camel_case = camel_case.trim_end_matches('_');
let mut first = true;
let mut result = String::with_capacity(camel_case.len());
while let Some(segment) = split_camel_segment(&mut camel_case) {

View file

@ -161,7 +161,7 @@ pub unsafe extern "C" fn heartbeat_servo(servo: *mut ServoInstance) {
// Servo heartbeat goes here!
if let Some(servo) = servo.as_mut() {
servo.servo.handle_events(vec![]);
for ((browser_id, event)) in servo.servo.get_events() {
for (browser_id, event) in servo.servo.get_events() {
match event {
// Respond to any messages with a response channel
// to avoid deadlocking the constellation
@ -554,7 +554,7 @@ impl log::Log for MLLogger {
log::Level::Trace => MLLogLevel::Verbose,
};
let mut msg = SmallVec::<[u8; 128]>::new();
write!(msg, "{}\0", record.args());
write!(msg, "{}\0", record.args()).unwrap();
(self.0)(lvl, &msg[0] as *const _ as *const _);
}