]> git.lizzy.rs Git - rust.git/commitdiff
Remove unnecessary explicit lifetime bounds.
authorCorey Farwell <coreyf@rwell.org>
Thu, 18 Feb 2016 01:20:41 +0000 (20:20 -0500)
committerCorey Farwell <coreyf@rwell.org>
Thu, 18 Feb 2016 13:37:10 +0000 (08:37 -0500)
These explicit lifetimes can be ommitted because of lifetime elision
rules. Instances were found using rust-clippy.

src/librustc_data_structures/graph/mod.rs
src/librustc_data_structures/snapshot_vec.rs
src/librustc_llvm/lib.rs
src/librustc_resolve/lib.rs
src/librustc_unicode/u_str.rs
src/libserialize/json.rs
src/libstd/sync/mpsc/mod.rs
src/libsyntax/ext/tt/transcribe.rs
src/libterm/lib.rs
src/libterm/terminfo/mod.rs

index 1ea09490aed2f4d05d99f64d555e68db2e45de2f..f11856d751391ef1edba3830b1872257e4a9ff21 100644 (file)
@@ -115,7 +115,7 @@ pub fn new() -> Graph<N,E> {
     // Simple accessors
 
     #[inline]
-    pub fn all_nodes<'a>(&'a self) -> &'a [Node<N>] {
+    pub fn all_nodes(&self) -> &[Node<N>] {
         &self.nodes
     }
 
@@ -125,7 +125,7 @@ pub fn len_nodes(&self) -> usize {
     }
 
     #[inline]
-    pub fn all_edges<'a>(&'a self) -> &'a [Edge<E>] {
+    pub fn all_edges(&self) -> &[Edge<E>] {
         &self.edges
     }
 
@@ -150,15 +150,15 @@ pub fn add_node(&mut self, data: N) -> NodeIndex {
         idx
     }
 
-    pub fn mut_node_data<'a>(&'a mut self, idx: NodeIndex) -> &'a mut N {
+    pub fn mut_node_data(&mut self, idx: NodeIndex) -> &mut N {
         &mut self.nodes[idx.0].data
     }
 
-    pub fn node_data<'a>(&'a self, idx: NodeIndex) -> &'a N {
+    pub fn node_data(&self, idx: NodeIndex) -> &N {
         &self.nodes[idx.0].data
     }
 
-    pub fn node<'a>(&'a self, idx: NodeIndex) -> &'a Node<N> {
+    pub fn node(&self, idx: NodeIndex) -> &Node<N> {
         &self.nodes[idx.0]
     }
 
@@ -199,15 +199,15 @@ pub fn add_edge(&mut self,
         return idx;
     }
 
-    pub fn mut_edge_data<'a>(&'a mut self, idx: EdgeIndex) -> &'a mut E {
+    pub fn mut_edge_data(&mut self, idx: EdgeIndex) -> &mut E {
         &mut self.edges[idx.0].data
     }
 
-    pub fn edge_data<'a>(&'a self, idx: EdgeIndex) -> &'a E {
+    pub fn edge_data(&self, idx: EdgeIndex) -> &E {
         &self.edges[idx.0].data
     }
 
-    pub fn edge<'a>(&'a self, idx: EdgeIndex) -> &'a Edge<E> {
+    pub fn edge(&self, idx: EdgeIndex) -> &Edge<E> {
         &self.edges[idx.0]
     }
 
@@ -257,11 +257,11 @@ pub fn adjacent_edges(&self, source: NodeIndex, direction: Direction) -> Adjacen
         AdjacentEdges { graph: self, direction: direction, next: first_edge }
     }
 
-    pub fn successor_nodes<'a>(&'a self, source: NodeIndex) -> AdjacentTargets<N,E> {
+    pub fn successor_nodes(&self, source: NodeIndex) -> AdjacentTargets<N,E> {
         self.outgoing_edges(source).targets()
     }
 
-    pub fn predecessor_nodes<'a>(&'a self, target: NodeIndex) -> AdjacentSources<N,E> {
+    pub fn predecessor_nodes(&self, target: NodeIndex) -> AdjacentSources<N,E> {
         self.incoming_edges(target).sources()
     }
 
index 5ab740f3629aa80238424aef0db1c173d3e23655..5f89856afdbe33507cb5abb66ffb418dfd0eaf81 100644 (file)
@@ -91,14 +91,14 @@ pub fn push(&mut self, elem: D::Value) -> usize {
         len
     }
 
-    pub fn get<'a>(&'a self, index: usize) -> &'a D::Value {
+    pub fn get(&self, index: usize) -> &D::Value {
         &self.values[index]
     }
 
     /// Returns a mutable pointer into the vec; whatever changes you make here cannot be undone
     /// automatically, so you should be sure call `record()` with some sort of suitable undo
     /// action.
