Commit 63a40df5 authored by Matthias Krüger's avatar Matthias Krüger Committed by Christian Duerr

Fix style issues

parent 55e675a3
......@@ -68,7 +68,7 @@ impl Descriptor {
font_name: desc.font_name(),
style_name: desc.style_name(),
display_name: desc.display_name(),
font_path: desc.font_path().unwrap_or_else(||{"".to_owned()}),
font_path: desc.font_path().unwrap_or_else(String::new),
ct_descriptor: desc,
}
}
......
......@@ -99,7 +99,7 @@ impl<'a> Iterator for Iter<'a> {
None
} else {
let pattern = unsafe {
let ptr = *(*self.font_set.as_ptr()).fonts.offset(self.current as isize);
let ptr = *(*self.font_set.as_ptr()).fonts.add(self.current);
PatternRef::from_ptr(ptr)
};
......
......@@ -15,7 +15,7 @@
//! Defines the Row type which makes up lines in the grid
use std::ops::{Index, IndexMut};
use std::ops::{Range, RangeTo, RangeFrom, RangeFull};
use std::ops::{Range, RangeTo, RangeFrom, RangeFull, RangeToInclusive};
use std::cmp::{max, min};
use std::slice;
......@@ -200,3 +200,20 @@ impl<T> IndexMut<RangeFull> for Row<T> {
&mut self.inner[..]
}
}
impl<T> Index<RangeToInclusive<Column>> for Row<T> {
type Output = [T];
#[inline]
fn index(&self, index: RangeToInclusive<Column>) -> &[T] {
&self.inner[..=(index.end.0)]
}
}
impl<T> IndexMut<RangeToInclusive<Column>> for Row<T> {
#[inline]
fn index_mut(&mut self, index: RangeToInclusive<Column>) -> &mut [T] {
self.occ = max(self.occ, *index.end);
&mut self.inner[..=(index.end.0)]
}
}
......@@ -232,8 +232,8 @@ impl<T> Storage<T> {
// Cast to a qword array to opt out of copy restrictions and avoid
// drop hazards. Byte array is no good here since for whatever
// reason LLVM won't optimized it.
let a_ptr = self.inner.as_mut_ptr().offset(a as isize) as *mut u64;
let b_ptr = self.inner.as_mut_ptr().offset(b as isize) as *mut u64;
let a_ptr = self.inner.as_mut_ptr().add(a) as *mut u64;
let b_ptr = self.inner.as_mut_ptr().add(b) as *mut u64;
// Copy 1 qword at a time
//
......
......@@ -67,7 +67,7 @@ pub fn set_locale_environment() {
// try setting `locale_id`
let modified = setlocale(LC_CTYPE, locale_ptr);
let result = if modified.is_null() {
String::from("")
String::new()
} else {
locale_id
};
......
......@@ -1725,7 +1725,7 @@ impl ansi::Handler for Term {
},
ansi::LineClearMode::Left => {
let row = &mut self.grid[self.cursor.point.line];
for cell in &mut row[..(col + 1)] {
for cell in &mut row[..=col] {
cell.reset(&template);
}
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment