Skip to content

Commit 5850d16

Browse files
committed
Remove unnecessary explicit lifetime bounds.
These explicit lifetimes can be ommitted because of lifetime elision rules. Instances were found using rust-clippy.
1 parent 4d3eebf commit 5850d16

File tree

10 files changed

+41
-41
lines changed

10 files changed

+41
-41
lines changed

src/librustc_data_structures/graph/mod.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ impl<N:Debug,E:Debug> Graph<N,E> {
115115
// Simple accessors
116116

117117
#[inline]
118-
pub fn all_nodes<'a>(&'a self) -> &'a [Node<N>] {
118+
pub fn all_nodes(&self) -> &[Node<N>] {
119119
&self.nodes
120120
}
121121

@@ -125,7 +125,7 @@ impl<N:Debug,E:Debug> Graph<N,E> {
125125
}
126126

127127
#[inline]
128-
pub fn all_edges<'a>(&'a self) -> &'a [Edge<E>] {
128+
pub fn all_edges(&self) -> &[Edge<E>] {
129129
&self.edges
130130
}
131131

@@ -150,15 +150,15 @@ impl<N:Debug,E:Debug> Graph<N,E> {
150150
idx
151151
}
152152

153-
pub fn mut_node_data<'a>(&'a mut self, idx: NodeIndex) -> &'a mut N {
153+
pub fn mut_node_data(&mut self, idx: NodeIndex) -> &mut N {
154154
&mut self.nodes[idx.0].data
155155
}
156156

157-
pub fn node_data<'a>(&'a self, idx: NodeIndex) -> &'a N {
157+
pub fn node_data(&self, idx: NodeIndex) -> &N {
158158
&self.nodes[idx.0].data
159159
}
160160

161-
pub fn node<'a>(&'a self, idx: NodeIndex) -> &'a Node<N> {
161+
pub fn node(&self, idx: NodeIndex) -> &Node<N> {
162162
&self.nodes[idx.0]
163163
}
164164

@@ -199,15 +199,15 @@ impl<N:Debug,E:Debug> Graph<N,E> {
199199
return idx;
200200
}
201201

202-
pub fn mut_edge_data<'a>(&'a mut self, idx: EdgeIndex) -> &'a mut E {
202+
pub fn mut_edge_data(&mut self, idx: EdgeIndex) -> &mut E {
203203
&mut self.edges[idx.0].data
204204
}
205205

206-
pub fn edge_data<'a>(&'a self, idx: EdgeIndex) -> &'a E {
206+
pub fn edge_data(&self, idx: EdgeIndex) -> &E {
207207
&self.edges[idx.0].data
208208
}
209209

210-
pub fn edge<'a>(&'a self, idx: EdgeIndex) -> &'a Edge<E> {
210+
pub fn edge(&self, idx: EdgeIndex) -> &Edge<E> {
211211
&self.edges[idx.0]
212212
}
213213

@@ -257,11 +257,11 @@ impl<N:Debug,E:Debug> Graph<N,E> {
257257
AdjacentEdges { graph: self, direction: direction, next: first_edge }
258258
}
259259

260-
pub fn successor_nodes<'a>(&'a self, source: NodeIndex) -> AdjacentTargets<N,E> {
260+
pub fn successor_nodes(&self, source: NodeIndex) -> AdjacentTargets<N,E> {
261261
self.outgoing_edges(source).targets()
262262
}
263263

264-
pub fn predecessor_nodes<'a>(&'a self, target: NodeIndex) -> AdjacentSources<N,E> {
264+
pub fn predecessor_nodes(&self, target: NodeIndex) -> AdjacentSources<N,E> {
265265
self.incoming_edges(target).sources()
266266
}
267267

src/librustc_data_structures/snapshot_vec.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ impl<D:SnapshotVecDelegate> SnapshotVec<D> {
9191
len
9292
}
9393

94-
pub fn get<'a>(&'a self, index: usize) -> &'a D::Value {
94+
pub fn get(&self, index: usize) -> &D::Value {
9595
&self.values[index]
9696
}
9797

9898
/// Returns a mutable pointer into the vec; whatever changes you make here cannot be undone
9999
/// automatically, so you should be sure call `record()` with some sort of suitable undo
100100
/// action.
101-
pub fn get_mut<'a>(&'a mut self, index: usize) -> &'a mut D::Value {
101+
pub fn get_mut(&mut self, index: usize) -> &mut D::Value {
102102
&mut self.values[index]
103103
}
104104

src/librustc_llvm/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,12 @@ impl AttrBuilder {
261261
}
262262
}
263263

264-
pub fn arg<'a, T: AttrHelper + 'static>(&'a mut self, idx: usize, a: T) -> &'a mut AttrBuilder {
264+
pub fn arg<T: AttrHelper + 'static>(&mut self, idx: usize, a: T) -> &mut AttrBuilder {
265265
self.attrs.push((idx, box a as Box<AttrHelper+'static>));
266266
self
267267
}
268268

269-
pub fn ret<'a, T: AttrHelper + 'static>(&'a mut self, a: T) -> &'a mut AttrBuilder {
269+
pub fn ret<T: AttrHelper + 'static>(&mut self, a: T) -> &mut AttrBuilder {
270270
self.attrs.push((ReturnIndex as usize, box a as Box<AttrHelper+'static>));
271271
self
272272
}

src/librustc_resolve/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
12891289
span: Span,
12901290
lp: LastPrivate)
12911291
-> ResolveResult<(Module<'a>, LastPrivate)> {
1292-
fn search_parent_externals<'a>(needle: Name, module: Module<'a>) -> Option<Module<'a>> {
1292+
fn search_parent_externals(needle: Name, module: Module) -> Option<Module> {
12931293
match module.resolve_name(needle, TypeNS, false) {
12941294
Success(binding) if binding.is_extern_crate() => Some(module),
12951295
_ => match module.parent_link {
@@ -3513,10 +3513,10 @@ fn path_names_to_string(path: &Path, depth: usize) -> String {
35133513
}
35143514

35153515
/// A somewhat inefficient routine to obtain the name of a module.
3516-
fn module_to_string<'a>(module: Module<'a>) -> String {
3516+
fn module_to_string(module: Module) -> String {
35173517
let mut names = Vec::new();
35183518

3519-
fn collect_mod<'a>(names: &mut Vec<ast::Name>, module: Module<'a>) {
3519+
fn collect_mod(names: &mut Vec<ast::Name>, module: Module) {
35203520
match module.parent_link {
35213521
NoParentLink => {}
35223522
ModuleParentLink(ref module, name) => {

src/librustc_unicode/u_str.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ pub trait UnicodeStr {
3030
fn split_whitespace<'a>(&'a self) -> SplitWhitespace<'a>;
3131
fn is_whitespace(&self) -> bool;
3232
fn is_alphanumeric(&self) -> bool;
33-
fn trim<'a>(&'a self) -> &'a str;
34-
fn trim_left<'a>(&'a self) -> &'a str;
35-
fn trim_right<'a>(&'a self) -> &'a str;
33+
fn trim(&self) -> &str;
34+
fn trim_left(&self) -> &str;
35+
fn trim_right(&self) -> &str;
3636
}
3737

3838
impl UnicodeStr for str {

src/libserialize/json.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,7 @@ impl<'a> Index<&'a str> for Json {
12271227
impl Index<usize> for Json {
12281228
type Output = Json;
12291229

1230-
fn index<'a>(&'a self, idx: usize) -> &'a Json {
1230+
fn index(&self, idx: usize) -> &Json {
12311231
match *self {
12321232
Json::Array(ref v) => &v[idx],
12331233
_ => panic!("can only index Json with usize if it is an array")
@@ -1309,7 +1309,7 @@ impl Stack {
13091309
/// Provides access to the StackElement at a given index.
13101310
/// lower indices are at the bottom of the stack while higher indices are
13111311
/// at the top.
1312-
pub fn get<'l>(&'l self, idx: usize) -> StackElement<'l> {
1312+
pub fn get(&self, idx: usize) -> StackElement {
13131313
match self.stack[idx] {
13141314
InternalIndex(i) => StackElement::Index(i),
13151315
InternalKey(start, size) => {
@@ -1351,7 +1351,7 @@ impl Stack {
13511351
}
13521352

13531353
/// Returns the top-most element (if any).
1354-
pub fn top<'l>(&'l self) -> Option<StackElement<'l>> {
1354+
pub fn top(&self) -> Option<StackElement> {
13551355
match self.stack.last() {
13561356
None => None,
13571357
Some(&InternalIndex(i)) => Some(StackElement::Index(i)),
@@ -1463,7 +1463,7 @@ impl<T: Iterator<Item=char>> Parser<T> {
14631463

14641464
/// Provides access to the current position in the logical structure of the
14651465
/// JSON stream.
1466-
pub fn stack<'l>(&'l self) -> &'l Stack {
1466+
pub fn stack(&self) -> &Stack {
14671467
&self.stack
14681468
}
14691469

src/libstd/sync/mpsc/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -403,10 +403,10 @@ enum Flavor<T> {
403403
#[doc(hidden)]
404404
trait UnsafeFlavor<T> {
405405
fn inner_unsafe(&self) -> &UnsafeCell<Flavor<T>>;
406-
unsafe fn inner_mut<'a>(&'a self) -> &'a mut Flavor<T> {
406+
unsafe fn inner_mut(&self) -> &mut Flavor<T> {
407407
&mut *self.inner_unsafe().get()
408408
}
409-
unsafe fn inner<'a>(&'a self) -> &'a Flavor<T> {
409+
unsafe fn inner(&self) -> &Flavor<T> {
410410
&*self.inner_unsafe().get()
411411
}
412412
}

src/libsyntax/ext/tt/transcribe.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ pub struct TtReader<'a> {
5555
/// This can do Macro-By-Example transcription. On the other hand, if
5656
/// `src` contains no `TokenTree::Sequence`s, `MatchNt`s or `SubstNt`s, `interp` can
5757
/// (and should) be None.
58-
pub fn new_tt_reader<'a>(sp_diag: &'a Handler,
59-
interp: Option<HashMap<Name, Rc<NamedMatch>>>,
60-
imported_from: Option<Ident>,
61-
src: Vec<ast::TokenTree>)
62-
-> TtReader<'a> {
58+
pub fn new_tt_reader(sp_diag: &Handler,
59+
interp: Option<HashMap<Name, Rc<NamedMatch>>>,
60+
imported_from: Option<Ident>,
61+
src: Vec<ast::TokenTree>)
62+
-> TtReader {
6363
new_tt_reader_with_doc_flag(sp_diag, interp, imported_from, src, false)
6464
}
6565

@@ -69,12 +69,12 @@ pub fn new_tt_reader<'a>(sp_diag: &'a Handler,
6969
/// This can do Macro-By-Example transcription. On the other hand, if
7070
/// `src` contains no `TokenTree::Sequence`s, `MatchNt`s or `SubstNt`s, `interp` can
7171
/// (and should) be None.
72-
pub fn new_tt_reader_with_doc_flag<'a>(sp_diag: &'a Handler,
73-
interp: Option<HashMap<Name, Rc<NamedMatch>>>,
74-
imported_from: Option<Ident>,
75-
src: Vec<ast::TokenTree>,
76-
desugar_doc_comments: bool)
77-
-> TtReader<'a> {
72+
pub fn new_tt_reader_with_doc_flag(sp_diag: &Handler,
73+
interp: Option<HashMap<Name, Rc<NamedMatch>>>,
74+
imported_from: Option<Ident>,
75+
src: Vec<ast::TokenTree>,
76+
desugar_doc_comments: bool)
77+
-> TtReader {
7878
let mut r = TtReader {
7979
sp_diag: sp_diag,
8080
stack: vec!(TtFrame {

src/libterm/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,10 @@ pub trait Terminal: Write {
211211
fn reset(&mut self) -> io::Result<bool>;
212212

213213
/// Gets an immutable reference to the stream inside
214-
fn get_ref<'a>(&'a self) -> &'a Self::Output;
214+
fn get_ref(&self) -> &Self::Output;
215215

216216
/// Gets a mutable reference to the stream inside
217-
fn get_mut<'a>(&'a mut self) -> &'a mut Self::Output;
217+
fn get_mut(&mut self) -> &mut Self::Output;
218218

219219
/// Returns the contained stream, destroying the `Terminal`
220220
fn into_inner(self) -> Self::Output where Self: Sized;

src/libterm/terminfo/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,11 @@ impl<T: Write + Send> Terminal for TerminfoTerminal<T> {
205205
self.out.write_all(&cmd).and(Ok(true))
206206
}
207207

208-
fn get_ref<'a>(&'a self) -> &'a T {
208+
fn get_ref(&self) -> &T {
209209
&self.out
210210
}
211211

212-
fn get_mut<'a>(&'a mut self) -> &'a mut T {
212+
fn get_mut(&mut self) -> &mut T {
213213
&mut self.out
214214
}
215215

0 commit comments

Comments
 (0)