-    pub fn get_mut<'a>(&'a mut self, index: usize) -> &'a mut D::Value {
+    pub fn get_mut(&mut self, index: usize) -> &mut D::Value {
         &mut self.values[index]
     }
 
index 1933c926e3018e9dd6eefdfc2be47a3445bedf43..dfaf39702372cd9ed3a53c02fd93631d9604ad5d 100644 (file)
@@ -261,12 +261,12 @@ pub fn new() -> AttrBuilder {
         }
     }
 
-    pub fn arg<'a, T: AttrHelper + 'static>(&'a mut self, idx: usize, a: T) -> &'a mut AttrBuilder {
+    pub fn arg<T: AttrHelper + 'static>(&mut self, idx: usize, a: T) -> &mut AttrBuilder {
         self.attrs.push((idx, box a as Box<AttrHelper+'static>));
         self
     }
 
-    pub fn ret<'a, T: AttrHelper + 'static>(&'a mut self, a: T) -> &'a mut AttrBuilder {
+    pub fn ret<T: AttrHelper + 'static>(&mut self, a: T) -> &mut AttrBuilder {
         self.attrs.push((ReturnIndex as usize, box a as Box<AttrHelper+'static>));
         self
     }
index 49040a4c732e79c1c0c0b43345a46905e337e90d..d2d3e7cabd9b92562fba9d11c08737cdeff030b6 100644 (file)
@@ -1289,7 +1289,7 @@ fn resolve_module_path_from_root(&mut self,
                                      span: Span,
                                      lp: LastPrivate)
                                      -> ResolveResult<(Module<'a>, LastPrivate)> {
-        fn search_parent_externals<'a>(needle: Name, module: Module<'a>) -> Option<Module<'a>> {
+        fn search_parent_externals(needle: Name, module: Module) -> Option<Module> {
             match module.resolve_name(needle, TypeNS, false) {
                 Success(binding) if binding.is_extern_crate() => Some(module),
                 _ => match module.parent_link {
@@ -3513,10 +3513,10 @@ fn path_names_to_string(path: &Path, depth: usize) -> String {
 }
 
 /// A somewhat inefficient routine to obtain the name of a module.
-fn module_to_string<'a>(module: Module<'a>) -> String {
+fn module_to_string(module: Module) -> String {
     let mut names = Vec::new();
 
-    fn collect_mod<'a>(names: &mut Vec<ast::Name>, module: Module<'a>) {
+    fn collect_mod(names: &mut Vec<ast::Name>, module: Module) {
         match module.parent_link {
             NoParentLink => {}
             ModuleParentLink(ref module, name) => {
index f65c05672f68bd526ee3d4254fb76376becde7e4..9a6700ad47ce0d9df3ad250bdaec55c596f1c21b 100644 (file)
@@ -30,9 +30,9 @@ pub trait UnicodeStr {
     fn split_whitespace<'a>(&'a self) -> SplitWhitespace<'a>;
     fn is_whitespace(&self) -> bool;
     fn is_alphanumeric(&self) -> bool;
-    fn trim<'a>(&'a self) -> &'a str;
-    fn trim_left<'a>(&'a self) -> &'a str;
-    fn trim_right<'a>(&'a self) -> &'a str;
+    fn trim(&self) -> &str;
+    fn trim_left(&self) -> &str;
+    fn trim_right(&self) -> &str;
 }
 
 impl UnicodeStr for str {
index 2310a8237f4262649f4869de008ba855212f0fa0..b95eddbc661dddfd3e453da8e8288e4e48896195 100644 (file)
@@ -1227,7 +1227,7 @@ fn index(&self, idx: &'a str) -> &Json {
 impl Index<usize> for Json {
     type Output = Json;
 
-    fn index<'a>(&'a self, idx: usize) -> &'a Json {
+    fn index(&self, idx: usize) -> &Json {
         match *self {
             Json::Array(ref v) => &v[idx],
             _ => panic!("can only index Json with usize if it is an array")
@@ -1309,7 +1309,7 @@ pub fn is_empty(&self) -> bool { self.stack.is_empty() }
     /// Provides access to the StackElement at a given index.
     /// lower indices are at the bottom of the stack while higher indices are
     /// at the top.
-    pub fn get<'l>(&'l self, idx: usize) -> StackElement<'l> {
+    pub fn get(&self, idx: usize) -> StackElement {
         match self.stack[idx] {
             InternalIndex(i) => StackElement::Index(i),
             InternalKey(start, size) => {
@@ -1351,7 +1351,7 @@ pub fn ends_with(&self, rhs: &[StackElement]) -> bool {
     }
 
     /// Returns the top-most element (if any).
-    pub fn top<'l>(&'l self) -> Option<StackElement<'l>> {
+    pub fn top(&self) -> Option<StackElement> {
         match self.stack.last() {
             None => None,
             Some(&InternalIndex(i)) => Some(StackElement::Index(i)),
@@ -1463,7 +1463,7 @@ pub fn new(rdr: T) -> Parser<T> {
 
     /// Provides access to the current position in the logical structure of the
     /// JSON stream.
-    pub fn stack<'l>(&'l self) -> &'l Stack {
+    pub fn stack(&self) -> &Stack {
         &self.stack
     }
 
index 64230c9e016ac349e22ea5bcb3fe1af6d14a0dd5..9487295fd1ad66f9079678f80684c3c8853b1827 100644 (file)
@@ -403,10 +403,10 @@ enum Flavor<T> {
 #[doc(hidden)]
 trait UnsafeFlavor<T> {
     fn inner_unsafe(&self) -> &UnsafeCell<Flavor<T>>;
-    unsafe fn inner_mut<'a>(&'a self) -> &'a mut Flavor<T> {
+    unsafe fn inner_mut(&self) -> &mut Flavor<T> {
         &mut *self.inner_unsafe().get()
     }
-    unsafe fn inner<'a>(&'a self) -> &'a Flavor<T> {
+    unsafe fn inner(&self) -> &Flavor<T> {
         &*self.inner_unsafe().get()
     }
 }
index 8d857fc8e4899087414d9cbfde75593cb7eb65da..ae99fe817395f53a8b414344b27b486e347819cd 100644 (file)
@@ -55,11 +55,11 @@ pub struct TtReader<'a> {
 /// This can do Macro-By-Example transcription. On the other hand, if
 /// `src` contains no `TokenTree::Sequence`s, `MatchNt`s or `SubstNt`s, `interp` can
 /// (and should) be None.
-pub fn new_tt_reader<'a>(sp_diag: &'a Handler,
-                         interp: Option<HashMap<Name, Rc<NamedMatch>>>,
-                         imported_from: Option<Ident>,
-                         src: Vec<ast::TokenTree>)
-                         -> TtReader<'a> {
+pub fn new_tt_reader(sp_diag: &Handler,
+                     interp: Option<HashMap<Name, Rc<NamedMatch>>>,
+                     imported_from: Option<Ident>,
+                     src: Vec<ast::TokenTree>)
+                     -> TtReader {
     new_tt_reader_with_doc_flag(sp_diag, interp, imported_from, src, false)
 }
 
@@ -69,12 +69,12 @@ pub fn new_tt_reader<'a>(sp_diag: &'a Handler,
 /// This can do Macro-By-Example transcription. On the other hand, if
 /// `src` contains no `TokenTree::Sequence`s, `MatchNt`s or `SubstNt`s, `interp` can
 /// (and should) be None.
-pub fn new_tt_reader_with_doc_flag<'a>(sp_diag: &'a Handler,
-                                       interp: Option<HashMap<Name, Rc<NamedMatch>>>,
-                                       imported_from: Option<Ident>,
-                                       src: Vec<ast::TokenTree>,
-                                       desugar_doc_comments: bool)
-                                       -> TtReader<'a> {
+pub fn new_tt_reader_with_doc_flag(sp_diag: &Handler,
+                                   interp: Option<HashMap<Name, Rc<NamedMatch>>>,
+                                   imported_from: Option<Ident>,
+                                   src: Vec<ast::TokenTree>,
+                                   desugar_doc_comments: bool)
+                                   -> TtReader {
     let mut r = TtReader {
         sp_diag: sp_diag,
         stack: vec!(TtFrame {
index 771e24704558d806ff458770db12030eb14320a5..01daa938142b149ba1ff0b9abc455b709281c1ee 100644 (file)
@@ -211,10 +211,10 @@ pub trait Terminal: Write {
     fn reset(&mut self) -> io::Result<bool>;
 
     /// Gets an immutable reference to the stream inside
-    fn get_ref<'a>(&'a self) -> &'a Self::Output;
+    fn get_ref(&self) -> &Self::Output;
 
     /// Gets a mutable reference to the stream inside
-    fn get_mut<'a>(&'a mut self) -> &'a mut Self::Output;
+    fn get_mut(&mut self) -> &mut Self::Output;
 
     /// Returns the contained stream, destroying the `Terminal`
     fn into_inner(self) -> Self::Output where Self: Sized;
index 04486132c84de27c720e8d720ab6cdc217b46b3e..e54f763fd0db795cd701365c9984212da16ffe27 100644 (file)
@@ -205,11 +205,11 @@ fn reset(&mut self) -> io::Result<bool> {
         self.out.write_all(&cmd).and(Ok(true))
     }
 
-    fn get_ref<'a>(&'a self) -> &'a T {
+    fn get_ref(&self) -> &T {
         &self.out
     }
 
-    fn get_mut<'a>(&'a mut self) -> &'a mut T {
+    fn get_mut(&mut self) -> &mut T {
         &mut self.out
     }