diff options
author | Matthias Krüger <matthias.krueger@famsik.de> | 2017-11-30 00:38:29 +0100 |
---|---|---|
committer | Joe Wilm <jwilm@users.noreply.github.com> | 2017-12-03 12:50:40 -0800 |
commit | d552d28418ef192724b2b4353863708f31f325d4 (patch) | |
tree | 75c3946cc57180df816036cc22deca72fdf2afee | |
parent | ed6595543b4034cb295761e1a6fb2c49762d554f (diff) | |
download | alacritty-d552d28418ef192724b2b4353863708f31f325d4.tar.gz alacritty-d552d28418ef192724b2b4353863708f31f325d4.zip |
clippy: do and don't pass some things by reference as suggested (needless_pass_by_value, needless_borrow).
-rw-r--r-- | src/display.rs | 2 | ||||
-rw-r--r-- | src/main.rs | 12 | ||||
-rw-r--r-- | src/renderer/mod.rs | 2 | ||||
-rw-r--r-- | src/selection.rs | 12 | ||||
-rw-r--r-- | src/term/color.rs | 2 | ||||
-rw-r--r-- | src/tty.rs | 6 |
6 files changed, 18 insertions, 18 deletions
diff --git a/src/display.rs b/src/display.rs index 52d0c972..14c5a66d 100644 --- a/src/display.rs +++ b/src/display.rs @@ -147,7 +147,7 @@ impl Display { info!("device_pixel_ratio: {}", dpr); // Create renderer - let mut renderer = QuadRenderer::new(&config, viewport_size)?; + let mut renderer = QuadRenderer::new(config, viewport_size)?; let (glyph_cache, cell_width, cell_height) = Self::new_glyph_cache(&window, &mut renderer, config, 0)?; diff --git a/src/main.rs b/src/main.rs index a9eb9ab0..c18764d2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -42,7 +42,7 @@ fn main() { let config = load_config(&options); // Run alacritty - if let Err(err) = run(config, options) { + if let Err(err) = run(config, &options) { die!("Alacritty encountered an unrecoverable error:\n\n\t{}\n", Red(err)); } @@ -80,9 +80,9 @@ fn load_config(options: &cli::Options) -> Config { /// /// Creates a window, the terminal state, pty, I/O event loop, input processor, /// config change monitor, and runs the main display loop. -fn run(mut config: Config, options: cli::Options) -> Result<(), Box<Error>> { +fn run(mut config: Config, options: &cli::Options) -> Result<(), Box<Error>> { // Initialize the logger first as to capture output from other subsystems - logging::initialize(&options)?; + logging::initialize(options)?; info!("Welcome to Alacritty."); config.path().map(|config_path| { @@ -92,7 +92,7 @@ fn run(mut config: Config, options: cli::Options) -> Result<(), Box<Error>> { // Create a display. // // The display manages a window and can draw the terminal - let mut display = Display::new(&config, &options)?; + let mut display = Display::new(&config, options)?; info!( "PTY Dimensions: {:?} x {:?}", @@ -116,7 +116,7 @@ fn run(mut config: Config, options: cli::Options) -> Result<(), Box<Error>> { // The pty forks a process to run the shell on the slave side of the // pseudoterminal. A file descriptor for the master side is retained for // reading/writing to the shell. - let mut pty = tty::new(&config, &options, display.size(), window_id); + let mut pty = tty::new(&config, options, display.size(), window_id); // Create the pseudoterminal I/O loop // @@ -141,7 +141,7 @@ fn run(mut config: Config, options: cli::Options) -> Result<(), Box<Error>> { let mut processor = event::Processor::new( event_loop::Notifier(event_loop.channel()), display.resize_channel(), - &options, + options, &config, options.ref_test, display.size().to_owned(), diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs index 0b8dbd13..237c8416 100644 --- a/src/renderer/mod.rs +++ b/src/renderer/mod.rs @@ -282,7 +282,7 @@ impl GlyphCache { self.cache .entry(*glyph_key) .or_insert_with(|| { - let mut rasterized = rasterizer.get_glyph(&glyph_key) + let mut rasterized = rasterizer.get_glyph(glyph_key) .unwrap_or_else(|_| Default::default()); rasterized.left += glyph_offset.x as i32; diff --git a/src/selection.rs b/src/selection.rs index 1c31a452..625ebc31 100644 --- a/src/selection.rs +++ b/src/selection.rs @@ -148,18 +148,18 @@ impl Selection { pub fn to_span<G: SemanticSearch + Dimensions>(&self, grid: G) -> Option<Span> { match *self { Selection::Simple { ref region } => { - Selection::span_simple(grid, region) + Selection::span_simple(&grid, region) }, Selection::Semantic { ref region, ref initial_expansion } => { - Selection::span_semantic(grid, region, initial_expansion) + Selection::span_semantic(&grid, region, initial_expansion) }, Selection::Lines { ref region, ref initial_line } => { - Selection::span_lines(grid, region, initial_line) + Selection::span_lines(&grid, region, initial_line) } } } fn span_semantic<G>( - grid: G, + grid: &G, region: &Region<Point>, initial_expansion: &Region<Point> ) -> Option<Span> @@ -193,7 +193,7 @@ impl Selection { }) } - fn span_lines<G>( grid: G, region: &Region<Point>, initial_line: &Line) -> Option<Span> + fn span_lines<G>(grid: &G, region: &Region<Point>, initial_line: &Line) -> Option<Span> where G: Dimensions { // First, create start and end points based on initial line and the grid @@ -226,7 +226,7 @@ impl Selection { }) } - fn span_simple<G: Dimensions>(grid: G, region: &Region<Anchor>) -> Option<Span> { + fn span_simple<G: Dimensions>(grid: &G, region: &Region<Anchor>) -> Option<Span> { let start = region.start.point; let start_side = region.start.side; let end = region.end.point; diff --git a/src/term/color.rs b/src/term/color.rs index f1f53a98..0284bee9 100644 --- a/src/term/color.rs +++ b/src/term/color.rs @@ -20,7 +20,7 @@ impl<'a> From<&'a Colors> for List { // Type inference fails without this annotation let mut list: List = unsafe { ::std::mem::uninitialized() }; - list.fill_named(&colors); + list.fill_named(colors); list.fill_cube(); list.fill_gray_ramp(); @@ -262,7 +262,7 @@ pub fn new<T: ToWinsize>(config: &Config, options: &Options, size: T, window_id: } let pty = Pty { fd: master }; - pty.resize(size); + pty.resize(&size); pty }, Err(err) => { @@ -289,7 +289,7 @@ impl Pty { /// /// Tells the kernel that the window size changed with the new pixel /// dimensions and line/column counts. - pub fn resize<T: ToWinsize>(&self, size: T) { + pub fn resize<T: ToWinsize>(&self, size: &T) { let win = size.to_winsize(); let res = unsafe { @@ -321,7 +321,7 @@ impl<'a> ToWinsize for &'a SizeInfo { impl OnResize for Pty { fn on_resize(&mut self, size: &SizeInfo) { - self.resize(size); + self.resize(&size); } } |