Skip to content

Commit f741578

Browse files
committed
fix: clippy warning of rust 1.84
1 parent 63fa6a6 commit f741578

File tree

16 files changed

+54
-56
lines changed

16 files changed

+54
-56
lines changed

crates/nu-color-config/src/style_computer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ impl<'a> StyleComputer<'a> {
169169

170170
// Because EngineState doesn't have Debug (Dec 2022),
171171
// this incomplete representation must be used.
172-
impl<'a> Debug for StyleComputer<'a> {
172+
impl Debug for StyleComputer<'_> {
173173
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
174174
f.debug_struct("StyleComputer")
175175
.field("map", &self.map)

crates/nu-engine/src/scope.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,14 +529,14 @@ impl<'e, 's> ScopeData<'e, 's> {
529529
}
530530

531531
fn extract_custom_completion_from_arg(engine_state: &EngineState, shape: &SyntaxShape) -> String {
532-
return match shape {
532+
match shape {
533533
SyntaxShape::CompleterWrapper(_, custom_completion_decl_id) => {
534534
let custom_completion_command = engine_state.get_decl(*custom_completion_decl_id);
535535
let custom_completion_command_name: &str = custom_completion_command.name();
536536
custom_completion_command_name.to_string()
537537
}
538538
_ => "".to_string(),
539-
};
539+
}
540540
}
541541

542542
fn sort_rows(decls: &mut [Value]) {

crates/nu-glob/src/lib.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,6 @@ pub fn glob_with(pattern: &str, options: MatchOptions) -> Result<Paths, PatternE
294294
/// This is provided primarily for testability, so multithreaded test runners can
295295
/// test pattern matches in different test directories at the same time without
296296
/// having to append the parent to the pattern under test.
297-
298297
pub fn glob_with_parent(
299298
pattern: &str,
300299
options: MatchOptions,
@@ -790,7 +789,7 @@ impl Pattern {
790789
/// `Pattern` using the default match options (i.e. `MatchOptions::default()`).
791790
pub fn matches_path(&self, path: &Path) -> bool {
792791
// FIXME (#9639): This needs to handle non-utf8 paths
793-
path.to_str().map_or(false, |s| self.matches(s))
792+
path.to_str().is_some_and(|s| self.matches(s))
794793
}
795794

796795
/// Return if the given `str` matches this `Pattern` using the specified
@@ -803,8 +802,7 @@ impl Pattern {
803802
/// `Pattern` using the specified match options.
804803
pub fn matches_path_with(&self, path: &Path, options: MatchOptions) -> bool {
805804
// FIXME (#9639): This needs to handle non-utf8 paths
806-
path.to_str()
807-
.map_or(false, |s| self.matches_with(s, options))
805+
path.to_str().is_some_and(|s| self.matches_with(s, options))
808806
}
809807

810808
/// Access the original glob pattern.
@@ -1069,7 +1067,7 @@ fn chars_eq(a: char, b: char, case_sensitive: bool) -> bool {
10691067
true
10701068
} else if !case_sensitive && a.is_ascii() && b.is_ascii() {
10711069
// FIXME: work with non-ascii chars properly (issue #9084)
1072-
a.to_ascii_lowercase() == b.to_ascii_lowercase()
1070+
a.eq_ignore_ascii_case(&b)
10731071
} else {
10741072
a == b
10751073
}

crates/nu-json/src/de.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ where
505505
}
506506
}
507507

508-
impl<'de, 'a, Iter> de::Deserializer<'de> for &'a mut Deserializer<Iter>
508+
impl<'de, Iter> de::Deserializer<'de> for &mut Deserializer<Iter>
509509
where
510510
Iter: Iterator<Item = u8>,
511511
{
@@ -565,7 +565,7 @@ impl<'a, Iter: Iterator<Item = u8>> SeqVisitor<'a, Iter> {
565565
}
566566
}
567567

568-
impl<'de, 'a, Iter> de::SeqAccess<'de> for SeqVisitor<'a, Iter>
568+
impl<'de, Iter> de::SeqAccess<'de> for SeqVisitor<'_, Iter>
569569
where
570570
Iter: Iterator<Item = u8>,
571571
{
@@ -616,7 +616,7 @@ impl<'a, Iter: Iterator<Item = u8>> MapVisitor<'a, Iter> {
616616
}
617617
}
618618

619-
impl<'de, 'a, Iter> de::MapAccess<'de> for MapVisitor<'a, Iter>
619+
impl<'de, Iter> de::MapAccess<'de> for MapVisitor<'_, Iter>
620620
where
621621
Iter: Iterator<Item = u8>,
622622
{
@@ -671,7 +671,7 @@ where
671671
}
672672
}
673673

674-
impl<'de, 'a, Iter> de::VariantAccess<'de> for &'a mut Deserializer<Iter>
674+
impl<'de, Iter> de::VariantAccess<'de> for &mut Deserializer<Iter>
675675
where
676676
Iter: Iterator<Item = u8>,
677677
{

crates/nu-json/src/ser.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ where
310310
}
311311
}
312312

313-
impl<'a, W, F> ser::SerializeSeq for Compound<'a, W, F>
313+
impl<W, F> ser::SerializeSeq for Compound<'_, W, F>
314314
where
315315
W: io::Write,
316316
F: Formatter,
@@ -337,7 +337,7 @@ where
337337
}
338338
}
339339

340-
impl<'a, W, F> ser::SerializeTuple for Compound<'a, W, F>
340+
impl<W, F> ser::SerializeTuple for Compound<'_, W, F>
341341
where
342342
W: io::Write,
343343
F: Formatter,
@@ -357,7 +357,7 @@ where
357357
}
358358
}
359359

360-
impl<'a, W, F> ser::SerializeTupleStruct for Compound<'a, W, F>
360+
impl<W, F> ser::SerializeTupleStruct for Compound<'_, W, F>
361361
where
362362
W: io::Write,
363363
F: Formatter,
@@ -377,7 +377,7 @@ where
377377
}
378378
}
379379

380-
impl<'a, W, F> ser::SerializeTupleVariant for Compound<'a, W, F>
380+
impl<W, F> ser::SerializeTupleVariant for Compound<'_, W, F>
381381
where
382382
W: io::Write,
383383
F: Formatter,
@@ -401,7 +401,7 @@ where
401401
}
402402
}
403403

404-
impl<'a, W, F> ser::SerializeMap for Compound<'a, W, F>
404+
impl<W, F> ser::SerializeMap for Compound<'_, W, F>
405405
where
406406
W: io::Write,
407407
F: Formatter,
@@ -438,7 +438,7 @@ where
438438
}
439439
}
440440

441-
impl<'a, W, F> ser::SerializeStruct for Compound<'a, W, F>
441+
impl<W, F> ser::SerializeStruct for Compound<'_, W, F>
442442
where
443443
W: io::Write,
444444
F: Formatter,
@@ -458,7 +458,7 @@ where
458458
}
459459
}
460460

461-
impl<'a, W, F> ser::SerializeStructVariant for Compound<'a, W, F>
461+
impl<W, F> ser::SerializeStructVariant for Compound<'_, W, F>
462462
where
463463
W: io::Write,
464464
F: Formatter,
@@ -486,7 +486,7 @@ struct MapKeySerializer<'a, W: 'a, F: 'a> {
486486
ser: &'a mut Serializer<W, F>,
487487
}
488488

489-
impl<'a, W, F> ser::Serializer for MapKeySerializer<'a, W, F>
489+
impl<W, F> ser::Serializer for MapKeySerializer<'_, W, F>
490490
where
491491
W: io::Write,
492492
F: Formatter,
@@ -694,7 +694,7 @@ struct HjsonFormatter<'a> {
694694
braces_same_line: bool,
695695
}
696696

697-
impl<'a> Default for HjsonFormatter<'a> {
697+
impl Default for HjsonFormatter<'_> {
698698
fn default() -> Self {
699699
Self::new()
700700
}
@@ -719,7 +719,7 @@ impl<'a> HjsonFormatter<'a> {
719719
}
720720
}
721721

722-
impl<'a> Formatter for HjsonFormatter<'a> {
722+
impl Formatter for HjsonFormatter<'_> {
723723
fn open<W>(&mut self, writer: &mut W, ch: u8) -> Result<()>
724724
where
725725
W: io::Write,

crates/nu-json/src/value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ struct WriterFormatter<'a, 'b: 'a> {
432432
inner: &'a mut fmt::Formatter<'b>,
433433
}
434434

435-
impl<'a, 'b> io::Write for WriterFormatter<'a, 'b> {
435+
impl io::Write for WriterFormatter<'_, '_> {
436436
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
437437
fn io_error<E>(_: E) -> io::Error {
438438
// Value does not matter because fmt::Debug and fmt::Display impls

crates/nu-path/src/tilde.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ fn is_termux() -> bool {
126126
}
127127

128128
fn expand_tilde_with_another_user_home(path: &Path) -> PathBuf {
129-
return match path.to_str() {
129+
match path.to_str() {
130130
Some(file_path) => {
131131
let mut file = file_path.to_string();
132132
match file_path.find(['/', '\\']) {
@@ -147,7 +147,7 @@ fn expand_tilde_with_another_user_home(path: &Path) -> PathBuf {
147147
}
148148
}
149149
None => path.to_path_buf(),
150-
};
150+
}
151151
}
152152

153153
/// Expand tilde ("~") into a home directory if it is the first path component

crates/nu-protocol/src/engine/engine_state.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ impl EngineState {
354354
pub fn active_overlay_ids<'a, 'b>(
355355
&'b self,
356356
removed_overlays: &'a [Vec<u8>],
357-
) -> impl DoubleEndedIterator<Item = &OverlayId> + 'a
357+
) -> impl DoubleEndedIterator<Item = &'b OverlayId> + 'a
358358
where
359359
'b: 'a,
360360
{
@@ -368,7 +368,7 @@ impl EngineState {
368368
pub fn active_overlays<'a, 'b>(
369369
&'b self,
370370
removed_overlays: &'a [Vec<u8>],
371-
) -> impl DoubleEndedIterator<Item = &OverlayFrame> + 'a
371+
) -> impl DoubleEndedIterator<Item = &'b OverlayFrame> + 'a
372372
where
373373
'b: 'a,
374374
{
@@ -379,7 +379,7 @@ impl EngineState {
379379
pub fn active_overlay_names<'a, 'b>(
380380
&'b self,
381381
removed_overlays: &'a [Vec<u8>],
382-
) -> impl DoubleEndedIterator<Item = &[u8]> + 'a
382+
) -> impl DoubleEndedIterator<Item = &'b [u8]> + 'a
383383
where
384384
'b: 'a,
385385
{
@@ -1061,7 +1061,7 @@ impl EngineState {
10611061
}
10621062
}
10631063

1064-
impl<'a> GetSpan for &'a EngineState {
1064+
impl GetSpan for &EngineState {
10651065
/// Get existing span
10661066
fn get_span(&self, span_id: SpanId) -> Span {
10671067
*self

crates/nu-protocol/src/engine/overlay.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ impl ScopeFrame {
120120
pub fn active_overlays<'a, 'b>(
121121
&'b self,
122122
removed_overlays: &'a mut Vec<Vec<u8>>,
123-
) -> impl DoubleEndedIterator<Item = &OverlayFrame> + 'a
123+
) -> impl DoubleEndedIterator<Item = &'b OverlayFrame> + 'a
124124
where
125125
'b: 'a,
126126
{

crates/nu-protocol/src/engine/stack_out_dest.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,15 @@ impl<'a> StackIoGuard<'a> {
153153
}
154154
}
155155

156-
impl<'a> Deref for StackIoGuard<'a> {
156+
impl Deref for StackIoGuard<'_> {
157157
type Target = Stack;
158158

159159
fn deref(&self) -> &Self::Target {
160160
self.stack
161161
}
162162
}
163163

164-
impl<'a> DerefMut for StackIoGuard<'a> {
164+
impl DerefMut for StackIoGuard<'_> {
165165
fn deref_mut(&mut self) -> &mut Self::Target {
166166
self.stack
167167
}
@@ -202,15 +202,15 @@ impl<'a> StackCollectValueGuard<'a> {
202202
}
203203
}
204204

205-
impl<'a> Deref for StackCollectValueGuard<'a> {
205+
impl Deref for StackCollectValueGuard<'_> {
206206
type Target = Stack;
207207

208208
fn deref(&self) -> &Self::Target {
209209
&*self.stack
210210
}
211211
}
212212

213-
impl<'a> DerefMut for StackCollectValueGuard<'a> {
213+
impl DerefMut for StackCollectValueGuard<'_> {
214214
fn deref_mut(&mut self) -> &mut Self::Target {
215215
self.stack
216216
}
@@ -258,15 +258,15 @@ impl<'a> StackCallArgGuard<'a> {
258258
}
259259
}
260260

261-
impl<'a> Deref for StackCallArgGuard<'a> {
261+
impl Deref for StackCallArgGuard<'_> {
262262
type Target = Stack;
263263

264264
fn deref(&self) -> &Self::Target {
265265
&*self.stack
266266
}
267267
}
268268

269-
impl<'a> DerefMut for StackCallArgGuard<'a> {
269+
impl DerefMut for StackCallArgGuard<'_> {
270270
fn deref_mut(&mut self) -> &mut Self::Target {
271271
self.stack
272272
}

0 commit comments

Comments
 (0)