From e497ce11e01f374ab551cda3b36dad6be60c3aad Mon Sep 17 00:00:00 2001 From: phoenix Date: Sun, 16 Mar 2025 15:15:31 -0400 Subject: [PATCH] Making some changes to address warnings Constants changed --- src/constants.rs | 10 +++++----- src/song.rs | 16 ++++++++-------- src/token.rs | 8 +++++++- src/types.rs | 7 +++---- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/constants.rs b/src/constants.rs index 2cb80f4..51dd5ea 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -1,5 +1,5 @@ -pub const DEFAULT_MUSIC_EXTENSION: &str = FLAC_EXTENSION; -pub const FLAC_EXTENSION: &str = ".flac"; -pub const WAV_EXTENSION: &str = ".wav"; -pub const MPTHREE_EXTENSION: &str = ".mp3"; -pub const JPG_EXTENSION: &str = ".jpg"; +pub const DEFAULTMUSICEXTENSION: &str = FLACEXTENSION; +pub const FLACEXTENSION: &str = ".flac"; +pub const WAVEXTENSION: &str = ".wav"; +pub const MPTHREEEXTENSION: &str = ".mp3"; +pub const JPGEXTENSION: &str = ".jpg"; diff --git a/src/song.rs b/src/song.rs index 1a0fdd6..467a99d 100644 --- a/src/song.rs +++ b/src/song.rs @@ -108,9 +108,9 @@ impl Song { let directory = &self.directory; let mut buffer: String = String::from(directory.clone()); - let lastIndex = directory.len() - 1; + let last_index = directory.len() - 1; - if let Some(character) = directory.chars().nth(lastIndex) { + if let Some(character) = directory.chars().nth(last_index) { if character != '/' { buffer += "/"; } @@ -127,9 +127,9 @@ impl Song { } pub fn to_data(&self) -> Result, std::io::Error> { - let pathResult = self.song_path(); + let path_result = self.song_path(); - match pathResult { + match path_result { Ok(path) => { let mut file = std::fs::File::open(path)?; let mut buffer: Vec = Vec::new(); @@ -175,9 +175,9 @@ mod embedded { let directory = &self.directory; let mut buffer: String = String::from(directory.clone()); - let lastIndex = directory.len() - 1; + let last_index = directory.len() - 1; - if let Some(character) = directory.chars().nth(lastIndex) { + if let Some(character) = directory.chars().nth(last_index) { if character != '/' { buffer += "/"; } @@ -194,9 +194,9 @@ mod embedded { } pub fn to_data(&self) -> Result, std::io::Error> { - let pathResult = self.song_path(); + let path_result = self.song_path(); - match pathResult { + match path_result { Ok(path) => { let mut file = std::fs::File::open(path)?; let mut buffer: Vec = Vec::new(); diff --git a/src/token.rs b/src/token.rs index 04c7723..3934840 100644 --- a/src/token.rs +++ b/src/token.rs @@ -58,7 +58,13 @@ impl Token { } // TODO: Implement - pub fn contains_scope(&self, des_scope: String) -> bool { + pub fn contains_scope(&self, des_scope: &String) -> bool { + let extracted_token: String = String::from("Token"); + + if extracted_token == *des_scope { + return true; + } + return false; } } diff --git a/src/types.rs b/src/types.rs index cd84f04..03881fb 100644 --- a/src/types.rs +++ b/src/types.rs @@ -1,9 +1,8 @@ -use std::default::Default; mod types { pub enum Types { - WAV_EXTENSION, - FLAC_EXTENSION, - MP_EXTENSION, + WavExtension, + FlacExtension, + MPThreeExtension, } }