Skip to content

Commit 726eaa4

Browse files
committed
chore: minor lints
1 parent 7e092c7 commit 726eaa4

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

src/cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub struct Cli {
4747
}
4848

4949
impl Cli {
50-
fn get_seconds(&self) -> Option<u64> {
50+
const fn get_seconds(&self) -> Option<u64> {
5151
if let Some(seconds) = self.seconds {
5252
return Some(seconds);
5353
}

src/data.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ struct FileInfo {
3232

3333
impl Default for FileInfo {
3434
fn default() -> Self {
35-
FileInfo {
35+
Self {
3636
wallpaper: String::default(),
3737
on: true,
3838
}
3939
}
4040
}
4141

42-
/// Reads the YAML file and returns a FileInfo struct
42+
/// Reads the YAML file and returns a `FileInfo` struct
4343
fn read_config() -> Result<FileInfo> {
4444
std::fs::create_dir_all(format!(
4545
"{}/
@@ -61,7 +61,7 @@ fn read_config() -> Result<FileInfo> {
6161
Ok(config)
6262
}
6363

64-
/// Writes the FileInfo struct into the YAML file
64+
/// Writes the `FileInfo` struct into the YAML file
6565
fn write_config(config: &FileInfo) -> Result<()> {
6666
let path = get_wallpaper_info_path()?;
6767
let yaml = serde_yaml::to_string(config)?;

src/path.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl TryFrom<String> for crate::path::File {
5454
type Error = &'static str;
5555

5656
fn try_from(path: String) -> Result<Self, Self::Error> {
57-
if let Some(file) = File::new(PathBuf::from(path)) {
57+
if let Some(file) = Self::new(PathBuf::from(path)) {
5858
Ok(file)
5959
} else {
6060
Err("failed to create file")
@@ -66,7 +66,7 @@ impl TryFrom<PathBuf> for File {
6666
type Error = &'static str;
6767

6868
fn try_from(path: PathBuf) -> Result<Self, Self::Error> {
69-
if let Some(file) = File::new(path) {
69+
if let Some(file) = Self::new(path) {
7070
Ok(file)
7171
} else {
7272
Err("failed to create file")
@@ -162,7 +162,7 @@ impl ImagePath {
162162
}
163163

164164
#[must_use]
165-
pub fn get_animated_number(&self) -> Option<u32> {
165+
pub const fn get_animated_number(&self) -> Option<u32> {
166166
if let Some(info) = self.animated_info.as_ref() {
167167
return Some(info.animated_number);
168168
}

src/wallpaper.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ pub fn get_random_wallpaper(settings: &Settings) -> Result<File> {
6767
}
6868

6969
/// Returns a path to the next animated wallpaper.
70+
///
7071
/// If the path is a folder it will return the first wallpaper in the folder.
7172
/// If the path is a file it will return the next wallpaper in the folder.
7273
/// If the path is the last wallpaper in the folder it will return None.

0 commit comments

Comments
 (0)