cleanup nightly clippy warnings

This commit is contained in:
Stephan Dilly 2021-01-08 11:55:50 +01:00
parent 46de25546d
commit b63063271d
5 changed files with 16 additions and 11 deletions

View File

@ -30,9 +30,9 @@ impl ToString for CommitId {
}
}
impl Into<Oid> for CommitId {
fn into(self) -> Oid {
self.0
impl From<CommitId> for Oid {
fn from(id: CommitId) -> Self {
id.0
}
}

View File

@ -4,7 +4,7 @@ use scopetime::scope_time;
use std::{
fs::{File, OpenOptions},
io::{Read, Seek, SeekFrom, Write},
path::PathBuf,
path::Path,
};
static GITIGNORE: &str = ".gitignore";
@ -38,7 +38,7 @@ pub fn add_to_ignore(
Ok(())
}
fn file_ends_with_newline(file: &PathBuf) -> Result<bool> {
fn file_ends_with_newline(file: &Path) -> Result<bool> {
let mut file = File::open(file)?;
let size = file.metadata()?.len();

View File

@ -74,9 +74,9 @@ impl Default for StatusType {
}
}
impl Into<StatusShow> for StatusType {
fn into(self) -> StatusShow {
match self {
impl From<StatusType> for StatusShow {
fn from(s: StatusType) -> Self {
match s {
StatusType::WorkingDir => StatusShow::Workdir,
StatusType::Stage => StatusShow::Index,
StatusType::Both => StatusShow::IndexAndWorkdir,

View File

@ -180,6 +180,7 @@ impl DetailsComponent {
}
}
#[allow(unstable_name_collisions)]
fn get_text_info(&self) -> Vec<Spans> {
if let Some(ref data) = self.data {
let mut res = vec![
@ -247,6 +248,7 @@ impl DetailsComponent {
res.push(Spans::from(
self.style_detail(&Detail::Sha),
));
res.push(Spans::from(
self.tags
.iter()

View File

@ -34,9 +34,12 @@ impl Size {
}
}
impl Into<Size> for Rect {
fn into(self) -> Size {
Size::new(self.width, self.height)
impl From<Rect> for Size {
fn from(r: Rect) -> Self {
Self {
width: r.width,
height: r.height,
}
}
}