lint: fix lint errors

This commit is contained in:
anatawa12 2024-10-28 21:52:11 +09:00
commit 4d36a402df
No known key found for this signature in database
GPG key ID: 9CA909848B8E4EA6
11 changed files with 20 additions and 20 deletions

View file

@ -11,7 +11,7 @@ pub struct ConnectionString<'a> {
readonly: bool,
}
impl<'a> ConnectionString<'a> {
impl ConnectionString<'_> {
pub fn connect(&self) -> crate::Result<DatabaseConnection> {
DatabaseConnection::connect(self)
}

View file

@ -34,7 +34,7 @@ impl<'de> Deserialize<'de> for YankState {
D: Deserializer<'de>,
{
struct VisitorImpl;
impl<'de> serde::de::Visitor<'de> for VisitorImpl {
impl serde::de::Visitor<'_> for VisitorImpl {
type Value = YankState;
fn expecting(&self, formatter: &mut Formatter) -> std::fmt::Result {

View file

@ -223,7 +223,7 @@ impl RemotePackages {
struct PackageNameToRemotePackages<'a>(&'a str);
impl<'de, 'a> DeserializeSeed<'de> for PackageNameToRemotePackages<'a> {
impl<'de> DeserializeSeed<'de> for PackageNameToRemotePackages<'_> {
type Value = RemotePackages;
fn deserialize<D>(self, deserializer: D) -> Result<Self::Value, D::Error>
@ -232,7 +232,7 @@ impl<'de, 'a> DeserializeSeed<'de> for PackageNameToRemotePackages<'a> {
{
struct VisitorImpl<'a>(&'a str);
impl<'de, 'a> Visitor<'de> for VisitorImpl<'a> {
impl<'de> Visitor<'de> for VisitorImpl<'_> {
type Value = RemotePackages;
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
@ -259,7 +259,7 @@ impl<'de, 'a> DeserializeSeed<'de> for PackageNameToRemotePackages<'a> {
struct PackageNameToVersions<'a>(&'a str);
impl<'de, 'a> DeserializeSeed<'de> for PackageNameToVersions<'a> {
impl<'de> DeserializeSeed<'de> for PackageNameToVersions<'_> {
type Value = HashMap<Version, PackageManifest>;
fn deserialize<D>(self, deserializer: D) -> Result<Self::Value, D::Error>
@ -268,7 +268,7 @@ impl<'de, 'a> DeserializeSeed<'de> for PackageNameToVersions<'a> {
{
struct VisitorImpl<'a>(&'a str);
impl<'de, 'a> Visitor<'de> for VisitorImpl<'a> {
impl<'de> Visitor<'de> for VisitorImpl<'_> {
type Value = HashMap<Version, PackageManifest>;
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
@ -296,7 +296,7 @@ impl<'de, 'a> DeserializeSeed<'de> for PackageNameToVersions<'a> {
struct ErrorProofManifest<'a>(&'a str, &'a Version);
impl<'de, 'a> DeserializeSeed<'de> for ErrorProofManifest<'a> {
impl<'de> DeserializeSeed<'de> for ErrorProofManifest<'_> {
type Value = Option<PackageManifest>;
fn deserialize<D>(self, deserializer: D) -> Result<Self::Value, D::Error>

View file

@ -45,7 +45,7 @@ where
struct Legacy<'env>(&'env [Box<str>]);
impl<'env> Default for Legacy<'env> {
impl Default for Legacy<'_> {
fn default() -> Self {
static VEC: Vec<Box<str>> = Vec::new();
Self(&VEC)
@ -119,7 +119,7 @@ where
}
}
impl<'env, 'a> ResolutionContext<'env, 'a> {
impl<'env> ResolutionContext<'env, '_> {
fn new(allow_prerelease: bool, packages: Vec<PackageInfo<'env>>) -> Self {
let mut this = Self {
dependencies: HashMap::new(),
@ -324,7 +324,7 @@ where
}
}
impl<'env, 'a> ResolutionContext<'env, 'a> {
impl<'env> ResolutionContext<'env, '_> {
pub(crate) fn build_result(self) -> PackageResolutionResult<'env> {
let mut conflicts = HashMap::<Box<str>, Vec<Box<str>>>::new();
for (&name, info) in &self.dependencies {

View file

@ -84,7 +84,7 @@ pub struct Remove<'env> {
_phantom: PhantomData<&'env ()>,
}
impl<'env> Remove<'env> {
impl Remove<'_> {
pub fn reason(&self) -> RemoveReason {
self.reason
}

View file

@ -65,7 +65,7 @@ impl<'a> OsEolJsonPrettyFormatter<'a> {
}
}
impl<'a> Formatter for OsEolJsonPrettyFormatter<'a> {
impl Formatter for OsEolJsonPrettyFormatter<'_> {
#[inline]
fn begin_array<W>(&mut self, writer: &mut W) -> io::Result<()>
where

View file

@ -447,7 +447,7 @@ impl<'a, T> MapKeySeed<'a, T> {
}
}
impl<'a, 'de, T> DeserializeSeed<'de> for MapKeySeed<'a, T>
impl<'de, T> DeserializeSeed<'de> for MapKeySeed<'_, T>
where
T: DeserializeSeed<'de>,
{
@ -486,7 +486,7 @@ impl<'a> MapKeyMeta<'a> {
}
}
impl<'de, 'a, T> Deserializer<'de> for MapKeyDeserializer<'a, T>
impl<'de, T> Deserializer<'de> for MapKeyDeserializer<'_, T>
where
T: Deserializer<'de>,
{

View file

@ -9,7 +9,7 @@ pub(super) struct ParsingBuf<'a> {
}
impl<'a> ParsingBuf<'a> {
pub fn new(source: &'a str) -> ParsingBuf {
pub fn new(source: &'a str) -> Self {
Self { buf: source }
}

View file

@ -70,7 +70,7 @@ impl<'a> VersionSelector<'a> {
}
}
impl<'a> VersionSelector<'a> {
impl VersionSelector<'_> {
pub(crate) fn as_specific(&self) -> Option<&Version> {
match self.inner {
SelectorInner::Specific(version) => Some(version),
@ -79,7 +79,7 @@ impl<'a> VersionSelector<'a> {
}
}
impl<'a> VersionSelector<'a> {
impl VersionSelector<'_> {
pub fn satisfies(&self, package: &PackageManifest) -> bool {
fn unity_and_yank(package: &PackageManifest, project_unity: Option<UnityVersion>) -> bool {
if package.is_yanked() {

View file

@ -1562,7 +1562,7 @@ impl Completion {
exit_with!("shell not specified")
};
let mut bin_name = args().next().expect("bin name");
if let Some(slash) = bin_name.rfind(&['/', '\\']) {
if let Some(slash) = bin_name.rfind(['/', '\\']) {
// https://github.com/rust-lang/rust-clippy/issues/13070
#[allow(clippy::assigning_clones)]
{

View file

@ -2,7 +2,7 @@ use crate::commands::{
confirm_prompt, load_collection, load_unity, update_project_last_modified, EnvArgs, ResultExt,
};
use clap::{Parser, Subcommand};
use log::{info, warn};
use log::info;
use std::path::{Path, PathBuf};
use std::process::exit;
use tokio::process::Command;
@ -78,7 +78,7 @@ impl Unity2022 {
if found.version() != Some(VRCHAT_RECOMMENDED_2022_UNITY) {
// since we know it's unity 2022, we can safely unwrap
warn!("Recommended Unity 2022 version is not found. Using found version: {}", found.version().unwrap());
log::warn!("Recommended Unity 2022 version is not found. Using found version: {}", found.version().unwrap());
}
PathBuf::from(found.path())