Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rustfmt.tomlfile #228

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions crates/carbon_app/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ fn main() {
.args(["log", "-1", "--format=%ct"])
.output()
.unwrap();
let git_commit_author_date = String::from_utf8(git_commit_author_date.stdout).unwrap();
let git_commit_author_date =
String::from_utf8(git_commit_author_date.stdout).unwrap();

let version_json = std::fs::read_to_string("../../packages/config/version.json").unwrap();
let version_json: serde_json::Value = serde_json::from_str(&version_json).unwrap();
let version_json =
std::fs::read_to_string("../../packages/config/version.json").unwrap();
let version_json: serde_json::Value =
serde_json::from_str(&version_json).unwrap();

let version = version_json["version"].as_str().unwrap();
let channel = version_json["channel"]
Expand Down
3 changes: 2 additions & 1 deletion crates/carbon_app/src/api/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ pub(super) fn mount_axum_router() -> axum::Router<Arc<AppInner>> {
axum::Router::new().route(
"/headImage",
axum::routing::get(
|State(app): State<Arc<AppInner>>, Query(query): Query<HeadQuery>| async move {
|State(app): State<Arc<AppInner>>,
Query(query): Query<HeadQuery>| async move {
app.account_manager()
.skin_manager()
.make_head(query.uuid)
Expand Down
12 changes: 9 additions & 3 deletions crates/carbon_app/src/api/instance/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -981,8 +981,12 @@ impl From<manager::ListInstance> for ListInstance {
impl From<manager::ListInstanceStatus> for ListInstanceStatus {
fn from(value: manager::ListInstanceStatus) -> Self {
match value {
manager::ListInstanceStatus::Valid(status) => Self::Valid(status.into()),
manager::ListInstanceStatus::Invalid(status) => Self::Invalid(status.into()),
manager::ListInstanceStatus::Valid(status) => {
Self::Valid(status.into())
}
manager::ListInstanceStatus::Invalid(status) => {
Self::Invalid(status.into())
}
}
}
}
Expand Down Expand Up @@ -1021,7 +1025,9 @@ impl From<manager::ConfigurationParseError> for ConfigurationParseError {
}
}

impl From<manager::ConfigurationParseErrorType> for ConfigurationParseErrorType {
impl From<manager::ConfigurationParseErrorType>
for ConfigurationParseErrorType
{
fn from(value: manager::ConfigurationParseErrorType) -> Self {
use manager::ConfigurationParseErrorType as manager;

Expand Down
36 changes: 27 additions & 9 deletions crates/carbon_app/src/api/java/managed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ pub struct FEManagedJavaVersion {
java_version: String,
}

impl From<crate::managers::java::managed::ManagedJavaVersion> for FEManagedJavaVersion {
impl From<crate::managers::java::managed::ManagedJavaVersion>
for FEManagedJavaVersion
{
fn from(v: crate::managers::java::managed::ManagedJavaVersion) -> Self {
Self {
id: v.id,
Expand All @@ -109,7 +111,9 @@ impl From<crate::managers::java::managed::ManagedJavaVersion> for FEManagedJavaV
}
}

impl TryFrom<FEManagedJavaVersion> for crate::managers::java::managed::ManagedJavaVersion {
impl TryFrom<FEManagedJavaVersion>
for crate::managers::java::managed::ManagedJavaVersion
{
type Error = anyhow::Error;

fn try_from(v: FEManagedJavaVersion) -> Result<Self, Self::Error> {
Expand All @@ -124,7 +128,9 @@ impl TryFrom<FEManagedJavaVersion> for crate::managers::java::managed::ManagedJa

#[derive(Type, Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct FEManagedJavaArchMap(pub HashMap<FEManagedJavaArch, Vec<FEManagedJavaVersion>>);
pub struct FEManagedJavaArchMap(
pub HashMap<FEManagedJavaArch, Vec<FEManagedJavaVersion>>,
);

impl Deref for FEManagedJavaArchMap {
type Target = HashMap<FEManagedJavaArch, Vec<FEManagedJavaVersion>>;
Expand All @@ -134,19 +140,25 @@ impl Deref for FEManagedJavaArchMap {
}
}

impl From<crate::managers::java::managed::ManagedJavaArchMap> for FEManagedJavaArchMap {
impl From<crate::managers::java::managed::ManagedJavaArchMap>
for FEManagedJavaArchMap
{
fn from(v: crate::managers::java::managed::ManagedJavaArchMap) -> Self {
Self(
v.0.into_iter()
.map(|(k, v)| (k.into(), v.into_iter().map(|v| v.into()).collect()))
.map(|(k, v)| {
(k.into(), v.into_iter().map(|v| v.into()).collect())
})
.collect(),
)
}
}

#[derive(Type, Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct FEManagedJavaOsMap(pub HashMap<FEManagedJavaOs, FEManagedJavaArchMap>);
pub struct FEManagedJavaOsMap(
pub HashMap<FEManagedJavaOs, FEManagedJavaArchMap>,
);

impl Deref for FEManagedJavaOsMap {
type Target = HashMap<FEManagedJavaOs, FEManagedJavaArchMap>;
Expand All @@ -156,7 +168,9 @@ impl Deref for FEManagedJavaOsMap {
}
}

impl From<crate::managers::java::managed::ManagedJavaOsMap> for FEManagedJavaOsMap {
impl From<crate::managers::java::managed::ManagedJavaOsMap>
for FEManagedJavaOsMap
{
fn from(v: crate::managers::java::managed::ManagedJavaOsMap) -> Self {
Self(v.0.into_iter().map(|(k, v)| (k.into(), v.into())).collect())
}
Expand Down Expand Up @@ -186,8 +200,12 @@ impl From<crate::managers::java::managed::Step> for FEManagedJavaSetupProgress {

match v {
Step::Idle => Self::Idle,
Step::Downloading(a, b) => Self::Downloading(a.to_string(), b.to_string()),
Step::Extracting(a, b) => Self::Extracting(a.to_string(), b.to_string()),
Step::Downloading(a, b) => {
Self::Downloading(a.to_string(), b.to_string())
}
Step::Extracting(a, b) => {
Self::Extracting(a.to_string(), b.to_string())
}
Step::Done => Self::Done,
}
}
Expand Down
31 changes: 24 additions & 7 deletions crates/carbon_app/src/api/java/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use crate::api::java::managed::{FEManagedJavaSetupArgs, FEManagedJavaSetupProgress};
use crate::api::java::managed::{
FEManagedJavaSetupArgs, FEManagedJavaSetupProgress,
};
use crate::api::managers::App;
use crate::api::router::router;
use crate::domain::java::{JavaComponentType, JavaVendor};
Expand All @@ -7,7 +9,9 @@ use rspc::{RouterBuilderLike, Type};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;

use self::managed::{FEManagedJavaArch, FEManagedJavaOs, FEManagedJavaOsMap, FEVendor};
use self::managed::{
FEManagedJavaArch, FEManagedJavaOs, FEManagedJavaOsMap, FEVendor,
};

mod managed;

Expand Down Expand Up @@ -78,7 +82,10 @@ fn get_managed_os(app: App, _args: ()) -> anyhow::Result<Vec<FEManagedJavaOs>> {
Ok(all_os.into_iter().map(FEManagedJavaOs::from).collect())
}

fn get_managed_arch(app: App, _args: ()) -> anyhow::Result<Vec<FEManagedJavaArch>> {
fn get_managed_arch(
app: App,
_args: (),
) -> anyhow::Result<Vec<FEManagedJavaArch>> {
let all_arch = app.java_manager().managed_service.get_all_archs();

Ok(all_arch.into_iter().map(FEManagedJavaArch::from).collect())
Expand All @@ -103,7 +110,10 @@ async fn get_managed_versions_by_vendor(
Ok(managed_java_map_os.into())
}

async fn setup_managed_java(app: App, args: FEManagedJavaSetupArgs) -> anyhow::Result<String> {
async fn setup_managed_java(
app: App,
args: FEManagedJavaSetupArgs,
) -> anyhow::Result<String> {
app.java_manager()
.managed_service
.setup_managed(
Expand Down Expand Up @@ -132,7 +142,10 @@ async fn get_setup_managed_java_progress(
Ok(res.into())
}

async fn get_system_java_profiles(app: App, _args: ()) -> anyhow::Result<Vec<FESystemJavaProfile>> {
async fn get_system_java_profiles(
app: App,
_args: (),
) -> anyhow::Result<Vec<FESystemJavaProfile>> {
let profiles = app.java_manager().get_system_java_profiles().await?;

Ok(profiles
Expand Down Expand Up @@ -224,7 +237,9 @@ pub enum FESystemJavaProfileName {
MinecraftJavaExe,
}

impl From<crate::domain::java::SystemJavaProfileName> for FESystemJavaProfileName {
impl From<crate::domain::java::SystemJavaProfileName>
for FESystemJavaProfileName
{
fn from(name: crate::domain::java::SystemJavaProfileName) -> Self {
use crate::domain::java::SystemJavaProfileName;
match name {
Expand All @@ -238,7 +253,9 @@ impl From<crate::domain::java::SystemJavaProfileName> for FESystemJavaProfileNam
}
}

impl From<FESystemJavaProfileName> for crate::domain::java::SystemJavaProfileName {
impl From<FESystemJavaProfileName>
for crate::domain::java::SystemJavaProfileName
{
fn from(name: FESystemJavaProfileName) -> Self {
match name {
FESystemJavaProfileName::Legacy => Self::Legacy,
Expand Down
6 changes: 5 additions & 1 deletion crates/carbon_app/src/api/mc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ pub struct FEModdedManifest {
impl From<modded::Manifest> for FEModdedManifest {
fn from(value: modded::Manifest) -> Self {
FEModdedManifest {
game_versions: value.game_versions.into_iter().map(|v| v.into()).collect(),
game_versions: value
.game_versions
.into_iter()
.map(|v| v.into())
.collect(),
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion crates/carbon_app/src/api/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ impl From<FEEvent> for crate::domain::metrics::Event {
fn from(event: FEEvent) -> Self {
Self {
name: match event.name {
FEEventName::AppClosed => crate::domain::metrics::EventName::AppClosed,
FEEventName::AppClosed => {
crate::domain::metrics::EventName::AppClosed
}
},
properties: event.properties,
}
Expand Down
47 changes: 34 additions & 13 deletions crates/carbon_app/src/api/modplatforms/curseforge/filters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ use rspc::Type;
use serde::{Deserialize, Serialize};

use crate::domain::modplatforms::curseforge::filters::{
FilesParameters, FilesParametersBody, ModDescriptionParameters, ModFileChangelogParameters,
ModFileParameters, ModFilesParameters, ModFilesParametersQuery, ModParameters,
ModSearchParameters, ModSearchParametersQuery, ModSearchSortField, ModSearchSortOrder,
FilesParameters, FilesParametersBody, ModDescriptionParameters,
ModFileChangelogParameters, ModFileParameters, ModFilesParameters,
ModFilesParametersQuery, ModParameters, ModSearchParameters,
ModSearchParametersQuery, ModSearchSortField, ModSearchSortOrder,
ModsParameters, ModsParametersBody,
};

Expand All @@ -27,13 +28,21 @@ impl From<CFFEModSearchSortField> for ModSearchSortField {
fn from(field: CFFEModSearchSortField) -> Self {
match field {
CFFEModSearchSortField::Featured => ModSearchSortField::Featured,
CFFEModSearchSortField::Popularity => ModSearchSortField::Popularity,
CFFEModSearchSortField::LastUpdated => ModSearchSortField::LastUpdated,
CFFEModSearchSortField::Popularity => {
ModSearchSortField::Popularity
}
CFFEModSearchSortField::LastUpdated => {
ModSearchSortField::LastUpdated
}
CFFEModSearchSortField::Name => ModSearchSortField::Name,
CFFEModSearchSortField::Author => ModSearchSortField::Author,
CFFEModSearchSortField::TotalDownloads => ModSearchSortField::TotalDownloads,
CFFEModSearchSortField::TotalDownloads => {
ModSearchSortField::TotalDownloads
}
CFFEModSearchSortField::Category => ModSearchSortField::Category,
CFFEModSearchSortField::GameVersion => ModSearchSortField::GameVersion,
CFFEModSearchSortField::GameVersion => {
ModSearchSortField::GameVersion
}
}
}
}
Expand All @@ -42,13 +51,21 @@ impl From<ModSearchSortField> for CFFEModSearchSortField {
fn from(field: ModSearchSortField) -> Self {
match field {
ModSearchSortField::Featured => CFFEModSearchSortField::Featured,
ModSearchSortField::Popularity => CFFEModSearchSortField::Popularity,
ModSearchSortField::LastUpdated => CFFEModSearchSortField::LastUpdated,
ModSearchSortField::Popularity => {
CFFEModSearchSortField::Popularity
}
ModSearchSortField::LastUpdated => {
CFFEModSearchSortField::LastUpdated
}
ModSearchSortField::Name => CFFEModSearchSortField::Name,
ModSearchSortField::Author => CFFEModSearchSortField::Author,
ModSearchSortField::TotalDownloads => CFFEModSearchSortField::TotalDownloads,
ModSearchSortField::TotalDownloads => {
CFFEModSearchSortField::TotalDownloads
}
ModSearchSortField::Category => CFFEModSearchSortField::Category,
ModSearchSortField::GameVersion => CFFEModSearchSortField::GameVersion,
ModSearchSortField::GameVersion => {
CFFEModSearchSortField::GameVersion
}
}
}
}
Expand All @@ -64,7 +81,9 @@ impl From<CFFEModSearchSortOrder> for ModSearchSortOrder {
fn from(order: CFFEModSearchSortOrder) -> Self {
match order {
CFFEModSearchSortOrder::Ascending => ModSearchSortOrder::Ascending,
CFFEModSearchSortOrder::Descending => ModSearchSortOrder::Descending,
CFFEModSearchSortOrder::Descending => {
ModSearchSortOrder::Descending
}
}
}
}
Expand All @@ -73,7 +92,9 @@ impl From<ModSearchSortOrder> for CFFEModSearchSortOrder {
fn from(order: ModSearchSortOrder) -> Self {
match order {
ModSearchSortOrder::Ascending => CFFEModSearchSortOrder::Ascending,
ModSearchSortOrder::Descending => CFFEModSearchSortOrder::Descending,
ModSearchSortOrder::Descending => {
CFFEModSearchSortOrder::Descending
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use rspc::Type;
use serde::{Deserialize, Serialize};

use crate::domain::modplatforms::curseforge::{Category, CurseForgeResponse, File, Mod};
use crate::domain::modplatforms::curseforge::{
Category, CurseForgeResponse, File, Mod,
};

use super::structs::{CFFECategory, CFFEFile, CFFEMod, CFFEPagination};

Expand Down
Loading
Loading