Skip to content

Commit 50a3fa9

Browse files
sharkdpDavid Peter
authored and
David Peter
committed
Fix clippy suggestions
1 parent 50d3895 commit 50a3fa9

File tree

5 files changed

+20
-30
lines changed

5 files changed

+20
-30
lines changed

numbat-cli/src/config.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,12 @@ pub enum ExchangeRateFetchingPolicy {
3434

3535
#[derive(Serialize, Deserialize)]
3636
#[serde(rename_all = "kebab-case", default, deny_unknown_fields)]
37+
#[derive(Default)]
3738
pub struct ExchangeRateConfig {
3839
pub fetching_policy: ExchangeRateFetchingPolicy,
3940
}
4041

41-
impl Default for ExchangeRateConfig {
42-
fn default() -> Self {
43-
Self {
44-
fetching_policy: ExchangeRateFetchingPolicy::default(),
45-
}
46-
}
47-
}
42+
4843

4944
#[derive(Serialize, Deserialize)]
5045
#[serde(rename_all = "kebab-case", default, deny_unknown_fields)]

numbat-cli/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use rustyline::{
2626
Validator,
2727
};
2828
use rustyline::{EventHandler, Highlighter, KeyCode, KeyEvent, Modifiers};
29-
use toml;
29+
3030

3131
use std::io::IsTerminal;
3232
use std::path::PathBuf;

numbat/src/module_importer.rs

+15-16
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,22 @@ impl ModuleImporter for FileSystemImporter {
6363
.follow_links(true)
6464
.follow_root_links(false)
6565
.into_iter()
66+
.flatten()
6667
{
67-
if let Ok(entry) = entry {
68-
let path = entry.path();
69-
if path.is_file() && path.extension() == Some(OsStr::new("nbt")) {
70-
if let Ok(relative_path) = path.strip_prefix(root_path) {
71-
let components: Vec<String> = relative_path
72-
.components()
73-
.map(|c| {
74-
c.as_os_str()
75-
.to_string_lossy()
76-
.trim_end_matches(".nbt")
77-
.to_string()
78-
})
79-
.collect();
80-
81-
modules.push(ModulePath(components));
82-
}
68+
let path = entry.path();
69+
if path.is_file() && path.extension() == Some(OsStr::new("nbt")) {
70+
if let Ok(relative_path) = path.strip_prefix(root_path) {
71+
let components: Vec<String> = relative_path
72+
.components()
73+
.map(|c| {
74+
c.as_os_str()
75+
.to_string_lossy()
76+
.trim_end_matches(".nbt")
77+
.to_string()
78+
})
79+
.collect();
80+
81+
modules.push(ModulePath(components));
8382
}
8483
}
8584
}

numbat/src/parser.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -1137,11 +1137,7 @@ impl<'a> Parser<'a> {
11371137
} else if let Some(inner) = self.match_any(&[TokenKind::True, TokenKind::False]) {
11381138
Ok(Expression::Boolean(
11391139
inner.span,
1140-
if matches!(inner.kind, TokenKind::True) {
1141-
true
1142-
} else {
1143-
false
1144-
},
1140+
matches!(inner.kind, TokenKind::True),
11451141
))
11461142
} else if let Some(token) = self.match_exact(TokenKind::StringFixed) {
11471143
Ok(Expression::String(

numbat/src/value.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl PrettyPrint for Value {
6363
Value::DateTime(dt, offset) => {
6464
let l: chrono::DateTime<chrono::FixedOffset> =
6565
chrono::DateTime::from_naive_utc_and_offset(dt.naive_utc(), *offset);
66-
crate::markup::string(format!("{}", l.to_rfc2822()))
66+
crate::markup::string(l.to_rfc2822())
6767
}
6868
}
6969
}

0 commit comments

Comments
 (0)