Fix clippy, fix font load test (#517)

* Fix warnings

* Fix clippy, ignore font_load test

* Changes requested in PR review

* Fix unused variable and function using #cfg
macos-click-through
Chinmay Dalal 4 years ago committed by GitHub
parent 4bd6579074
commit d14802cb43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -270,15 +270,15 @@ pub enum RedrawEvent {
#[derive(Debug)] #[derive(Debug)]
pub enum ChannelStreamType { pub enum ChannelStreamType {
STDIO, Stdio,
STDERR, Stderr,
Socket, Socket,
Job, Job,
} }
impl Default for ChannelStreamType { impl Default for ChannelStreamType {
fn default() -> Self { fn default() -> Self {
Self::STDIO Self::Stdio
} }
} }
@ -286,7 +286,7 @@ impl Default for ChannelStreamType {
pub enum ChannelMode { pub enum ChannelMode {
Bytes, Bytes,
Terminal, Terminal,
RPC, Rpc,
} }
impl Default for ChannelMode { impl Default for ChannelMode {
@ -307,7 +307,7 @@ pub struct ClientVersion {
#[derive(Debug)] #[derive(Debug)]
pub enum ClientType { pub enum ClientType {
Remote, Remote,
UI, Ui,
Embedder, Embedder,
Host, Host,
Plugin, Plugin,
@ -953,8 +953,8 @@ pub fn parse_redraw_event(event_value: Value) -> Result<Vec<RedrawEvent>> {
pub fn parse_channel_stream_type(channel_stream_value: Value) -> Result<ChannelStreamType> { pub fn parse_channel_stream_type(channel_stream_value: Value) -> Result<ChannelStreamType> {
match parse_string(channel_stream_value)?.as_ref() { match parse_string(channel_stream_value)?.as_ref() {
"stdio" => Ok(ChannelStreamType::STDIO), "stdio" => Ok(ChannelStreamType::Stdio),
"stderr" => Ok(ChannelStreamType::STDERR), "stderr" => Ok(ChannelStreamType::Stderr),
"socket" => Ok(ChannelStreamType::Socket), "socket" => Ok(ChannelStreamType::Socket),
"job" => Ok(ChannelStreamType::Job), "job" => Ok(ChannelStreamType::Job),
_ => Err(ParseError::InvalidFormat), _ => Err(ParseError::InvalidFormat),
@ -965,7 +965,7 @@ pub fn parse_channel_mode(channel_mode_value: Value) -> Result<ChannelMode> {
match parse_string(channel_mode_value)?.as_ref() { match parse_string(channel_mode_value)?.as_ref() {
"bytes" => Ok(ChannelMode::Bytes), "bytes" => Ok(ChannelMode::Bytes),
"terminal" => Ok(ChannelMode::Terminal), "terminal" => Ok(ChannelMode::Terminal),
"rpc" => Ok(ChannelMode::RPC), "rpc" => Ok(ChannelMode::Rpc),
_ => Err(ParseError::InvalidFormat), _ => Err(ParseError::InvalidFormat),
} }
} }
@ -996,7 +996,7 @@ pub fn parse_client_version(version_value: Value) -> Result<ClientVersion> {
pub fn parse_client_type(client_type_value: Value) -> Result<ClientType> { pub fn parse_client_type(client_type_value: Value) -> Result<ClientType> {
match parse_string(client_type_value)?.as_ref() { match parse_string(client_type_value)?.as_ref() {
"remote" => Ok(ClientType::Remote), "remote" => Ok(ClientType::Remote),
"ui" => Ok(ClientType::UI), "ui" => Ok(ClientType::Ui),
"embedder" => Ok(ClientType::Embedder), "embedder" => Ok(ClientType::Embedder),
"host" => Ok(ClientType::Host), "host" => Ok(ClientType::Host),
"plugin" => Ok(ClientType::Plugin), "plugin" => Ok(ClientType::Plugin),

@ -44,7 +44,9 @@ impl Handler for NeovimHandler {
) { ) {
trace!("Neovim notification: {:?}", &event_name); trace!("Neovim notification: {:?}", &event_name);
#[cfg(windows)]
let ui_command_sender = self.ui_command_sender.clone(); let ui_command_sender = self.ui_command_sender.clone();
let redraw_event_sender = self.redraw_event_sender.clone(); let redraw_event_sender = self.redraw_event_sender.clone();
task::spawn_blocking(move || match event_name.as_ref() { task::spawn_blocking(move || match event_name.as_ref() {
"redraw" => { "redraw" => {

@ -91,6 +91,7 @@ fn build_nvim_cmd() -> Command {
} }
} }
#[cfg(windows)]
pub fn build_neovide_command(channel: u64, num_args: u64, command: &str, event: &str) -> String { pub fn build_neovide_command(channel: u64, num_args: u64, command: &str, event: &str) -> String {
let nargs: String = if num_args > 1 { let nargs: String = if num_args > 1 {
"+".to_string() "+".to_string()

@ -1,4 +1,8 @@
use log::{error, trace}; use log::trace;
#[cfg(windows)]
use log::Error;
use nvim_rs::compat::tokio::Compat; use nvim_rs::compat::tokio::Compat;
use nvim_rs::Neovim; use nvim_rs::Neovim;
use tokio::process::ChildStdin; use tokio::process::ChildStdin;

@ -2,7 +2,7 @@ use log::error;
fn show_error(explanation: &str) -> ! { fn show_error(explanation: &str) -> ! {
error!("{}", explanation); error!("{}", explanation);
panic!(explanation.to_string()); panic!("{}", explanation.to_string());
} }
pub trait ResultPanicExplanation<T, E: ToString> { pub trait ResultPanicExplanation<T, E: ToString> {

@ -237,7 +237,7 @@ mod test {
assert!(font_family.is_none()); assert!(font_family.is_none());
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
const SYSTEM_DEFAULT_FONT: &str = "DejaVu Serif"; const SYSTEM_DEFAULT_FONT: &str = "monospace";
let font_family = loader.load(SYSTEM_DEFAULT_FONT); let font_family = loader.load(SYSTEM_DEFAULT_FONT);
let result = font_family.unwrap().fonts.first().unwrap().font.full_name(); let result = font_family.unwrap().fonts.first().unwrap().font.full_name();

@ -42,7 +42,7 @@ impl<'a> Token<'a> {
#[cfg(not(target_os = "windows"))] #[cfg(not(target_os = "windows"))]
fn use_logo(logo: bool) -> bool { fn use_logo(logo: bool) -> bool {
return logo; logo
} }
// The Windows key is used for OS-level shortcuts, // The Windows key is used for OS-level shortcuts,

@ -1,5 +1,9 @@
use std::ffi::CString; #[cfg(target_os = "windows")]
use std::ptr::{null, null_mut}; use {
std::ffi::CString,
std::ptr::{null, null_mut},
};
#[cfg(windows)] #[cfg(windows)]
use winapi::{ use winapi::{
shared::minwindef::{DWORD, HKEY, MAX_PATH}, shared::minwindef::{DWORD, HKEY, MAX_PATH},

Loading…
Cancel
Save