Skip to content

Commit 3b58dc3

Browse files
author
Naseschwarz
committed
Disable clippy::missing_const_for_fn if impossible
1 parent 4f3727d commit 3b58dc3

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

Diff for: src/components/commitlist.rs

+3
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ impl CommitList {
114114
self.marked.len()
115115
}
116116

117+
// Clippy wants this to be const in nightly, which is not possible.
118+
// Disable check to make clippy pass:
119+
#[allow(clippy::missing_const_for_fn)]
117120
///
118121
pub fn marked(&self) -> &[(usize, CommitId)] {
119122
&self.marked

Diff for: src/keys/key_config.rs

+10
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ impl KeyConfig {
4040
Ok(Self { keys, symbols })
4141
}
4242

43+
// Clippy wants this to be const in nightly
44+
// This can't really be const, as deref into &str is not const, even
45+
// in nightly.
46+
// Disable clippy warning to build on nightly.
47+
#[allow(clippy::missing_const_for_fn)]
4348
fn get_key_symbol(&self, k: KeyCode) -> &str {
4449
match k {
4550
KeyCode::Enter => &self.symbols.enter,
@@ -106,6 +111,11 @@ impl KeyConfig {
106111
}
107112
}
108113

114+
// Clippy wants this to be const in nightly
115+
// This can't really be const, as deref into &str is not const, even
116+
// in nightly.
117+
// Disable clippy warning to build on nightly.
118+
#[allow(clippy::missing_const_for_fn)]
109119
fn get_modifier_hint(&self, modifier: KeyModifiers) -> &str {
110120
match modifier {
111121
KeyModifiers::CONTROL => &self.symbols.control,

Diff for: src/popups/blame_file.rs

+4
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ struct SyntaxFileBlame {
4141
}
4242

4343
impl SyntaxFileBlame {
44+
// Clippy wants this to be const in nightly.
45+
// This can't really be const, as deref into Path is not const.
46+
// Disable clippy warning to build on nightly.
47+
#[allow(clippy::missing_const_for_fn)]
4448
fn path(&self) -> &str {
4549
&self.file_blame.path
4650
}

Diff for: src/ui/syntax_text.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,13 @@ impl SyntaxText {
167167
})
168168
}
169169

170+
// Clippy wants this to be const in nightly.
171+
// This can't really be const, as deref into Path is not const.
172+
// Disable clippy warning to build on nightly.
173+
#[allow(clippy::missing_const_for_fn)]
170174
///
171175
pub fn path(&self) -> &Path {
172-
&self.path
176+
self.path.as_path()
173177
}
174178
}
175179

0 commit comments

Comments
 (0)