diff options
| author | 2025-01-30 23:39:40 -0600 | |
|---|---|---|
| committer | 2025-01-30 23:39:40 -0600 | |
| commit | 58b85cd77338bfc5a35fa39e10598cadb27eee32 (patch) | |
| tree | 504f2ce93ff4ef3129b757018a3d9b47f257328b | |
| parent | remove dead oauth code (diff) | |
Remove some unused imports but not all of them
| -rw-r--r-- | ozone-cli/src/main.rs | 1 | ||||
| -rw-r--r-- | src/assets.rs | 1 | ||||
| -rw-r--r-- | src/auth.rs | 8 | ||||
| -rw-r--r-- | src/auth/msa.rs | 7 | ||||
| -rw-r--r-- | src/auth/types.rs | 5 | ||||
| -rw-r--r-- | src/launcher.rs | 5 | ||||
| -rw-r--r-- | src/launcher/assets.rs | 2 | ||||
| -rw-r--r-- | src/launcher/extract.rs | 2 | ||||
| -rw-r--r-- | src/launcher/jre.rs | 5 | ||||
| -rw-r--r-- | src/launcher/jre/download.rs | 7 | ||||
| -rw-r--r-- | src/launcher/runner.rs | 1 | ||||
| -rw-r--r-- | src/launcher/settings.rs | 1 | ||||
| -rw-r--r-- | src/util.rs | 1 | ||||
| -rw-r--r-- | src/version.rs | 2 |
14 files changed, 16 insertions, 32 deletions
diff --git a/ozone-cli/src/main.rs b/ozone-cli/src/main.rs index 332b6e7..e36867a 100644 --- a/ozone-cli/src/main.rs +++ b/ozone-cli/src/main.rs @@ -1,6 +1,5 @@ use std::env::consts::{ARCH, OS}; use std::error::Error; -use std::path::PathBuf; use log::{error, info}; use sysinfo::System; use o3launcher::launcher::{Launcher, Settings}; diff --git a/src/assets.rs b/src/assets.rs index f7d0977..15087c9 100644 --- a/src/assets.rs +++ b/src/assets.rs @@ -69,6 +69,7 @@ where deserializer.deserialize_any(AssetVisitor(PhantomData)) } +#[cfg(test)] mod tests { use super::*; diff --git a/src/auth.rs b/src/auth.rs index 034f39d..1eb65ed 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -5,11 +5,10 @@ mod mcservices; use std::error::Error;
use std::fmt::{Display, Formatter};
use std::future::Future;
-use std::ops::Add;
-use std::time::{Duration, Instant, SystemTime};
-use chrono::{DateTime, NaiveDateTime, TimeDelta, Utc};
+use std::time::{Duration, SystemTime};
+use chrono::{DateTime, TimeDelta, Utc};
use log::debug;
-use oauth2::{AccessToken, AuthType, AuthUrl, ClientId, DeviceAuthorizationResponse, DeviceAuthorizationUrl, DeviceCodeErrorResponse, EmptyExtraDeviceAuthorizationFields, EndpointNotSet, EndpointSet, HttpClientError, RefreshToken, RequestTokenError, Scope, StandardDeviceAuthorizationResponse, StandardRevocableToken, StandardTokenResponse, TokenResponse, TokenUrl};
+use oauth2::{AccessToken, DeviceAuthorizationUrl, DeviceCodeErrorResponse, EmptyExtraDeviceAuthorizationFields, EndpointNotSet, EndpointSet, HttpClientError, RefreshToken, RequestTokenError, Scope, StandardDeviceAuthorizationResponse, StandardRevocableToken, StandardTokenResponse, TokenResponse, TokenUrl};
use oauth2::basic::{BasicErrorResponse, BasicErrorResponseType, BasicRevocationErrorResponse, BasicTokenIntrospectionResponse, BasicTokenResponse};
use reqwest::{IntoUrl, Method, RequestBuilder};
pub use types::*;
@@ -285,7 +284,6 @@ impl MsaUser { #[cfg(test)]
mod test {
- use reqwest::Client;
use super::*;
#[tokio::test]
diff --git a/src/auth/msa.rs b/src/auth/msa.rs index 6c90790..47e088b 100644 --- a/src/auth/msa.rs +++ b/src/auth/msa.rs @@ -1,16 +1,13 @@ use std::borrow::Cow; use std::collections::HashMap; -use std::ops::Add; -use std::time::{Duration, SystemTime}; -use chrono::{DateTime, TimeDelta, Utc}; +use chrono::{DateTime, Utc}; use log::debug; use oauth2::AccessToken; -use reqwest::{IntoUrl, Method, RequestBuilder}; +use reqwest::{Method}; use serde::{Deserialize, Serialize}; use uuid::Uuid; use crate::auth::AuthError; use crate::auth::types::Token; -use crate::util::USER_AGENT; const XBOX_LIVE_AUTH: &str = "https://user.auth.xboxlive.com/user/authenticate"; const XBOX_LIVE_XSTS: &str = "https://xsts.auth.xboxlive.com/xsts/authorize"; diff --git a/src/auth/types.rs b/src/auth/types.rs index c7a9ac9..348bdf8 100644 --- a/src/auth/types.rs +++ b/src/auth/types.rs @@ -1,12 +1,11 @@ pub mod property_map;
pub use property_map::PropertyMap;
-use std::fmt::{Debug, Formatter, Write};
+use std::fmt::{Debug, Formatter};
use chrono::{DateTime, Utc};
use multimap::MultiMap;
use oauth2::RefreshToken;
-use serde::{Deserialize, Deserializer, Serialize};
-use serde::de::{Error, SeqAccess, Visitor};
+use serde::{Deserialize, Serialize};
use uuid::Uuid;
#[derive(Debug, Serialize, Deserialize)]
diff --git a/src/launcher.rs b/src/launcher.rs index 653f17a..d414305 100644 --- a/src/launcher.rs +++ b/src/launcher.rs @@ -17,7 +17,7 @@ use std::ffi::{OsStr, OsString}; use std::fmt::{Display, Formatter}; use std::io::ErrorKind; use std::io::ErrorKind::AlreadyExists; -use std::path::{Component, Path, PathBuf, Prefix}; +use std::path::{Component, Path, PathBuf}; use std::{env, process}; use std::env::JoinPathsError; use std::time::{Instant, SystemTime, UNIX_EPOCH}; @@ -32,7 +32,7 @@ use tokio_stream::wrappers::ReadDirStream; use download::{MultiDownloader, VerifiedDownload}; use rules::{CompatCheck, IncompatibleError}; use version::{VersionList, VersionResolveError, VersionResult}; -use crate::version::{Logging, Library, OSRestriction, OperatingSystem, DownloadType, DownloadInfo, LibraryExtractRule, CompleteVersion, FeatureMatcher, ClientLogging}; +use crate::version::{Library, OSRestriction, OperatingSystem, DownloadType, DownloadInfo, LibraryExtractRule, CompleteVersion, FeatureMatcher, ClientLogging}; use assets::{AssetError, AssetRepository}; use crate::util::{self, AsJavaPath}; @@ -685,7 +685,6 @@ impl LibraryRepository { } async fn extract_natives<'lib>(&self, libs: Vec<LibraryExtractJob>) -> Result<PathBuf, LaunchError> { - let libs = libs; fs::create_dir_all(&self.natives).await.map_err(|e| LaunchError::IO { what: "creating natives directory", error: e diff --git a/src/launcher/assets.rs b/src/launcher/assets.rs index cd75d0d..dacd01d 100644 --- a/src/launcher/assets.rs +++ b/src/launcher/assets.rs @@ -10,7 +10,6 @@ use reqwest::Client; use sha1_smol::Sha1;
use tokio::{fs, io};
use tokio::fs::File;
-use tokio_stream::StreamExt;
use crate::assets::{Asset, AssetIndex};
use crate::launcher::download::{MultiDownloader, VerifiedDownload};
use crate::util;
@@ -307,6 +306,7 @@ impl AssetRepository { }
}
+#[cfg(test)]
mod tests {
use super::*;
diff --git a/src/launcher/extract.rs b/src/launcher/extract.rs index 0a08175..8c5f2b8 100644 --- a/src/launcher/extract.rs +++ b/src/launcher/extract.rs @@ -3,7 +3,7 @@ use std::fmt::{Display, Formatter}; use std::{fs, io, os}; use std::fs::File; use std::io::{BufReader, Error as IOError, Read}; -use std::path::{Component, Path, PathBuf}; +use std::path::{Path, PathBuf}; use log::{debug, trace}; use zip::result::ZipError; use zip::ZipArchive; diff --git a/src/launcher/jre.rs b/src/launcher/jre.rs index a3cbb27..0b92c20 100644 --- a/src/launcher/jre.rs +++ b/src/launcher/jre.rs @@ -1,4 +1,3 @@ -use std::collections::HashSet; use std::error::Error; use std::fmt::{Debug, Display, Formatter}; use std::path::{Component, Path, PathBuf}; @@ -7,8 +6,6 @@ use futures::{stream, StreamExt, TryStreamExt}; use log::{debug, info, warn}; use reqwest::Client; use tokio::{fs, io, io::ErrorKind}; -use tokio::fs::File; -use tokio::io::AsyncWriteExt; mod arch; mod manifest; @@ -21,7 +18,7 @@ use crate::launcher::download::MultiDownloader; use crate::launcher::jre::download::{LzmaDownloadError, LzmaDownloadJob}; use crate::launcher::jre::manifest::JavaRuntimeFile; use crate::util; -use crate::util::{EnsureFileError, FileVerifyError, IntegrityError}; +use crate::util::{EnsureFileError, IntegrityError}; use crate::version::DownloadInfo; use super::constants; diff --git a/src/launcher/jre/download.rs b/src/launcher/jre/download.rs index c24b82f..ddf1ff6 100644 --- a/src/launcher/jre/download.rs +++ b/src/launcher/jre/download.rs @@ -1,14 +1,11 @@ use std::error::Error; use std::fmt::{Debug, Display, Formatter}; -use std::fs::Permissions; use std::io::Write; -use std::ops::AddAssign; -use std::path::{Path, PathBuf}; +use std::path::{PathBuf}; use log::debug; use lzma_rs::decompress; -use reqwest::{Client, IntoUrl, RequestBuilder}; +use reqwest::{Client, RequestBuilder}; use sha1_smol::{Digest, Sha1}; -use tokio::fs; use tokio::io::AsyncWriteExt; use tokio::fs::File; use crate::launcher::download::Download; diff --git a/src/launcher/runner.rs b/src/launcher/runner.rs index a58602e..f7fd025 100644 --- a/src/launcher/runner.rs +++ b/src/launcher/runner.rs @@ -198,6 +198,7 @@ fn search_java_sync(base: impl AsRef<Path>, legacy: bool) -> Result<Option<PathB Ok(None) // not found (sadface) } +//noinspection RsConstantConditionIf pub async fn find_java(base: impl AsRef<Path>, legacy: bool) -> Result<Option<PathBuf>, io::Error> { let meta = fs::metadata(&base).await?; if meta.is_dir() { // do search diff --git a/src/launcher/settings.rs b/src/launcher/settings.rs index 5c8cb27..4dfc4ac 100644 --- a/src/launcher/settings.rs +++ b/src/launcher/settings.rs @@ -1,6 +1,5 @@ use std::collections::HashMap; use std::error::Error; -use std::ffi::{OsStr, OsString}; use std::fmt::{Display, Formatter}; use std::io::ErrorKind; use std::path::{Path, PathBuf}; diff --git a/src/util.rs b/src/util.rs index 8d35fb9..af960bd 100644 --- a/src/util.rs +++ b/src/util.rs @@ -8,7 +8,6 @@ use sha1_smol::{Digest, Sha1}; use tokio::fs::File; use tokio::{fs, io}; use tokio::io::{AsyncReadExt, AsyncWriteExt}; -use crate::util; const PKG_NAME: &str = env!("CARGO_PKG_NAME"); const PKG_VERSION: &str = env!("CARGO_PKG_VERSION"); diff --git a/src/version.rs b/src/version.rs index 3f5caba..2388390 100644 --- a/src/version.rs +++ b/src/version.rs @@ -1,9 +1,7 @@ use core::fmt; use std::{collections::BTreeMap, convert::Infallible, marker::PhantomData, ops::Deref, str::FromStr}; -use std::collections::HashMap; use chrono::{DateTime, NaiveDateTime, Utc}; use chrono::format::ParseErrorKind; -use indexmap::IndexMap; use regex::Regex; use serde::{de::{self, Visitor}, Deserialize, Deserializer}; use serde::de::{Error, SeqAccess}; |
