summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2016-12-16 22:13:51 -0800
committerJoe Wilm <joe@jwilm.com>2016-12-16 22:13:51 -0800
commitdc918ae71a5e6c78a77994d7ce106a2253918c54 (patch)
tree537c7d13443e18ed657398f4eca0bf921ef4ac5e /src
parent3b995ff87a54239ecacb95d51f65c17504a8d22c (diff)
downloadalacritty-dc918ae71a5e6c78a77994d7ce106a2253918c54.tar.gz
alacritty-dc918ae71a5e6c78a77994d7ce106a2253918c54.zip
Rustup and clippy
All of the changes in this commit are due to clippy lints.
Diffstat (limited to 'src')
-rw-r--r--src/ansi.rs47
-rw-r--r--src/config.rs23
-rw-r--r--src/display.rs11
-rw-r--r--src/event_loop.rs6
-rw-r--r--src/grid.rs14
-rw-r--r--src/input.rs12
-rw-r--r--src/lib.rs10
-rw-r--r--src/macros.rs4
-rw-r--r--src/main.rs3
-rw-r--r--src/meter.rs7
-rw-r--r--src/renderer/mod.rs51
-rw-r--r--src/term/mod.rs8
-rw-r--r--src/tty.rs2
-rw-r--r--src/window.rs2
14 files changed, 99 insertions, 101 deletions
diff --git a/src/ansi.rs b/src/ansi.rs
index f876cb54..28a413b6 100644
--- a/src/ansi.rs
+++ b/src/ansi.rs
@@ -39,7 +39,7 @@ use index::{Column, Line};
use ::Rgb;
-/// The processor wraps a vte::Parser to ultimately call methods on a Handler
+/// The processor wraps a `vte::Parser` to ultimately call methods on a Handler
pub struct Processor {
state: ProcessorState,
parser: vte::Parser,
@@ -48,10 +48,10 @@ pub struct Processor {
/// Internal state for VTE processor
struct ProcessorState;
-/// Helper type that implements vte::Perform.
+/// Helper type that implements `vte::Perform`.
///
/// Processor creates a Performer when running advance and passes the Performer
-/// to vte::Parser.
+/// to `vte::Parser`.
struct Performer<'a, H: Handler + TermInfo + 'a, W: io::Write + 'a> {
_state: &'a mut ProcessorState,
handler: &'a mut H,
@@ -74,13 +74,19 @@ impl<'a, H: Handler + TermInfo + 'a, W: io::Write> Performer<'a, H, W> {
}
}
-impl Processor {
- pub fn new() -> Processor {
+impl Default for Processor {
+ fn default() -> Processor {
Processor {
state: ProcessorState,
parser: vte::Parser::new(),
}
}
+}
+
+impl Processor {
+ pub fn new() -> Processor {
+ Default::default()
+ }
#[inline]
pub fn advance<H, W>(
@@ -527,7 +533,7 @@ impl<'a, H, W> vte::Perform for Performer<'a, H, W>
handler.move_up(Line(arg_or_default!(idx: 0, default: 1) as usize));
},
'B' | 'e' => handler.move_down(Line(arg_or_default!(idx: 0, default: 1) as usize)),
- 'c' => handler.identify_terminal(writer),
+ 'c' | 'n' => handler.identify_terminal(writer),
'C' | 'a' => handler.move_forward(Column(arg_or_default!(idx: 0, default: 1) as usize)),
'D' => handler.move_backward(Column(arg_or_default!(idx: 0, default: 1) as usize)),
'E' => handler.move_down_and_cr(Line(arg_or_default!(idx: 0, default: 1) as usize)),
@@ -661,14 +667,14 @@ impl<'a, H, W> vte::Perform for Performer<'a, H, W>
95 => Attr::Foreground(Color::Named(NamedColor::BrightMagenta)),
96 => Attr::Foreground(Color::Named(NamedColor::BrightCyan)),
97 => Attr::Foreground(Color::Named(NamedColor::BrightWhite)),
- 100 => Attr::Foreground(Color::Named(NamedColor::BrightBlack)),
- 101 => Attr::Foreground(Color::Named(NamedColor::BrightRed)),
- 102 => Attr::Foreground(Color::Named(NamedColor::BrightGreen)),
- 103 => Attr::Foreground(Color::Named(NamedColor::BrightYellow)),
- 104 => Attr::Foreground(Color::Named(NamedColor::BrightBlue)),
- 105 => Attr::Foreground(Color::Named(NamedColor::BrightMagenta)),
- 106 => Attr::Foreground(Color::Named(NamedColor::BrightCyan)),
- 107 => Attr::Foreground(Color::Named(NamedColor::BrightWhite)),
+ 100 => Attr::Background(Color::Named(NamedColor::BrightBlack)),
+ 101 => Attr::Background(Color::Named(NamedColor::BrightRed)),
+ 102 => Attr::Background(Color::Named(NamedColor::BrightGreen)),
+ 103 => Attr::Background(Color::Named(NamedColor::BrightYellow)),
+ 104 => Attr::Background(Color::Named(NamedColor::BrightBlue)),
+ 105 => Attr::Background(Color::Named(NamedColor::BrightMagenta)),
+ 106 => Attr::Background(Color::Named(NamedColor::BrightCyan)),
+ 107 => Attr::Background(Color::Named(NamedColor::BrightWhite)),
_ => unhandled!(),
};
@@ -677,7 +683,8 @@ impl<'a, H, W> vte::Perform for Performer<'a, H, W>
i += 1; // C-for expr
}
}
- 'n' => handler.identify_terminal(writer),
+ // TODO this should be a device status report
+ // 'n' => handler.identify_terminal(writer),
'r' => {
if private {
unhandled!();
@@ -737,7 +744,7 @@ fn parse_color(attrs: &[i64], i: &mut usize) -> Option<Color> {
let g = attrs[*i+3];
let b = attrs[*i+4];
- *i = *i + 4;
+ *i += 4;
let range = 0...255;
if !range.contains(r) || !range.contains(g) || !range.contains(b) {
@@ -756,7 +763,7 @@ fn parse_color(attrs: &[i64], i: &mut usize) -> Option<Color> {
err_println!("Expected color index; got {:?}", attrs);
None
} else {
- *i = *i + 2;
+ *i += 2;
let idx = attrs[*i];
match idx {
0 ... 255 => {
@@ -833,7 +840,7 @@ pub mod C0 {
pub const EM: u8 = 0x19;
/// Substitute (VT100 uses this to display parity errors)
pub const SUB: u8 = 0x1A;
- /// Prefix to an ESCape sequence
+ /// Prefix to an escape sequence
pub const ESC: u8 = 0x1B;
/// File Separator
pub const FS: u8 = 0x1C;
@@ -865,7 +872,7 @@ pub mod C1 {
pub const NBH: u8 = 0x83;
/// Index, moves down one line same column regardless of NL
pub const IND: u8 = 0x84;
- /// NEw Line, moves done one line and to first column (CR+LF)
+ /// New line, moves done one line and to first column (CR+LF)
pub const NEL: u8 = 0x85;
/// Start of Selected Area to be as charsent to auxiliary output device
pub const SSA: u8 = 0x86;
@@ -895,7 +902,7 @@ pub mod C1 {
pub const PU2: u8 = 0x92;
/// Set Transmit State
pub const STS: u8 = 0x93;
- /// Cancel CHaracter, ignore previous character
+ /// Cancel character, ignore previous character
pub const CCH: u8 = 0x94;
/// Message Waiting, turns on an indicator on the terminal
pub const MW: u8 = 0x95;
diff --git a/src/config.rs b/src/config.rs
index 23010350..a6d8150e 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -242,10 +242,10 @@ impl de::Deserialize for ModsWrapper {
let mut res = Mods::empty();
for modifier in value.split('|') {
match modifier {
- "Command" | "Super" => res = res | mods::SUPER,
- "Shift" => res = res | mods::SHIFT,
- "Alt" | "Option" => res = res | mods::ALT,
- "Control" => res = res | mods::CONTROL,
+ "Command" | "Super" => res |= mods::SUPER,
+ "Shift" => res |= mods::SHIFT,
+ "Alt" | "Option" => res |= mods::ALT,
+ "Control" => res |= mods::CONTROL,
_ => err_println!("unknown modifier {:?}", modifier),
}
}
@@ -315,10 +315,10 @@ impl de::Deserialize for ModeWrapper {
for modifier in value.split('|') {
match modifier {
- "AppCursor" => res.mode = res.mode | mode::APP_CURSOR,
- "~AppCursor" => res.not_mode = res.not_mode | mode::APP_CURSOR,
- "AppKeypad" => res.mode = res.mode | mode::APP_KEYPAD,
- "~AppKeypad" => res.not_mode = res.not_mode | mode::APP_KEYPAD,
+ "AppCursor" => res.mode |= mode::APP_CURSOR,
+ "~AppCursor" => res.not_mode |= mode::APP_CURSOR,
+ "AppKeypad" => res.mode |= mode::APP_KEYPAD,
+ "~AppKeypad" => res.not_mode |= mode::APP_KEYPAD,
_ => err_println!("unknown omde {:?}", modifier),
}
}
@@ -369,8 +369,8 @@ impl de::Deserialize for MouseButton {
}
}
-/// Bindings are deserialized into a RawBinding before being parsed as a
-/// KeyBinding or MouseBinding.
+/// Bindings are deserialized into a `RawBinding` before being parsed as a
+/// `KeyBinding` or `MouseBinding`.
struct RawBinding {
key: Option<::glutin::VirtualKeyCode>,
mouse: Option<::glutin::MouseButton>,
@@ -879,7 +879,7 @@ impl Config {
/// Pixels per inch
///
-/// This is only used on FreeType systems
+/// This is only used on `FreeType` systems
#[derive(Debug, Deserialize)]
pub struct Dpi {
/// Horizontal dpi
@@ -1176,6 +1176,7 @@ mod tests {
}
}
+#[cfg_attr(feature = "clippy", allow(enum_variant_names))]
#[derive(Deserialize, Copy, Clone)]
enum Key {
Key1,
diff --git a/src/display.rs b/src/display.rs
index b16bf95a..b6c5f401 100644
--- a/src/display.rs
+++ b/src/display.rs
@@ -94,7 +94,7 @@ impl Display {
let rasterizer = font::Rasterizer::new(dpi.x(), dpi.y(), dpr);
// Create renderer
- let mut renderer = QuadRenderer::new(&config, size);
+ let mut renderer = QuadRenderer::new(config, size);
// Initialize glyph cache
let glyph_cache = {
@@ -102,7 +102,7 @@ impl Display {
let init_start = ::std::time::Instant::now();
let cache = renderer.with_loader(|mut api| {
- GlyphCache::new(rasterizer, &config, &mut api)
+ GlyphCache::new(rasterizer, config, &mut api)
});
let stop = init_start.elapsed();
@@ -223,7 +223,12 @@ impl Display {
{
let _sampler = self.meter.sampler();
- let size_info = terminal.size_info().clone();
+ // Make a copy of size_info since the closure passed here
+ // borrows terminal mutably
+ //
+ // TODO I wonder if the renderable cells iter could avoid the
+ // mutable borrow
+ let size_info = *terminal.size_info();
self.renderer.with_api(config, &size_info, |mut api| {
api.clear();
diff --git a/src/event_loop.rs b/src/event_loop.rs
index 70aa4acb..e8e323e4 100644
--- a/src/event_loop.rs
+++ b/src/event_loop.rs
@@ -74,7 +74,7 @@ impl State {
fn goto_next(&mut self) {
self.writing = self.write_list
.pop_front()
- .map(|c| Writing::new(c));
+ .map(Writing::new);
}
#[inline]
@@ -115,10 +115,10 @@ impl Writing {
}
}
-/// mio::Token for the event loop channel
+/// `mio::Token` for the event loop channel
const CHANNEL: mio::Token = mio::Token(0);
-/// mio::Token for the pty file descriptor
+/// `mio::Token` for the pty file descriptor
const PTY: mio::Token = mio::Token(1);
impl<Io> EventLoop<Io>
diff --git a/src/grid.rs b/src/grid.rs
index 1bcc91ce..7192b996 100644
--- a/src/grid.rs
+++ b/src/grid.rs
@@ -192,14 +192,14 @@ impl<T> Index<index::Line> for Grid<T> {
type Output = Row<T>;
#[inline]
- fn index<'a>(&'a self, index: index::Line) -> &'a Row<T> {
+ fn index(&self, index: index::Line) -> &Row<T> {
&self.raw[index.0]
}
}
impl<T> IndexMut<index::Line> for Grid<T> {
#[inline]
- fn index_mut<'a>(&'a mut self, index: index::Line) -> &'a mut Row<T> {
+ fn index_mut(&mut self, index: index::Line) -> &mut Row<T> {
&mut self.raw[index.0]
}
}
@@ -208,7 +208,7 @@ impl<'cursor, T> Index<&'cursor Cursor> for Grid<T> {
type Output = T;
#[inline]
- fn index<'a, 'b>(&'a self, cursor: &'b Cursor) -> &'a T {
+ fn index<'a>(&'a self, cursor: &Cursor) -> &'a T {
&self.raw[cursor.line.0][cursor.col]
}
}
@@ -294,14 +294,14 @@ impl<T> Index<index::Column> for Row<T> {
type Output = T;
#[inline]
- fn index<'a>(&'a self, index: index::Column) -> &'a T {
+ fn index(&self, index: index::Column) -> &T {
&self.0[index.0]
}
}
impl<T> IndexMut<index::Column> for Row<T> {
#[inline]
- fn index_mut<'a>(&'a mut self, index: index::Column) -> &'a mut T {
+ fn index_mut(&mut self, index: index::Column) -> &mut T {
&mut self.0[index.0]
}
}
@@ -312,14 +312,14 @@ macro_rules! row_index_range {
type Output = [T];
#[inline]
- fn index<'a>(&'a self, index: $range) -> &'a [T] {
+ fn index(&self, index: $range) -> &[T] {
&self.0[index]
}
}
impl<T> IndexMut<$range> for Row<T> {
#[inline]
- fn index_mut<'a>(&'a mut self, index: $range) -> &'a mut [T] {
+ fn index_mut(&mut self, index: $range) -> &mut [T] {
&mut self.0[index]
}
}
diff --git a/src/input.rs b/src/input.rs
index 744a462e..3645097e 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -73,7 +73,7 @@ impl Default for Mouse {
}
}
-/// Types that are notified of escape sequences from the input::Processor.
+/// Types that are notified of escape sequences from the `input::Processor`.
pub trait Notify {
/// Notify that an escape sequence should be written to the pty
///
@@ -97,7 +97,7 @@ impl Notify for LoopNotifier {
/// Describes a state and action to take in that state
///
-/// This is the shared component of MouseBinding and KeyBinding
+/// This is the shared component of `MouseBinding` and `KeyBinding`
#[derive(Debug, Clone)]
pub struct Binding {
/// Modifier keys required to activate binding
@@ -183,15 +183,13 @@ impl Action {
match *self {
Action::Esc(ref s) => notifier.notify(s.clone().into_bytes()),
Action::Paste | Action::PasteSelection => {
- println!("paste request");
let clip = Clipboard::new().expect("get clipboard");
clip.load_selection()
.map(|contents| {
- println!("got contents");
if mode.contains(mode::BRACKETED_PASTE) {
- notifier.notify("\x1b[200~".as_bytes());
+ notifier.notify(&b"\x1b[200~"[..]);
notifier.notify(contents.into_bytes());
- notifier.notify("\x1b[201~".as_bytes());
+ notifier.notify(&b"\x1b[201~"[..]);
} else {
notifier.notify(contents.into_bytes());
}
@@ -199,8 +197,6 @@ impl Action {
.unwrap_or_else(|err| {
err_println!("Error getting clipboard contents: {}", err);
});
-
- println!("ok");
},
}
}
diff --git a/src/lib.rs b/src/lib.rs
index 9903f591..f014d833 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -13,15 +13,19 @@
// limitations under the License.
//
//! Alacritty - The GPU Enhanced Terminal
-#![feature(question_mark)]
#![feature(range_contains)]
#![feature(inclusive_range_syntax)]
#![feature(drop_types_in_const)]
#![feature(unicode)]
#![feature(step_trait)]
+#![feature(plugin)]
+#![cfg_attr(feature = "clippy", plugin(clippy))]
+#![cfg_attr(feature = "clippy", deny(clippy))]
+#![cfg_attr(feature = "clippy", deny(enum_glob_use))]
+#![cfg_attr(feature = "clippy", deny(if_not_else))]
+#![cfg_attr(feature = "clippy", deny(wrong_pub_self_convention))]
#![cfg_attr(test, feature(test))]
#![feature(core_intrinsics)]
-#![allow(stable_features)] // lying about question_mark because 1.14.0 isn't released!
#![feature(proc_macro)]
@@ -75,6 +79,8 @@ pub struct Rgb {
pub b: u8,
}
+#[cfg_attr(feature = "clippy", allow(too_many_arguments))]
+#[cfg_attr(feature = "clippy", allow(doc_markdown))]
pub mod gl {
#![allow(non_upper_case_globals)]
include!(concat!(env!("OUT_DIR"), "/gl_bindings.rs"));
diff --git a/src/macros.rs b/src/macros.rs
index 740e5ed9..a6e30104 100644
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -34,7 +34,7 @@ macro_rules! err_println {
macro_rules! debug_println {
($($t:tt)*) => {
if cfg!(debug_assertions) {
- println!($($t)*);
+ err_println!($($t)*);
}
}
}
@@ -43,7 +43,7 @@ macro_rules! debug_println {
macro_rules! debug_print {
($($t:tt)*) => {
if cfg!(debug_assertions) {
- print!($($t)*);
+ err_print!($($t)*);
}
}
}
diff --git a/src/main.rs b/src/main.rs
index c917fe43..409f1c93 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -13,7 +13,8 @@
// limitations under the License.
//
//! Alacritty - The GPU Enhanced Terminal
-#![allow(stable_features)] // lying about question_mark because 1.14.0 isn't released!
+#![feature(plugin)]
+#![cfg_attr(feature = "clippy", plugin(clippy))]
#[macro_use]
extern crate alacritty;
diff --git a/src/meter.rs b/src/meter.rs
index b4bab5ff..2dc2ed21 100644
--- a/src/meter.rs
+++ b/src/meter.rs
@@ -36,6 +36,7 @@ use std::time::{Instant, Duration};
const NUM_SAMPLES: usize = 10;
/// The meter
+#[derive(Default)]
pub struct Meter {
/// Track last 60 timestamps
times: [f64; NUM_SAMPLES],
@@ -83,11 +84,7 @@ impl<'a> Drop for Sampler<'a> {
impl Meter {
/// Create a meter
pub fn new() -> Meter {
- Meter {
- times: [0.0; NUM_SAMPLES],
- avg: 0.0,
- index: 0,
- }
+ Default::default()
}
/// Get a sampler
diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs
index b1fb27ed..d771b6dc 100644
--- a/src/renderer/mod.rs
+++ b/src/renderer/mod.rs
@@ -47,7 +47,7 @@ static TEXT_SHADER_V: &'static str = include_str!(
concat!(env!("CARGO_MANIFEST_DIR"), "/res/text.v.glsl")
);
-/// LoadGlyph allows for copying a rasterized glyph into graphics memory
+/// `LoadGlyph` allows for copying a rasterized glyph into graphics memory
pub trait LoadGlyph {
/// Load the rasterized glyph into GPU memory
fn load_glyph(&mut self, rasterized: &RasterizedGlyph) -> Glyph;
@@ -134,9 +134,9 @@ impl GlyphCache {
let bold_desc = FontDesc::new(font.family(), bold_style);
let bold = if bold_desc == regular_desc {
- regular.clone()
+ regular
} else {
- rasterizer.load_font(&bold_desc, size).unwrap_or_else(|| regular.clone())
+ rasterizer.load_font(&bold_desc, size).unwrap_or_else(|| regular)
};
// Load italic font
@@ -144,19 +144,19 @@ impl GlyphCache {
let italic_desc = FontDesc::new(font.family(), italic_style);
let italic = if italic_desc == regular_desc {
- regular.clone()
+ regular
} else {
rasterizer.load_font(&italic_desc, size)
- .unwrap_or_else(|| regular.clone())
+ .unwrap_or_else(|| regular)
};
let mut cache = GlyphCache {
cache: HashMap::new(),
rasterizer: rasterizer,
font_size: font.size(),
- font_key: regular.clone(),
- bold_key: bold.clone(),
- italic_key: italic.clone(),
+ font_key: regular,
+ bold_key: bold,
+ italic_key: italic,
};
macro_rules! load_glyphs_for_font {
@@ -203,7 +203,7 @@ impl GlyphCache {
// Rasterize and load the glyph
self.load_and_cache_glyph(glyph_key.to_owned(), loader);
- self.cache.get(&glyph_key)
+ self.cache.get(glyph_key)
}
}
@@ -511,7 +511,7 @@ impl QuadRenderer {
if op.contains(op::IGNORED) {
if let Some(path) = path.as_ref() {
if let Err(err) = watcher.watch(path) {
- println!("failed to establish watch on {:?}: {:?}", path, err);
+ err_println!("failed to establish watch on {:?}: {:?}", path, err);
}
}
@@ -580,7 +580,7 @@ impl QuadRenderer {
batch: &mut self.batch,
atlas: &mut self.atlas,
program: &mut self.program,
- colors: &config.color_list(),
+ colors: config.color_list(),
});
unsafe {
@@ -613,10 +613,10 @@ impl QuadRenderer {
Err(err) => {
match err {
ShaderCreationError::Io(err) => {
- println!("Error reading shader file: {}", err);
+ err_println!("Error reading shader file: {}", err);
},
ShaderCreationError::Compile(path, log) => {
- println!("Error compiling shader at {:?}", path);
+ err_println!("Error compiling shader at {:?}", path);
io::copy(&mut log.as_bytes(), &mut io::stdout()).unwrap();
}
}
@@ -715,10 +715,8 @@ impl<'a> RenderApi<'a> {
#[inline]
fn add_render_item(&mut self, cell: &IndexedCell, glyph: &Glyph) {
// Flush batch if tex changing
- if !self.batch.is_empty() {
- if self.batch.tex != glyph.tex_id {
- self.render_batch();
- }
+ if !self.batch.is_empty() && self.batch.tex != glyph.tex_id {
+ self.render_batch();
}
self.batch.add_item(cell, glyph, self.colors);
@@ -872,16 +870,6 @@ impl ShaderProgram {
assert_uniform_valid!(projection, term_dim, cell_dim);
- let mut color_uniforms: [GLint; 18] = unsafe { ::std::mem::uninitialized() };
- for i in 0..18 {
- color_uniforms[i] = unsafe {
- let s = format!("colors[{}]\0", i).into_bytes();
- gl::GetUniformLocation(program, cptr!(&s[..]))
- };
-
- assert_uniform_valid!(color_uniforms[i]);
- }
-
let shader = ShaderProgram {
id: program,
u_projection: projection,
@@ -941,7 +929,7 @@ impl ShaderProgram {
gl::GetProgramiv(program, gl::LINK_STATUS, &mut success);
if success != (gl::TRUE as GLint) {
- println!("{}", get_program_info_log(program));
+ err_println!("{}", get_program_info_log(program));
panic!("failed to link shader program");
}
program
@@ -1248,7 +1236,7 @@ impl Atlas {
let uv_height = height as f32 / self.height as f32;
let uv_width = width as f32 / self.width as f32;
- let g = Glyph {
+ Glyph {
tex_id: self.id,
top: glyph.top as f32,
width: width as f32,
@@ -1258,10 +1246,7 @@ impl Atlas {
uv_left: uv_left,
uv_width: uv_width,
uv_height: uv_height,
- };
-
- // Return the glyph
- g
+ }
}
/// Check if there's room in the current row for given glyph
diff --git a/src/term/mod.rs b/src/term/mod.rs
index 93124732..1bed8134 100644
--- a/src/term/mod.rs
+++ b/src/term/mod.rs
@@ -95,7 +95,7 @@ pub struct IndexedCell {
impl Deref for IndexedCell {
type Target = Cell;
- #[inline(always)]
+ #[inline]
fn deref(&self) -> &Cell {
&self.inner
}
@@ -108,7 +108,7 @@ impl<'a> Iterator for RenderableCellsIter<'a> {
///
/// Skips empty (background) cells and applies any flags to the cell state
/// (eg. invert fg and bg colors).
- #[inline(always)]
+ #[inline]
fn next(&mut self) -> Option<Self::Item> {
while self.line < self.grid.num_lines() {
while self.column < self.grid.num_cols() {
@@ -319,7 +319,7 @@ impl Term {
/// A renderable cell is any cell which has content other than the default
/// background color. Cells with an alternate background color are
/// considered renderable as are cells with any text content.
- pub fn renderable_cells<'a>(&'a mut self) -> RenderableCellsIter<'a> {
+ pub fn renderable_cells(&mut self) -> RenderableCellsIter {
RenderableCellsIter::new(&mut self.grid, &self.cursor, self.mode)
}
@@ -566,7 +566,7 @@ impl ansi::Handler for Term {
#[inline]
fn identify_terminal<W: io::Write>(&mut self, writer: &mut W) {
- let _ = writer.write_all("\x1b[?6c".as_bytes());
+ let _ = writer.write_all(b"\x1b[?6c");
}
#[inline]
diff --git a/src/tty.rs b/src/tty.rs
index 667daf04..b98d2210 100644
--- a/src/tty.rs
+++ b/src/tty.rs
@@ -162,7 +162,7 @@ struct Passwd<'a> {
/// # Unsafety
///
/// If `buf` is changed while `Passwd` is alive, bad thing will almost certainly happen.
-fn get_pw_entry<'a>(buf: &'a mut [i8; 1024]) -> Passwd<'a> {
+fn get_pw_entry(buf: &mut [i8; 1024]) -> Passwd {
// Create zeroed passwd struct
let mut entry: libc::passwd = unsafe { ::std::mem::uninitialized() };
diff --git a/src/window.rs b/src/window.rs
index f9f2050c..62c65c9c 100644
--- a/src/window.rs
+++ b/src/window.rs
@@ -98,7 +98,7 @@ pub struct Pixels<T>(pub T);
#[derive(Debug, Copy, Clone)]
pub struct Points<T>(pub T);
-/// A wrapper around glutin's WaitEventsIterator that clears the wakeup
+/// A wrapper around glutin's `WaitEventsIterator` that clears the wakeup
/// optimization flag on drop.
pub struct WaitEventsIterator<'a> {
inner: glutin::WaitEventsIterator<'a>,