mirror of
https://github.com/alacritty/alacritty.git
synced 2024-11-25 14:05:41 -05:00
clippy: do and don't pass some things by reference as suggested (needless_pass_by_value, needless_borrow).
This commit is contained in:
parent
ed6595543b
commit
d552d28418
6 changed files with 18 additions and 18 deletions
|
@ -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)?;
|
||||
|
|
12
src/main.rs
12
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(),
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue