mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
Auto merge of #15169 - lowr:patch/impl-header-anon-lifetime, r=HKalbasi
Use anonymous lifetime where possible Because anonymous lifetimes are *super* cool. More seriously, I believe anonymous lifetimes, especially those in impl headers, reduce cognitive load to a certain extent because they usually signify that they are not relevant in the signature of the methods within (or that we can apply the usual lifetime elision rules even if they are relevant).
This commit is contained in:
commit
76bcd9946a
30 changed files with 60 additions and 60 deletions
|
@ -32,10 +32,10 @@ pub(crate) struct LoggerConfig {
|
|||
|
||||
struct MakeWriterStderr;
|
||||
|
||||
impl<'a> MakeWriter<'a> for MakeWriterStderr {
|
||||
impl MakeWriter<'_> for MakeWriterStderr {
|
||||
type Writer = Stderr;
|
||||
|
||||
fn make_writer(&'a self) -> Self::Writer {
|
||||
fn make_writer(&self) -> Self::Writer {
|
||||
io::stderr()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ pub(crate) struct RequestDispatcher<'a> {
|
|||
pub(crate) global_state: &'a mut GlobalState,
|
||||
}
|
||||
|
||||
impl<'a> RequestDispatcher<'a> {
|
||||
impl RequestDispatcher<'_> {
|
||||
/// Dispatches the request onto the current thread, given full access to
|
||||
/// mutable global state. Unlike all other methods here, this one isn't
|
||||
/// guarded by `catch_unwind`, so, please, don't make bugs :-)
|
||||
|
@ -306,7 +306,7 @@ pub(crate) struct NotificationDispatcher<'a> {
|
|||
pub(crate) global_state: &'a mut GlobalState,
|
||||
}
|
||||
|
||||
impl<'a> NotificationDispatcher<'a> {
|
||||
impl NotificationDispatcher<'_> {
|
||||
pub(crate) fn on_sync_mut<N>(
|
||||
&mut self,
|
||||
f: fn(&mut GlobalState, N::Params) -> anyhow::Result<()>,
|
||||
|
|
|
@ -25,7 +25,7 @@ pub(crate) struct Project<'a> {
|
|||
config: serde_json::Value,
|
||||
}
|
||||
|
||||
impl<'a> Project<'a> {
|
||||
impl Project<'_> {
|
||||
pub(crate) fn with_fixture(fixture: &str) -> Project<'_> {
|
||||
Project {
|
||||
fixture,
|
||||
|
@ -48,17 +48,17 @@ impl<'a> Project<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn tmp_dir(mut self, tmp_dir: TestDir) -> Project<'a> {
|
||||
pub(crate) fn tmp_dir(mut self, tmp_dir: TestDir) -> Self {
|
||||
self.tmp_dir = Some(tmp_dir);
|
||||
self
|
||||
}
|
||||
|
||||
pub(crate) fn root(mut self, path: &str) -> Project<'a> {
|
||||
pub(crate) fn root(mut self, path: &str) -> Self {
|
||||
self.roots.push(path.into());
|
||||
self
|
||||
}
|
||||
|
||||
pub(crate) fn with_config(mut self, config: serde_json::Value) -> Project<'a> {
|
||||
pub(crate) fn with_config(mut self, config: serde_json::Value) -> Self {
|
||||
fn merge(dst: &mut serde_json::Value, src: serde_json::Value) {
|
||||
match (dst, src) {
|
||||
(Value::Object(dst), Value::Object(src)) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue