Skip to content

Commit 38f570f

Browse files
committed
Resolve 'hiding a lifetime' warnings from Rust 1.89
1 parent 873b75c commit 38f570f

10 files changed

Lines changed: 25 additions & 25 deletions

File tree

crates/dm-langserver/src/debugger/extools.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ impl Extools {
197197
(extools, thread)
198198
}
199199

200-
pub fn get_all_threads(&self) -> std::sync::MutexGuard<HashMap<i64, ThreadInfo>> {
200+
pub fn get_all_threads(&self) -> std::sync::MutexGuard<'_, HashMap<i64, ThreadInfo>> {
201201
self.threads.lock().unwrap()
202202
}
203203

crates/dm-langserver/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ impl Engine {
683683
})
684684
}
685685

686-
fn find_type_context<'b, I, Ign>(&self, iter: &I) -> (Option<TypeRef>, Option<(&'b str, usize)>)
686+
fn find_type_context<'b, I, Ign>(&self, iter: &I) -> (Option<TypeRef<'_>>, Option<(&'b str, usize)>)
687687
where
688688
I: Iterator<Item = (Ign, &'b Annotation)> + Clone,
689689
{

crates/dmm-tools/src/dmm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ impl Map {
218218
}
219219

220220
#[inline]
221-
pub fn z_level(&self, z: usize) -> ZLevel {
221+
pub fn z_level(&self, z: usize) -> ZLevel<'_> {
222222
ZLevel { grid: self.grid.index_axis(Axis(0), z) }
223223
}
224224

crates/dreamchecker/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ impl<'o> AssumptionSet<'o> {
175175
assumption_set![Assumption::Truthy(true), Assumption::IsNull(false), Assumption::IsType(true, ty)]
176176
}
177177

178-
fn conflicts_with(&self, new: &Assumption) -> Option<&Assumption> {
178+
fn conflicts_with(&self, new: &Assumption) -> Option<&Assumption<'_>> {
179179
self.set.iter().find(|&each| each.oneway_conflict(new) || new.oneway_conflict(each))
180180
}
181181
}
@@ -1455,7 +1455,7 @@ impl<'o, 's> AnalyzeProc<'o, 's> {
14551455
}
14561456
}
14571457
StaticType::Proc => {
1458-
error(location, format!("iterating over a procpath which cannot be iterated"))
1458+
error(location, "iterating over a procpath which cannot be iterated".to_string())
14591459
.register(self.context);
14601460
}
14611461
}
@@ -1613,7 +1613,7 @@ impl<'o, 's> AnalyzeProc<'o, 's> {
16131613
}
16141614
}
16151615
StaticType::Proc => {
1616-
error(location, format!("iterating over a procpath which cannot be iterated"))
1616+
error(location, "iterating over a procpath which cannot be iterated".to_string())
16171617
.register(self.context);
16181618
}
16191619
}

crates/dreammaker/src/annotation.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,19 @@ impl AnnotationTree {
8585
self.len == 0
8686
}
8787

88-
pub fn iter(&self) -> Iter {
88+
pub fn iter(&self) -> Iter<'_> {
8989
self.tree.iter()
9090
}
9191

92-
pub fn get_location(&self, loc: Location) -> Iter {
92+
pub fn get_location(&self, loc: Location) -> Iter<'_> {
9393
self.tree.range(range(loc.pred(), loc))
9494
}
9595

96-
pub fn get_range(&self, place: std::ops::Range<Location>) -> Iter {
96+
pub fn get_range(&self, place: std::ops::Range<Location>) -> Iter<'_> {
9797
self.tree.range(range(place.start, place.end.pred()))
9898
}
9999

100-
pub fn get_range_raw(&self, place: RangeInclusive<Location>) -> Iter {
100+
pub fn get_range_raw(&self, place: RangeInclusive<Location>) -> Iter<'_> {
101101
self.tree.range(place)
102102
}
103103
}

crates/dreammaker/src/error.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl FileList {
7373
}
7474

7575
/// Look up a file path by its index returned from `register_file`.
76-
pub fn get_path(&self, file: FileId) -> Ref<Path> {
76+
pub fn get_path(&self, file: FileId) -> Ref<'_, Path> {
7777
let files = self.files.borrow();
7878
if file == FILEID_BUILTINS {
7979
return Ref::map(files, |_| Path::new("(builtins)"));
@@ -108,7 +108,7 @@ impl Context {
108108
}
109109

110110
/// Look up a file path by its index returned from `register_file`.
111-
pub fn file_path(&self, file: FileId) -> Ref<Path> {
111+
pub fn file_path(&self, file: FileId) -> Ref<'_, Path> {
112112
self.files.get_path(file)
113113
}
114114

@@ -191,13 +191,13 @@ impl Context {
191191
}
192192

193193
/// Access the list of diagnostics generated so far.
194-
pub fn errors(&self) -> Ref<[DMError]> {
194+
pub fn errors(&self) -> Ref<'_, [DMError]> {
195195
Ref::map(self.errors.borrow(), |x| &**x)
196196
}
197197

198198
/// Mutably access the diagnostics list. Dangerous.
199199
#[doc(hidden)]
200-
pub fn errors_mut(&self) -> RefMut<Vec<DMError>> {
200+
pub fn errors_mut(&self) -> RefMut<'_, Vec<DMError>> {
201201
self.errors.borrow_mut()
202202
}
203203

crates/dreammaker/src/lexer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ pub fn from_utf8_or_latin1(bytes: Vec<u8>) -> String {
473473
}
474474

475475
/// Convert the input bytes to a `String` attempting UTF-8 or falling back to Latin-1.
476-
pub fn from_utf8_or_latin1_borrowed(bytes: &[u8]) -> Cow<str> {
476+
pub fn from_utf8_or_latin1_borrowed(bytes: &[u8]) -> Cow<'_, str> {
477477
match std::str::from_utf8(bytes) {
478478
Ok(v) => Cow::Borrowed(v),
479479
Err(_) => Cow::Owned(from_latin1(bytes)),

crates/dreammaker/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ pub fn pretty_print<W, I>(w: &mut W, input: I, show_ws: bool) -> std::fmt::Resul
123123
/// On Windows, this is a no-op.
124124
#[cfg(windows)]
125125
#[inline(always)]
126-
pub fn fix_case(path: &Path) -> Cow<Path> {
126+
pub fn fix_case(path: &Path) -> Cow<'_, Path> {
127127
Cow::Borrowed(path)
128128
}
129129

@@ -132,7 +132,7 @@ pub fn fix_case(path: &Path) -> Cow<Path> {
132132
/// On non-Windows platforms, the parent of the given path is searched for a
133133
/// file with the same name but a different case.
134134
#[cfg(not(windows))]
135-
pub fn fix_case(path: &Path) -> Cow<Path> {
135+
pub fn fix_case(path: &Path) -> Cow<'_, Path> {
136136
if path.exists() {
137137
return Cow::Borrowed(path);
138138
}

crates/dreammaker/src/objtree.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -673,18 +673,18 @@ impl ObjectTree {
673673
self.node_indices().map(move |idx| TypeRef::new(self, idx))
674674
}
675675

676-
pub fn root(&self) -> TypeRef {
676+
pub fn root(&self) -> TypeRef<'_> {
677677
TypeRef::new(self, NodeIndex::new(0))
678678
}
679679

680-
pub fn find(&self, path: &str) -> Option<TypeRef> {
680+
pub fn find(&self, path: &str) -> Option<TypeRef<'_>> {
681681
if path.is_empty() {
682682
return Some(self.root());
683683
}
684684
self.types.get(path).map(|&ix| TypeRef::new(self, ix))
685685
}
686686

687-
pub fn expect(&self, path: &str) -> TypeRef {
687+
pub fn expect(&self, path: &str) -> TypeRef<'_> {
688688
match self.types.get(path) {
689689
Some(&ix) => TypeRef::new(self, ix),
690690
None => panic!("type not found: {path:?}"),
@@ -695,7 +695,7 @@ impl ObjectTree {
695695
self.graph.get(type_.parent_type.index())
696696
}
697697

698-
pub fn type_by_path<I>(&self, path: I) -> Option<TypeRef>
698+
pub fn type_by_path<I>(&self, path: I) -> Option<TypeRef<'_>>
699699
where
700700
I: IntoIterator,
701701
I::Item: AsRef<str>,
@@ -708,7 +708,7 @@ impl ObjectTree {
708708
}
709709
}
710710

711-
pub fn type_by_path_approx<I>(&self, path: I) -> (bool, TypeRef)
711+
pub fn type_by_path_approx<I>(&self, path: I) -> (bool, TypeRef<'_>)
712712
where
713713
I: IntoIterator,
714714
I::Item: AsRef<str>,
@@ -732,7 +732,7 @@ impl ObjectTree {
732732
(true, TypeRef::new(self, current))
733733
}
734734

735-
pub fn type_by_constant(&self, constant: &Constant) -> Option<TypeRef> {
735+
pub fn type_by_constant(&self, constant: &Constant) -> Option<TypeRef<'_>> {
736736
match constant {
737737
Constant::String(string_path) => self.find(string_path),
738738
Constant::Prefab(pop) => self.type_by_path(pop.path.iter()),

crates/interval-tree/src/tree.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ impl<K: Ord, V> IntervalTree<K, V> {
214214
/// }
215215
///
216216
/// ```
217-
pub fn range(&self, range: RangeInclusive<K>) -> RangePairIter<K, V> {
217+
pub fn range(&self, range: RangeInclusive<K>) -> RangePairIter<'_, K, V> {
218218
RangePairIter::new(
219219
self,
220220
Bound::Included(range.start),
@@ -231,7 +231,7 @@ impl<K: Ord, V> IntervalTree<K, V> {
231231
/// }
232232
///
233233
/// ```
234-
pub fn iter(&self) -> RangePairIter<K, V> {
234+
pub fn iter(&self) -> RangePairIter<'_, K, V> {
235235
RangePairIter::new(self, Bound::Unbounded, Bound::Unbounded)
236236
}
237237
}

0 commit comments

Comments
 (0)