1
Fork 0

Auto merge of #59584 - Centril:rollup, r=Centril

Rollup of 4 pull requests

Successful merges:

 - #58828 (libstd: deny(elided_lifetimes_in_paths))
 - #59234 (Mention `no merge policy` in the CONTRIBUTING guide)
 - #59572 (Include bounds in generic re-ordering diagnostic)
 - #59574 (Distinguish message for external macros depending on error level)

Failed merges:

r? @ghost
This commit is contained in:
bors 2019-03-31 14:11:11 +00:00
commit a89c03a30a
112 changed files with 585 additions and 458 deletions

View file

@ -122,6 +122,13 @@ bring those changes into the source repository.
Please make pull requests against the `master` branch.
Rust follows a no merge policy, meaning, when you encounter merge
conflicts you are expected to always rebase instead of merge.
E.g. always use rebase when bringing the latest changes from
the master branch to your feature branch.
Also, please make sure that fixup commits are squashed into other related
commits with meaningful commit messages.
Please make sure your pull request is in compliance with Rust's style
guidelines by running

View file

@ -6,6 +6,7 @@ use crate::{
Level, CodeSuggestion, DiagnosticBuilder, SubDiagnostic,
SuggestionStyle, SourceMapperDyn, DiagnosticId,
};
use crate::Level::Error;
use crate::snippet::{Annotation, AnnotationType, Line, MultilineAnnotation, StyledString, Style};
use crate::styled_buffer::StyledBuffer;
@ -72,6 +73,7 @@ impl Emitter for EmitterWriter {
self.fix_multispans_in_std_macros(&mut primary_span,
&mut children,
&db.level,
db.handler.flags.external_macro_backtrace);
self.emit_messages_default(&db.level,
@ -888,18 +890,27 @@ impl EmitterWriter {
fn fix_multispans_in_std_macros(&mut self,
span: &mut MultiSpan,
children: &mut Vec<SubDiagnostic>,
level: &Level,
backtrace: bool) {
let mut spans_updated = self.fix_multispan_in_std_macros(span, backtrace);
for child in children.iter_mut() {
spans_updated |= self.fix_multispan_in_std_macros(&mut child.span, backtrace);
}
let msg = if level == &Error {
"this error originates in a macro outside of the current crate \
(in Nightly builds, run with -Z external-macro-backtrace \
for more info)".to_string()
} else {
"this warning originates in a macro outside of the current crate \
(in Nightly builds, run with -Z external-macro-backtrace \
for more info)".to_string()
};
if spans_updated {
children.push(SubDiagnostic {
level: Level::Note,
message: vec![
("this error originates in a macro outside of the current crate \
(in Nightly builds, run with -Z external-macro-backtrace \
for more info)".to_string(),
(msg,
Style::NoStyle),
],
span: MultiSpan::new(),

View file

@ -352,8 +352,16 @@ enum GenericPosition {
}
fn validate_generics_order<'a>(
sess: &Session,
handler: &errors::Handler,
generics: impl Iterator<Item = (ParamKindOrd, Span, Option<String>)>,
generics: impl Iterator<
Item = (
ParamKindOrd,
Option<&'a [GenericBound]>,
Span,
Option<String>
),
>,
pos: GenericPosition,
span: Span,
) {
@ -361,9 +369,9 @@ fn validate_generics_order<'a>(
let mut out_of_order = FxHashMap::default();
let mut param_idents = vec![];
for (kind, span, ident) in generics {
for (kind, bounds, span, ident) in generics {
if let Some(ident) = ident {
param_idents.push((kind, param_idents.len(), ident));
param_idents.push((kind, bounds, param_idents.len(), ident));
}
let max_param = &mut max_param;
match max_param {
@ -377,13 +385,19 @@ fn validate_generics_order<'a>(
let mut ordered_params = "<".to_string();
if !out_of_order.is_empty() {
param_idents.sort_by_key(|&(po, i, _)| (po, i));
param_idents.sort_by_key(|&(po, _, i, _)| (po, i));
let mut first = true;
for (_, _, ident) in param_idents {
for (_, bounds, _, ident) in param_idents {
if !first {
ordered_params += ", ";
}
ordered_params += &ident;
if let Some(bounds) = bounds {
if !bounds.is_empty() {
ordered_params += ": ";
ordered_params += &pprust::bounds_to_string(&bounds);
}
}
first = false;
}
}
@ -405,7 +419,11 @@ fn validate_generics_order<'a>(
if let GenericPosition::Param = pos {
err.span_suggestion(
span,
&format!("reorder the {}s: lifetimes, then types, then consts", pos_str),
&format!(
"reorder the {}s: lifetimes, then types{}",
pos_str,
if sess.features_untracked().const_generics { ", then consts" } else { "" },
),
ordered_params.clone(),
Applicability::MachineApplicable,
);
@ -687,13 +705,19 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
match *generic_args {
GenericArgs::AngleBracketed(ref data) => {
walk_list!(self, visit_generic_arg, &data.args);
validate_generics_order(self.err_handler(), data.args.iter().map(|arg| {
(match arg {
GenericArg::Lifetime(..) => ParamKindOrd::Lifetime,
GenericArg::Type(..) => ParamKindOrd::Type,
GenericArg::Const(..) => ParamKindOrd::Const,
}, arg.span(), None)
}), GenericPosition::Arg, generic_args.span());
validate_generics_order(
self.session,
self.err_handler(),
data.args.iter().map(|arg| {
(match arg {
GenericArg::Lifetime(..) => ParamKindOrd::Lifetime,
GenericArg::Type(..) => ParamKindOrd::Type,
GenericArg::Const(..) => ParamKindOrd::Const,
}, None, arg.span(), None)
}),
GenericPosition::Arg,
generic_args.span(),
);
// Type bindings such as `Item=impl Debug` in `Iterator<Item=Debug>`
// are allowed to contain nested `impl Trait`.
@ -726,18 +750,24 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
}
}
validate_generics_order(self.err_handler(), generics.params.iter().map(|param| {
let span = param.ident.span;
let ident = Some(param.ident.to_string());
match &param.kind {
GenericParamKind::Lifetime { .. } => (ParamKindOrd::Lifetime, span, ident),
GenericParamKind::Type { .. } => (ParamKindOrd::Type, span, ident),
GenericParamKind::Const { ref ty } => {
let ty = pprust::ty_to_string(ty);
(ParamKindOrd::Const, span, Some(format!("const {}: {}", param.ident, ty)))
}
}
}), GenericPosition::Param, generics.span);
validate_generics_order(
self.session,
self.err_handler(),
generics.params.iter().map(|param| {
let ident = Some(param.ident.to_string());
let (kind, ident) = match &param.kind {
GenericParamKind::Lifetime { .. } => (ParamKindOrd::Lifetime, ident),
GenericParamKind::Type { .. } => (ParamKindOrd::Type, ident),
GenericParamKind::Const { ref ty } => {
let ty = pprust::ty_to_string(ty);
(ParamKindOrd::Const, Some(format!("const {}: {}", param.ident, ty)))
}
};
(kind, Some(&*param.bounds), param.ident.span, ident)
}),
GenericPosition::Param,
generics.span,
);
for predicate in &generics.where_clause.predicates {
if let WherePredicate::EqPredicate(ref predicate) = *predicate {

View file

@ -534,7 +534,7 @@ fn search_hashed_nonempty_mut<K, V, M, F>(table: M, hash: SafeHash, mut is_match
}
}
fn pop_internal<K, V>(starting_bucket: FullBucketMut<K, V>)
fn pop_internal<K, V>(starting_bucket: FullBucketMut<'_, K, V>)
-> (K, V, &mut RawTable<K, V>)
{
let (empty, retkey, retval) = starting_bucket.take();
@ -759,7 +759,7 @@ impl<K, V, S> HashMap<K, V, S> {
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn keys(&self) -> Keys<K, V> {
pub fn keys(&self) -> Keys<'_, K, V> {
Keys { inner: self.iter() }
}
@ -781,7 +781,7 @@ impl<K, V, S> HashMap<K, V, S> {
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn values(&self) -> Values<K, V> {
pub fn values(&self) -> Values<'_, K, V> {
Values { inner: self.iter() }
}
@ -808,7 +808,7 @@ impl<K, V, S> HashMap<K, V, S> {
/// }
/// ```
#[stable(feature = "map_values_mut", since = "1.10.0")]
pub fn values_mut(&mut self) -> ValuesMut<K, V> {
pub fn values_mut(&mut self) -> ValuesMut<'_, K, V> {
ValuesMut { inner: self.iter_mut() }
}
@ -830,7 +830,7 @@ impl<K, V, S> HashMap<K, V, S> {
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter<K, V> {
pub fn iter(&self) -> Iter<'_, K, V> {
Iter { inner: self.table.iter() }
}
@ -858,7 +858,7 @@ impl<K, V, S> HashMap<K, V, S> {
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn iter_mut(&mut self) -> IterMut<K, V> {
pub fn iter_mut(&mut self) -> IterMut<'_, K, V> {
IterMut { inner: self.table.iter_mut() }
}
@ -918,7 +918,7 @@ impl<K, V, S> HashMap<K, V, S> {
/// ```
#[inline]
#[stable(feature = "drain", since = "1.6.0")]
pub fn drain(&mut self) -> Drain<K, V> {
pub fn drain(&mut self) -> Drain<'_, K, V> {
Drain { inner: self.table.drain() }
}
@ -1270,7 +1270,7 @@ impl<K, V, S> HashMap<K, V, S>
/// assert_eq!(letters.get(&'y'), None);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn entry(&mut self, key: K) -> Entry<K, V> {
pub fn entry(&mut self, key: K) -> Entry<'_, K, V> {
// Gotta resize now.
self.reserve(1);
let hash = self.make_hash(&key);
@ -1571,7 +1571,7 @@ impl<K, V, S> HashMap<K, V, S>
/// are free to assume this doesn't happen (within the limits of memory-safety).
#[inline(always)]
#[unstable(feature = "hash_raw_entry", issue = "56167")]
pub fn raw_entry_mut(&mut self) -> RawEntryBuilderMut<K, V, S> {
pub fn raw_entry_mut(&mut self) -> RawEntryBuilderMut<'_, K, V, S> {
self.reserve(1);
RawEntryBuilderMut { map: self }
}
@ -1592,7 +1592,7 @@ impl<K, V, S> HashMap<K, V, S>
///
/// Immutable raw entries have very limited use; you might instead want `raw_entry_mut`.
#[unstable(feature = "hash_raw_entry", issue = "56167")]
pub fn raw_entry(&self) -> RawEntryBuilder<K, V, S> {
pub fn raw_entry(&self) -> RawEntryBuilder<'_, K, V, S> {
RawEntryBuilder { map: self }
}
}
@ -1626,7 +1626,7 @@ impl<K, V, S> Debug for HashMap<K, V, S>
V: Debug,
S: BuildHasher
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_map().entries(self.iter()).finish()
}
}
@ -1683,7 +1683,7 @@ impl<K, V> Clone for Iter<'_, K, V> {
#[stable(feature = "std_debug", since = "1.16.0")]
impl<K: Debug, V: Debug> fmt::Debug for Iter<'_, K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list()
.entries(self.clone())
.finish()
@ -1736,7 +1736,7 @@ impl<K, V> Clone for Keys<'_, K, V> {
#[stable(feature = "std_debug", since = "1.16.0")]
impl<K: Debug, V> fmt::Debug for Keys<'_, K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list()
.entries(self.clone())
.finish()
@ -1765,7 +1765,7 @@ impl<K, V> Clone for Values<'_, K, V> {
#[stable(feature = "std_debug", since = "1.16.0")]
impl<K, V: Debug> fmt::Debug for Values<'_, K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list()
.entries(self.clone())
.finish()
@ -2244,7 +2244,7 @@ impl<'a, K, V, S> RawVacantEntryMut<'a, K, V, S> {
#[unstable(feature = "hash_raw_entry", issue = "56167")]
impl<K, V, S> Debug for RawEntryBuilderMut<'_, K, V, S> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("RawEntryBuilder")
.finish()
}
@ -2252,7 +2252,7 @@ impl<K, V, S> Debug for RawEntryBuilderMut<'_, K, V, S> {
#[unstable(feature = "hash_raw_entry", issue = "56167")]
impl<K: Debug, V: Debug, S> Debug for RawEntryMut<'_, K, V, S> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
RawEntryMut::Vacant(ref v) => {
f.debug_tuple("RawEntry")
@ -2270,7 +2270,7 @@ impl<K: Debug, V: Debug, S> Debug for RawEntryMut<'_, K, V, S> {
#[unstable(feature = "hash_raw_entry", issue = "56167")]
impl<K: Debug, V: Debug> Debug for RawOccupiedEntryMut<'_, K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("RawOccupiedEntryMut")
.field("key", self.key())
.field("value", self.get())
@ -2280,7 +2280,7 @@ impl<K: Debug, V: Debug> Debug for RawOccupiedEntryMut<'_, K, V> {
#[unstable(feature = "hash_raw_entry", issue = "56167")]
impl<K, V, S> Debug for RawVacantEntryMut<'_, K, V, S> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("RawVacantEntryMut")
.finish()
}
@ -2288,7 +2288,7 @@ impl<K, V, S> Debug for RawVacantEntryMut<'_, K, V, S> {
#[unstable(feature = "hash_raw_entry", issue = "56167")]
impl<K, V, S> Debug for RawEntryBuilder<'_, K, V, S> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("RawEntryBuilder")
.finish()
}
@ -2315,7 +2315,7 @@ pub enum Entry<'a, K: 'a, V: 'a> {
#[stable(feature= "debug_hash_map", since = "1.12.0")]
impl<K: Debug, V: Debug> Debug for Entry<'_, K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
Vacant(ref v) => {
f.debug_tuple("Entry")
@ -2348,7 +2348,7 @@ unsafe impl<'a, K: 'a + Sync, V: 'a + Sync> Sync for OccupiedEntry<'a, K, V> {}
#[stable(feature= "debug_hash_map", since = "1.12.0")]
impl<K: Debug, V: Debug> Debug for OccupiedEntry<'_, K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("OccupiedEntry")
.field("key", self.key())
.field("value", self.get())
@ -2374,7 +2374,7 @@ unsafe impl<'a, K: 'a + Sync, V: 'a + Sync> Sync for VacantEntry<'a, K, V> {}
#[stable(feature= "debug_hash_map", since = "1.12.0")]
impl<K: Debug, V> Debug for VacantEntry<'_, K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("VacantEntry")
.field(self.key())
.finish()
@ -2489,7 +2489,7 @@ impl<K, V> fmt::Debug for IterMut<'_, K, V>
where K: fmt::Debug,
V: fmt::Debug,
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list()
.entries(self.inner.iter())
.finish()
@ -2521,7 +2521,7 @@ impl<K, V> FusedIterator for IntoIter<K, V> {}
#[stable(feature = "std_debug", since = "1.16.0")]
impl<K: Debug, V: Debug> fmt::Debug for IntoIter<K, V> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list()
.entries(self.inner.iter())
.finish()
@ -2602,7 +2602,7 @@ impl<K, V> fmt::Debug for ValuesMut<'_, K, V>
where K: fmt::Debug,
V: fmt::Debug,
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list()
.entries(self.inner.inner.iter())
.finish()
@ -2637,7 +2637,7 @@ impl<K, V> fmt::Debug for Drain<'_, K, V>
where K: fmt::Debug,
V: fmt::Debug,
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list()
.entries(self.inner.iter())
.finish()
@ -3257,7 +3257,7 @@ impl Default for RandomState {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for RandomState {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("RandomState { .. }")
}
}

View file

@ -182,7 +182,7 @@ impl<T, S> HashSet<T, S> {
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter<T> {
pub fn iter(&self) -> Iter<'_, T> {
Iter { iter: self.map.keys() }
}
@ -239,7 +239,7 @@ impl<T, S> HashSet<T, S> {
/// ```
#[inline]
#[stable(feature = "drain", since = "1.6.0")]
pub fn drain(&mut self) -> Drain<T> {
pub fn drain(&mut self) -> Drain<'_, T> {
Drain { iter: self.map.drain() }
}
@ -801,7 +801,7 @@ impl<T, S> fmt::Debug for HashSet<T, S>
where T: Eq + Hash + fmt::Debug,
S: BuildHasher
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_set().entries(self.iter()).finish()
}
}
@ -1135,7 +1135,7 @@ impl<K> FusedIterator for Iter<'_, K> {}
#[stable(feature = "std_debug", since = "1.16.0")]
impl<K: fmt::Debug> fmt::Debug for Iter<'_, K> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list().entries(self.clone()).finish()
}
}
@ -1162,7 +1162,7 @@ impl<K> FusedIterator for IntoIter<K> {}
#[stable(feature = "std_debug", since = "1.16.0")]
impl<K: fmt::Debug> fmt::Debug for IntoIter<K> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let entries_iter = self.iter
.inner
.iter()
@ -1193,7 +1193,7 @@ impl<K> FusedIterator for Drain<'_, K> {}
#[stable(feature = "std_debug", since = "1.16.0")]
impl<K: fmt::Debug> fmt::Debug for Drain<'_, K> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let entries_iter = self.iter
.inner
.iter()
@ -1236,7 +1236,7 @@ impl<T, S> fmt::Debug for Intersection<'_, T, S>
where T: fmt::Debug + Eq + Hash,
S: BuildHasher
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list().entries(self.clone()).finish()
}
}
@ -1289,7 +1289,7 @@ impl<T, S> fmt::Debug for Difference<'_, T, S>
where T: fmt::Debug + Eq + Hash,
S: BuildHasher
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list().entries(self.clone()).finish()
}
}
@ -1328,7 +1328,7 @@ impl<T, S> fmt::Debug for SymmetricDifference<'_, T, S>
where T: fmt::Debug + Eq + Hash,
S: BuildHasher
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list().entries(self.clone()).finish()
}
}
@ -1352,7 +1352,7 @@ impl<T, S> fmt::Debug for Union<'_, T, S>
where T: fmt::Debug + Eq + Hash,
S: BuildHasher
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list().entries(self.clone()).finish()
}
}

View file

@ -772,7 +772,7 @@ impl<K, V> RawTable<K, V> {
self.size
}
fn raw_buckets(&self) -> RawBuckets<K, V> {
fn raw_buckets(&self) -> RawBuckets<'_, K, V> {
RawBuckets {
raw: self.raw_bucket_at(0),
elems_left: self.size,
@ -780,13 +780,13 @@ impl<K, V> RawTable<K, V> {
}
}
pub fn iter(&self) -> Iter<K, V> {
pub fn iter(&self) -> Iter<'_, K, V> {
Iter {
iter: self.raw_buckets(),
}
}
pub fn iter_mut(&mut self) -> IterMut<K, V> {
pub fn iter_mut(&mut self) -> IterMut<'_, K, V> {
IterMut {
iter: self.raw_buckets(),
_marker: marker::PhantomData,
@ -806,7 +806,7 @@ impl<K, V> RawTable<K, V> {
}
}
pub fn drain(&mut self) -> Drain<K, V> {
pub fn drain(&mut self) -> Drain<'_, K, V> {
let RawBuckets { raw, elems_left, .. } = self.raw_buckets();
// Replace the marker regardless of lifetime bounds on parameters.
Drain {
@ -936,7 +936,7 @@ unsafe impl<K: Sync, V: Sync> Sync for IterMut<'_, K, V> {}
unsafe impl<K: Send, V: Send> Send for IterMut<'_, K, V> {}
impl<'a, K: 'a, V: 'a> IterMut<'a, K, V> {
pub fn iter(&self) -> Iter<K, V> {
pub fn iter(&self) -> Iter<'_, K, V> {
Iter {
iter: self.iter.clone(),
}
@ -953,7 +953,7 @@ unsafe impl<K: Sync, V: Sync> Sync for IntoIter<K, V> {}
unsafe impl<K: Send, V: Send> Send for IntoIter<K, V> {}
impl<K, V> IntoIter<K, V> {
pub fn iter(&self) -> Iter<K, V> {
pub fn iter(&self) -> Iter<'_, K, V> {
Iter {
iter: self.iter.clone(),
}
@ -971,7 +971,7 @@ unsafe impl<K: Sync, V: Sync> Sync for Drain<'_, K, V> {}
unsafe impl<K: Send, V: Send> Send for Drain<'_, K, V> {}
impl<'a, K, V> Drain<'a, K, V> {
pub fn iter(&self) -> Iter<K, V> {
pub fn iter(&self) -> Iter<'_, K, V> {
Iter {
iter: self.iter.clone(),
}

View file

@ -156,7 +156,7 @@ impl Iterator for Vars {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Vars {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Vars { .. }")
}
}
@ -170,7 +170,7 @@ impl Iterator for VarsOs {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for VarsOs {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("VarsOs { .. }")
}
}
@ -253,7 +253,7 @@ pub enum VarError {
#[stable(feature = "env", since = "1.0.0")]
impl fmt::Display for VarError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
VarError::NotPresent => write!(f, "environment variable not found"),
VarError::NotUnicode(ref s) => {
@ -387,7 +387,7 @@ pub struct SplitPaths<'a> { inner: os_imp::SplitPaths<'a> }
/// }
/// ```
#[stable(feature = "env", since = "1.0.0")]
pub fn split_paths<T: AsRef<OsStr> + ?Sized>(unparsed: &T) -> SplitPaths {
pub fn split_paths<T: AsRef<OsStr> + ?Sized>(unparsed: &T) -> SplitPaths<'_> {
SplitPaths { inner: os_imp::split_paths(unparsed.as_ref()) }
}
@ -400,7 +400,7 @@ impl<'a> Iterator for SplitPaths<'a> {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for SplitPaths<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("SplitPaths { .. }")
}
}
@ -488,7 +488,7 @@ pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError>
#[stable(feature = "env", since = "1.0.0")]
impl fmt::Display for JoinPathsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.inner.fmt(f)
}
}
@ -757,7 +757,7 @@ impl DoubleEndedIterator for Args {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Args {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Args")
.field("inner", &self.inner.inner.inner_debug())
.finish()
@ -790,7 +790,7 @@ impl DoubleEndedIterator for ArgsOs {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for ArgsOs {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("ArgsOs")
.field("inner", &self.inner.inner_debug())
.finish()

View file

@ -84,7 +84,7 @@ pub trait Error: Debug + Display {
/// }
///
/// impl fmt::Display for SuperError {
/// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// write!(f, "SuperError is here!")
/// }
/// }
@ -103,7 +103,7 @@ pub trait Error: Debug + Display {
/// struct SuperErrorSideKick;
///
/// impl fmt::Display for SuperErrorSideKick {
/// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// write!(f, "SuperErrorSideKick is here!")
/// }
/// }
@ -149,7 +149,7 @@ pub trait Error: Debug + Display {
/// }
///
/// impl fmt::Display for SuperError {
/// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// write!(f, "SuperError is here!")
/// }
/// }
@ -168,7 +168,7 @@ pub trait Error: Debug + Display {
/// struct SuperErrorSideKick;
///
/// impl fmt::Display for SuperErrorSideKick {
/// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// write!(f, "SuperErrorSideKick is here!")
/// }
/// }
@ -219,7 +219,7 @@ impl<'a, E: Error + 'a> From<E> for Box<dyn Error + 'a> {
/// struct AnError;
///
/// impl fmt::Display for AnError {
/// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// write!(f , "An error")
/// }
/// }
@ -256,7 +256,7 @@ impl<'a, E: Error + Send + Sync + 'a> From<E> for Box<dyn Error + Send + Sync +
/// struct AnError;
///
/// impl fmt::Display for AnError {
/// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// write!(f , "An error")
/// }
/// }
@ -306,7 +306,7 @@ impl From<String> for Box<dyn Error + Send + Sync> {
}
impl Display for StringError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
Display::fmt(&self.0, f)
}
}
@ -686,13 +686,13 @@ impl dyn Error {
/// struct B(Option<Box<dyn Error + 'static>>);
///
/// impl fmt::Display for A {
/// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// write!(f, "A")
/// }
/// }
///
/// impl fmt::Display for B {
/// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// write!(f, "B")
/// }
/// }
@ -721,7 +721,7 @@ impl dyn Error {
/// [`source`]: trait.Error.html#method.source
#[unstable(feature = "error_iter", issue = "58520")]
#[inline]
pub fn iter_chain(&self) -> ErrorIter {
pub fn iter_chain(&self) -> ErrorIter<'_> {
ErrorIter {
current: Some(self),
}
@ -747,19 +747,19 @@ impl dyn Error {
/// struct C(Option<Box<dyn Error + 'static>>);
///
/// impl fmt::Display for A {
/// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// write!(f, "A")
/// }
/// }
///
/// impl fmt::Display for B {
/// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// write!(f, "B")
/// }
/// }
///
/// impl fmt::Display for C {
/// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// write!(f, "C")
/// }
/// }
@ -795,7 +795,7 @@ impl dyn Error {
/// [`source`]: trait.Error.html#method.source
#[inline]
#[unstable(feature = "error_iter", issue = "58520")]
pub fn iter_sources(&self) -> ErrorIter {
pub fn iter_sources(&self) -> ErrorIter<'_> {
ErrorIter {
current: self.source(),
}
@ -861,12 +861,12 @@ mod tests {
struct B;
impl fmt::Display for A {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "A")
}
}
impl fmt::Display for B {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "B")
}
}

View file

@ -628,7 +628,7 @@ impl ops::Deref for CString {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for CString {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&**self, f)
}
}
@ -649,7 +649,7 @@ impl From<CString> for Vec<u8> {
#[stable(feature = "cstr_debug", since = "1.3.0")]
impl fmt::Debug for CStr {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "\"")?;
for byte in self.to_bytes().iter().flat_map(|&b| ascii::escape_default(b)) {
f.write_char(byte as char)?;
@ -847,7 +847,7 @@ impl Error for NulError {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Display for NulError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "nul byte found in provided data at position: {}", self.0)
}
}
@ -878,7 +878,7 @@ impl Error for FromBytesWithNulError {
#[stable(feature = "frombyteswithnulerror_impls", since = "1.17.0")]
impl fmt::Display for FromBytesWithNulError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.description())?;
if let FromBytesWithNulErrorKind::InteriorNul(pos) = self.kind {
write!(f, " at byte pos {}", pos)?;
@ -917,7 +917,7 @@ impl Error for IntoStringError {
#[stable(feature = "cstring_into", since = "1.7.0")]
impl fmt::Display for IntoStringError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.description().fmt(f)
}
}
@ -1208,11 +1208,11 @@ impl CStr {
/// .expect("CStr::from_bytes_with_nul failed");
/// assert_eq!(
/// c_str.to_string_lossy(),
/// Cow::Owned(String::from("Hello <20>World")) as Cow<str>
/// Cow::Owned(String::from("Hello <20>World")) as Cow<'_, str>
/// );
/// ```
#[stable(feature = "cstr_to_str", since = "1.4.0")]
pub fn to_string_lossy(&self) -> Cow<str> {
pub fn to_string_lossy(&self) -> Cow<'_, str> {
String::from_utf8_lossy(self.to_bytes())
}

View file

@ -394,7 +394,7 @@ impl Default for OsString {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for OsString {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&**self, formatter)
}
}
@ -563,7 +563,7 @@ impl OsStr {
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn to_string_lossy(&self) -> Cow<str> {
pub fn to_string_lossy(&self) -> Cow<'_, str> {
self.inner.to_string_lossy()
}
@ -891,13 +891,13 @@ impl Hash for OsStr {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for OsStr {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&self.inner, formatter)
}
}
impl OsStr {
pub(crate) fn display(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
pub(crate) fn display(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(&self.inner, formatter)
}
}

View file

@ -597,7 +597,7 @@ impl IntoInner<fs_imp::File> for File {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for File {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.inner.fmt(f)
}
}
@ -1087,7 +1087,7 @@ impl Metadata {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Metadata {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Metadata")
.field("file_type", &self.file_type())
.field("is_dir", &self.is_dir())
@ -1394,7 +1394,7 @@ impl DirEntry {
#[stable(feature = "dir_entry_debug", since = "1.13.0")]
impl fmt::Debug for DirEntry {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("DirEntry")
.field(&self.path())
.finish()

View file

@ -291,7 +291,7 @@ impl<R: Read> BufRead for BufReader<R> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<R> fmt::Debug for BufReader<R> where R: fmt::Debug {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("BufReader")
.field("reader", &self.inner)
.field("buffer", &format_args!("{}/{}", self.cap - self.pos, self.buf.len()))
@ -631,7 +631,7 @@ impl<W: Write> Write for BufWriter<W> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<W: Write> fmt::Debug for BufWriter<W> where W: fmt::Debug {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("BufWriter")
.field("writer", &self.inner.as_ref().unwrap())
.field("buffer", &format_args!("{}/{}", self.buf.len(), self.buf.capacity()))
@ -739,7 +739,7 @@ impl<W: Send + fmt::Debug> error::Error for IntoInnerError<W> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<W> fmt::Display for IntoInnerError<W> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.error().fmt(f)
}
}
@ -981,7 +981,7 @@ impl<W: Write> Write for LineWriter<W> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<W: Write> fmt::Debug for LineWriter<W> where W: fmt::Debug {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("LineWriter")
.field("writer", &self.inner.inner)
.field("buffer",

View file

@ -59,7 +59,7 @@ pub struct Error {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&self.repr, f)
}
}
@ -413,7 +413,7 @@ impl Error {
/// }
///
/// impl Display for MyError {
/// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
/// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
/// write!(f, "MyError: {}", &self.v)
/// }
/// }
@ -512,7 +512,7 @@ impl Error {
}
impl fmt::Debug for Repr {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
Repr::Os(code) =>
fmt.debug_struct("Os")
@ -527,7 +527,7 @@ impl fmt::Debug for Repr {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Display for Error {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.repr {
Repr::Os(code) => {
let detail = sys::os::error_string(code);
@ -612,7 +612,7 @@ mod test {
struct TestError;
impl fmt::Display for TestError {
fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result {
Ok(())
}
}

View file

@ -58,7 +58,7 @@ impl<W: Write + ?Sized> Write for &mut W {
}
#[inline]
fn write_fmt(&mut self, fmt: fmt::Arguments) -> io::Result<()> {
fn write_fmt(&mut self, fmt: fmt::Arguments<'_>) -> io::Result<()> {
(**self).write_fmt(fmt)
}
}
@ -137,7 +137,7 @@ impl<W: Write + ?Sized> Write for Box<W> {
}
#[inline]
fn write_fmt(&mut self, fmt: fmt::Arguments) -> io::Result<()> {
fn write_fmt(&mut self, fmt: fmt::Arguments<'_>) -> io::Result<()> {
(**self).write_fmt(fmt)
}
}

View file

@ -917,7 +917,7 @@ pub struct IoVecMut<'a>(sys::io::IoVecMut<'a>);
#[unstable(feature = "iovec", issue = "58452")]
impl<'a> fmt::Debug for IoVecMut<'a> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(self.0.as_slice(), fmt)
}
}
@ -964,7 +964,7 @@ pub struct IoVec<'a>(sys::io::IoVec<'a>);
#[unstable(feature = "iovec", issue = "58452")]
impl<'a> fmt::Debug for IoVec<'a> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(self.0.as_slice(), fmt)
}
}
@ -1255,7 +1255,7 @@ pub trait Write {
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<()> {
fn write_fmt(&mut self, fmt: fmt::Arguments<'_>) -> Result<()> {
// Create a shim which translates a Write to a fmt::Write and saves
// off I/O errors. instead of discarding them
struct Adaptor<'a, T: ?Sized + 'a> {
@ -1906,7 +1906,7 @@ impl<T, U> Chain<T, U> {
#[stable(feature = "std_debug", since = "1.16.0")]
impl<T: fmt::Debug, U: fmt::Debug> fmt::Debug for Chain<T, U> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Chain")
.field("t", &self.first)
.field("u", &self.second)

View file

@ -255,7 +255,7 @@ impl Stdin {
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn lock(&self) -> StdinLock {
pub fn lock(&self) -> StdinLock<'_> {
StdinLock { inner: self.inner.lock().unwrap_or_else(|e| e.into_inner()) }
}
@ -295,7 +295,7 @@ impl Stdin {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Stdin {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Stdin { .. }")
}
}
@ -339,7 +339,7 @@ impl BufRead for StdinLock<'_> {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for StdinLock<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("StdinLock { .. }")
}
}
@ -466,14 +466,14 @@ impl Stdout {
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn lock(&self) -> StdoutLock {
pub fn lock(&self) -> StdoutLock<'_> {
StdoutLock { inner: self.inner.lock().unwrap_or_else(|e| e.into_inner()) }
}
}
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Stdout {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Stdout { .. }")
}
}
@ -489,7 +489,7 @@ impl Write for Stdout {
fn write_all(&mut self, buf: &[u8]) -> io::Result<()> {
self.lock().write_all(buf)
}
fn write_fmt(&mut self, args: fmt::Arguments) -> io::Result<()> {
fn write_fmt(&mut self, args: fmt::Arguments<'_>) -> io::Result<()> {
self.lock().write_fmt(args)
}
}
@ -505,7 +505,7 @@ impl Write for StdoutLock<'_> {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for StdoutLock<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("StdoutLock { .. }")
}
}
@ -619,14 +619,14 @@ impl Stderr {
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn lock(&self) -> StderrLock {
pub fn lock(&self) -> StderrLock<'_> {
StderrLock { inner: self.inner.lock().unwrap_or_else(|e| e.into_inner()) }
}
}
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Stderr {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Stderr { .. }")
}
}
@ -642,7 +642,7 @@ impl Write for Stderr {
fn write_all(&mut self, buf: &[u8]) -> io::Result<()> {
self.lock().write_all(buf)
}
fn write_fmt(&mut self, args: fmt::Arguments) -> io::Result<()> {
fn write_fmt(&mut self, args: fmt::Arguments<'_>) -> io::Result<()> {
self.lock().write_fmt(args)
}
}
@ -658,7 +658,7 @@ impl Write for StderrLock<'_> {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for StderrLock<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("StderrLock { .. }")
}
}
@ -720,7 +720,7 @@ pub fn set_print(sink: Option<Box<dyn Write + Send>>) -> Option<Box<dyn Write +
///
/// However, if the actual I/O causes an error, this function does panic.
fn print_to<T>(
args: fmt::Arguments,
args: fmt::Arguments<'_>,
local_s: &'static LocalKey<RefCell<Option<Box<dyn Write+Send>>>>,
global_s: fn() -> T,
label: &str,
@ -749,7 +749,7 @@ where
issue = "0")]
#[doc(hidden)]
#[cfg(not(test))]
pub fn _print(args: fmt::Arguments) {
pub fn _print(args: fmt::Arguments<'_>) {
print_to(args, &LOCAL_STDOUT, stdout, "stdout");
}
@ -758,7 +758,7 @@ pub fn _print(args: fmt::Arguments) {
issue = "0")]
#[doc(hidden)]
#[cfg(not(test))]
pub fn _eprint(args: fmt::Arguments) {
pub fn _eprint(args: fmt::Arguments<'_>) {
print_to(args, &LOCAL_STDERR, stderr, "stderr");
}
@ -777,7 +777,7 @@ mod tests {
}
#[test]
fn stdoutlock_unwind_safe() {
assert_unwind_safe::<StdoutLock>();
assert_unwind_safe::<StdoutLock<'_>>();
assert_unwind_safe::<StdoutLock<'static>>();
}
#[test]
@ -786,7 +786,7 @@ mod tests {
}
#[test]
fn stderrlock_unwind_safe() {
assert_unwind_safe::<StderrLock>();
assert_unwind_safe::<StderrLock<'_>>();
assert_unwind_safe::<StderrLock<'static>>();
}

View file

@ -111,7 +111,7 @@ impl BufRead for Empty {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Empty {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Empty { .. }")
}
}
@ -169,7 +169,7 @@ impl Read for Repeat {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Repeat {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Repeat { .. }")
}
}
@ -217,7 +217,7 @@ impl Write for Sink {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Sink {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Sink { .. }")
}
}

View file

@ -211,7 +211,6 @@
#![deny(rust_2018_idioms)]
#![allow(explicit_outlives_requirements)]
#![allow(elided_lifetimes_in_paths)]
// Tell the compiler to link to either panic_abort or panic_unwind
#![needs_panic_runtime]

View file

@ -587,7 +587,7 @@ impl<'a> IntoInner<(*const c::sockaddr, c::socklen_t)> for &'a SocketAddr {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Display for SocketAddr {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
SocketAddr::V4(ref a) => a.fmt(f),
SocketAddr::V6(ref a) => a.fmt(f),
@ -597,28 +597,28 @@ impl fmt::Display for SocketAddr {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Display for SocketAddrV4 {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}:{}", self.ip(), self.port())
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for SocketAddrV4 {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(self, fmt)
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Display for SocketAddrV6 {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "[{}]:{}", self.ip(), self.port())
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for SocketAddrV6 {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(self, fmt)
}
}

View file

@ -658,7 +658,7 @@ impl Ipv4Addr {
#[stable(feature = "ip_addr", since = "1.7.0")]
impl fmt::Display for IpAddr {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
IpAddr::V4(ip) => ip.fmt(fmt),
IpAddr::V6(ip) => ip.fmt(fmt),
@ -682,7 +682,7 @@ impl From<Ipv6Addr> for IpAddr {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Display for Ipv4Addr {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
let octets = self.octets();
write!(fmt, "{}.{}.{}.{}", octets[0], octets[1], octets[2], octets[3])
}
@ -690,7 +690,7 @@ impl fmt::Display for Ipv4Addr {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for Ipv4Addr {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(self, fmt)
}
}
@ -1229,7 +1229,7 @@ impl Ipv6Addr {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Display for Ipv6Addr {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.segments() {
// We need special cases for :: and ::1, otherwise they're formatted
// as ::0.0.0.[01]
@ -1276,7 +1276,7 @@ impl fmt::Display for Ipv6Addr {
let (zeros_at, zeros_len) = find_zero_slice(&self.segments());
if zeros_len > 1 {
fn fmt_subslice(segments: &[u16], fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt_subslice(segments: &[u16], fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
if !segments.is_empty() {
write!(fmt, "{:x}", segments[0])?;
for &seg in &segments[1..] {
@ -1301,7 +1301,7 @@ impl fmt::Display for Ipv6Addr {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for Ipv6Addr {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(self, fmt)
}
}

View file

@ -28,7 +28,7 @@ impl<'a> Parser<'a> {
// Commit only if parser returns Some
fn read_atomically<T, F>(&mut self, cb: F) -> Option<T> where
F: FnOnce(&mut Parser) -> Option<T>,
F: FnOnce(&mut Parser<'_>) -> Option<T>,
{
let pos = self.pos;
let r = cb(self);
@ -40,7 +40,7 @@ impl<'a> Parser<'a> {
// Commit only if parser read till EOF
fn read_till_eof<T, F>(&mut self, cb: F) -> Option<T> where
F: FnOnce(&mut Parser) -> Option<T>,
F: FnOnce(&mut Parser<'_>) -> Option<T>,
{
self.read_atomically(move |p| {
cb(p).filter(|_| p.is_eof())
@ -48,10 +48,10 @@ impl<'a> Parser<'a> {
}
// Return result of first successful parser
fn read_or<T>(&mut self, parsers: &mut [Box<dyn FnMut(&mut Parser) -> Option<T> + 'static>])
fn read_or<T>(&mut self, parsers: &mut [Box<dyn FnMut(&mut Parser<'_>) -> Option<T> + 'static>])
-> Option<T> {
for pf in parsers {
if let Some(r) = self.read_atomically(|p: &mut Parser| pf(p)) {
if let Some(r) = self.read_atomically(|p: &mut Parser<'_>| pf(p)) {
return Some(r);
}
}
@ -64,9 +64,9 @@ impl<'a> Parser<'a> {
pb: PB,
pc: PC)
-> Option<(A, B, C)> where
PA: FnOnce(&mut Parser) -> Option<A>,
PB: FnOnce(&mut Parser) -> Option<B>,
PC: FnOnce(&mut Parser) -> Option<C>,
PA: FnOnce(&mut Parser<'_>) -> Option<A>,
PB: FnOnce(&mut Parser<'_>) -> Option<B>,
PC: FnOnce(&mut Parser<'_>) -> Option<C>,
{
self.read_atomically(move |p| {
let a = pa(p);
@ -177,7 +177,7 @@ impl<'a> Parser<'a> {
Ipv6Addr::new(gs[0], gs[1], gs[2], gs[3], gs[4], gs[5], gs[6], gs[7])
}
fn read_groups(p: &mut Parser, groups: &mut [u16; 8], limit: usize)
fn read_groups(p: &mut Parser<'_>, groups: &mut [u16; 8], limit: usize)
-> (usize, bool) {
let mut i = 0;
while i < limit {
@ -244,15 +244,15 @@ impl<'a> Parser<'a> {
}
fn read_ip_addr(&mut self) -> Option<IpAddr> {
let ipv4_addr = |p: &mut Parser| p.read_ipv4_addr().map(IpAddr::V4);
let ipv6_addr = |p: &mut Parser| p.read_ipv6_addr().map(IpAddr::V6);
let ipv4_addr = |p: &mut Parser<'_>| p.read_ipv4_addr().map(IpAddr::V4);
let ipv6_addr = |p: &mut Parser<'_>| p.read_ipv6_addr().map(IpAddr::V6);
self.read_or(&mut [Box::new(ipv4_addr), Box::new(ipv6_addr)])
}
fn read_socket_addr_v4(&mut self) -> Option<SocketAddrV4> {
let ip_addr = |p: &mut Parser| p.read_ipv4_addr();
let colon = |p: &mut Parser| p.read_given_char(':');
let port = |p: &mut Parser| {
let ip_addr = |p: &mut Parser<'_>| p.read_ipv4_addr();
let colon = |p: &mut Parser<'_>| p.read_given_char(':');
let port = |p: &mut Parser<'_>| {
p.read_number(10, 5, 0x10000).map(|n| n as u16)
};
@ -263,14 +263,14 @@ impl<'a> Parser<'a> {
}
fn read_socket_addr_v6(&mut self) -> Option<SocketAddrV6> {
let ip_addr = |p: &mut Parser| {
let open_br = |p: &mut Parser| p.read_given_char('[');
let ip_addr = |p: &mut Parser| p.read_ipv6_addr();
let clos_br = |p: &mut Parser| p.read_given_char(']');
let ip_addr = |p: &mut Parser<'_>| {
let open_br = |p: &mut Parser<'_>| p.read_given_char('[');
let ip_addr = |p: &mut Parser<'_>| p.read_ipv6_addr();
let clos_br = |p: &mut Parser<'_>| p.read_given_char(']');
p.read_seq_3(open_br, ip_addr, clos_br).map(|t| t.1)
};
let colon = |p: &mut Parser| p.read_given_char(':');
let port = |p: &mut Parser| {
let colon = |p: &mut Parser<'_>| p.read_given_char(':');
let port = |p: &mut Parser<'_>| {
p.read_number(10, 5, 0x10000).map(|n| n as u16)
};
@ -281,8 +281,8 @@ impl<'a> Parser<'a> {
}
fn read_socket_addr(&mut self) -> Option<SocketAddr> {
let v4 = |p: &mut Parser| p.read_socket_addr_v4().map(SocketAddr::V4);
let v6 = |p: &mut Parser| p.read_socket_addr_v6().map(SocketAddr::V6);
let v4 = |p: &mut Parser<'_>| p.read_socket_addr_v4().map(SocketAddr::V4);
let v6 = |p: &mut Parser<'_>| p.read_socket_addr_v6().map(SocketAddr::V6);
self.read_or(&mut [Box::new(v4), Box::new(v6)])
}
}
@ -391,7 +391,7 @@ pub struct AddrParseError(());
#[stable(feature = "addr_parse_error_error", since = "1.4.0")]
impl fmt::Display for AddrParseError {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.write_str(self.description())
}
}

View file

@ -626,7 +626,7 @@ impl IntoInner<net_imp::TcpStream> for TcpStream {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for TcpStream {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}
@ -771,7 +771,7 @@ impl TcpListener {
/// }
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn incoming(&self) -> Incoming {
pub fn incoming(&self) -> Incoming<'_> {
Incoming { listener: self }
}
@ -922,7 +922,7 @@ impl IntoInner<net_imp::TcpListener> for TcpListener {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for TcpListener {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}

View file

@ -832,7 +832,7 @@ impl IntoInner<net_imp::UdpSocket> for UdpSocket {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for UdpSocket {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}

View file

@ -312,7 +312,7 @@ impl<R, F: FnOnce() -> R> FnOnce<()> for AssertUnwindSafe<F> {
#[stable(feature = "std_debug", since = "1.16.0")]
impl<T: fmt::Debug> fmt::Debug for AssertUnwindSafe<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("AssertUnwindSafe")
.field(&self.0)
.finish()

View file

@ -51,7 +51,7 @@ extern {
#[derive(Copy, Clone)]
enum Hook {
Default,
Custom(*mut (dyn Fn(&PanicInfo) + 'static + Sync + Send)),
Custom(*mut (dyn Fn(&PanicInfo<'_>) + 'static + Sync + Send)),
}
static HOOK_LOCK: RWLock = RWLock::new();
@ -91,7 +91,7 @@ static mut HOOK: Hook = Hook::Default;
/// panic!("Normal panic");
/// ```
#[stable(feature = "panic_hooks", since = "1.10.0")]
pub fn set_hook(hook: Box<dyn Fn(&PanicInfo) + 'static + Sync + Send>) {
pub fn set_hook(hook: Box<dyn Fn(&PanicInfo<'_>) + 'static + Sync + Send>) {
if thread::panicking() {
panic!("cannot modify the panic hook from a panicking thread");
}
@ -136,7 +136,7 @@ pub fn set_hook(hook: Box<dyn Fn(&PanicInfo) + 'static + Sync + Send>) {
/// panic!("Normal panic");
/// ```
#[stable(feature = "panic_hooks", since = "1.10.0")]
pub fn take_hook() -> Box<dyn Fn(&PanicInfo) + 'static + Sync + Send> {
pub fn take_hook() -> Box<dyn Fn(&PanicInfo<'_>) + 'static + Sync + Send> {
if thread::panicking() {
panic!("cannot modify the panic hook from a panicking thread");
}
@ -154,7 +154,7 @@ pub fn take_hook() -> Box<dyn Fn(&PanicInfo) + 'static + Sync + Send> {
}
}
fn default_hook(info: &PanicInfo) {
fn default_hook(info: &PanicInfo<'_>) {
#[cfg(feature = "backtrace")]
use crate::sys_common::backtrace;
@ -304,7 +304,7 @@ pub fn panicking() -> bool {
#[cfg(not(test))]
#[panic_handler]
#[unwind(allowed)]
pub fn rust_begin_panic(info: &PanicInfo) -> ! {
pub fn rust_begin_panic(info: &PanicInfo<'_>) -> ! {
continue_panic_fmt(&info)
}
@ -322,7 +322,7 @@ pub fn rust_begin_panic(info: &PanicInfo) -> ! {
// otherwise avoid inlining because of it is cold path.
#[cfg_attr(not(feature="panic_immediate_abort"),inline(never))]
#[cfg_attr( feature="panic_immediate_abort" ,inline)]
pub fn begin_panic_fmt(msg: &fmt::Arguments,
pub fn begin_panic_fmt(msg: &fmt::Arguments<'_>,
file_line_col: &(&'static str, u32, u32)) -> ! {
if cfg!(feature = "panic_immediate_abort") {
unsafe { intrinsics::abort() }
@ -336,7 +336,7 @@ pub fn begin_panic_fmt(msg: &fmt::Arguments,
continue_panic_fmt(&info)
}
fn continue_panic_fmt(info: &PanicInfo) -> ! {
fn continue_panic_fmt(info: &PanicInfo<'_>) -> ! {
struct PanicPayload<'a> {
inner: &'a fmt::Arguments<'a>,
string: Option<String>,
@ -441,7 +441,7 @@ pub fn begin_panic<M: Any + Send>(msg: M, file_line_col: &(&'static str, u32, u3
/// panics, panic hooks, and finally dispatching to the panic runtime to either
/// abort or unwind.
fn rust_panic_with_hook(payload: &mut dyn BoxMeUp,
message: Option<&fmt::Arguments>,
message: Option<&fmt::Arguments<'_>>,
file_line_col: &(&str, u32, u32)) -> ! {
let (file, line, col) = *file_line_col;

View file

@ -323,7 +323,7 @@ fn has_redox_scheme(s: &[u8]) -> bool {
////////////////////////////////////////////////////////////////////////////////
/// Says whether the first byte after the prefix is a separator.
fn has_physical_root(s: &[u8], prefix: Option<Prefix>) -> bool {
fn has_physical_root(s: &[u8], prefix: Option<Prefix<'_>>) -> bool {
let path = if let Some(p) = prefix {
&s[p.len()..]
} else {
@ -630,11 +630,11 @@ pub struct Iter<'a> {
#[stable(feature = "path_components_debug", since = "1.13.0")]
impl fmt::Debug for Components<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
struct DebugHelper<'a>(&'a Path);
impl fmt::Debug for DebugHelper<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list()
.entries(self.0.components())
.finish()
@ -828,11 +828,11 @@ impl AsRef<OsStr> for Components<'_> {
#[stable(feature = "path_iter_debug", since = "1.13.0")]
impl fmt::Debug for Iter<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
struct DebugHelper<'a>(&'a Path);
impl fmt::Debug for DebugHelper<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_list()
.entries(self.0.iter())
.finish()
@ -1559,7 +1559,7 @@ impl<P: AsRef<Path>> iter::Extend<P> for PathBuf {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for PathBuf {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&**self, formatter)
}
}
@ -1857,7 +1857,7 @@ impl Path {
/// Had `path` contained invalid unicode, the `to_string_lossy` call might
/// have returned `"fo<66>.txt"`.
#[stable(feature = "rust1", since = "1.0.0")]
pub fn to_string_lossy(&self) -> Cow<str> {
pub fn to_string_lossy(&self) -> Cow<'_, str> {
self.inner.to_string_lossy()
}
@ -1926,7 +1926,7 @@ impl Path {
!self.is_absolute()
}
fn prefix(&self) -> Option<Prefix> {
fn prefix(&self) -> Option<Prefix<'_>> {
self.components().prefix
}
@ -2007,7 +2007,7 @@ impl Path {
/// [`None`]: ../../std/option/enum.Option.html#variant.None
/// [`parent`]: struct.Path.html#method.parent
#[stable(feature = "path_ancestors", since = "1.28.0")]
pub fn ancestors(&self) -> Ancestors {
pub fn ancestors(&self) -> Ancestors<'_> {
Ancestors {
next: Some(&self),
}
@ -2305,7 +2305,7 @@ impl Path {
/// [`Component`]: enum.Component.html
/// [`CurDir`]: enum.Component.html#variant.CurDir
#[stable(feature = "rust1", since = "1.0.0")]
pub fn components(&self) -> Components {
pub fn components(&self) -> Components<'_> {
let prefix = parse_prefix(self.as_os_str());
Components {
path: self.as_u8_slice(),
@ -2339,7 +2339,7 @@ impl Path {
/// assert_eq!(it.next(), None)
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter {
pub fn iter(&self) -> Iter<'_> {
Iter { inner: self.components() }
}
@ -2358,7 +2358,7 @@ impl Path {
/// println!("{}", path.display());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn display(&self) -> Display {
pub fn display(&self) -> Display<'_> {
Display { path: self }
}
@ -2578,7 +2578,7 @@ impl AsRef<OsStr> for Path {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for Path {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&self.inner, formatter)
}
}
@ -2610,14 +2610,14 @@ pub struct Display<'a> {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for Display<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&self.path, f)
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Display for Display<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.path.inner.display(f)
}
}
@ -2805,7 +2805,7 @@ impl_cmp_os_str!(Cow<'a, Path>, OsString);
#[stable(since = "1.7.0", feature = "strip_prefix")]
impl fmt::Display for StripPrefixError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.description().fmt(f)
}
}
@ -2915,7 +2915,7 @@ mod tests {
{
let path: &Path = &pathbuf;
let borrowed_cow_path: Cow<Path> = path.into();
let borrowed_cow_path: Cow<'_, Path> = path.into();
assert_eq!(static_cow_path, borrowed_cow_path);
}
@ -4013,8 +4013,8 @@ mod tests {
let mut owned: PathBuf = PathBuf::new();
owned.push("foo");
owned.push("bar");
let borrowed_cow: Cow<Path> = borrowed.into();
let owned_cow: Cow<Path> = owned.clone().into();
let borrowed_cow: Cow<'_, Path> = borrowed.into();
let owned_cow: Cow<'_, Path> = owned.clone().into();
macro_rules! t {
($($current:expr),+) => {

View file

@ -204,10 +204,10 @@ mod prim_bool { }
/// #![feature(never_type)]
/// # use std::fmt;
/// # trait Debug {
/// # fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result;
/// # fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result;
/// # }
/// impl Debug for ! {
/// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
/// fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
/// *self
/// }
/// }

View file

@ -194,7 +194,7 @@ impl IntoInner<imp::Process> for Child {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Child {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Child")
.field("stdin", &self.stdin)
.field("stdout", &self.stdout)
@ -246,7 +246,7 @@ impl FromInner<AnonPipe> for ChildStdin {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for ChildStdin {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("ChildStdin { .. }")
}
}
@ -293,7 +293,7 @@ impl FromInner<AnonPipe> for ChildStdout {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for ChildStdout {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("ChildStdout { .. }")
}
}
@ -340,7 +340,7 @@ impl FromInner<AnonPipe> for ChildStderr {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for ChildStderr {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("ChildStderr { .. }")
}
}
@ -803,7 +803,7 @@ impl fmt::Debug for Command {
/// Format the program and arguments of a Command for display. Any
/// non-utf8 data is lossily converted using the utf8 replacement
/// character.
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.inner.fmt(f)
}
}
@ -844,7 +844,7 @@ pub struct Output {
// strings, otherwise it prints the byte sequence instead
#[stable(feature = "process_output_debug", since = "1.7.0")]
impl fmt::Debug for Output {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
let stdout_utf8 = str::from_utf8(&self.stdout);
let stdout_debug: &dyn fmt::Debug = match stdout_utf8 {
@ -1002,7 +1002,7 @@ impl FromInner<imp::Stdio> for Stdio {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Stdio {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Stdio { .. }")
}
}
@ -1199,7 +1199,7 @@ impl FromInner<imp::ExitStatus> for ExitStatus {
#[stable(feature = "process", since = "1.0.0")]
impl fmt::Display for ExitStatus {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}

View file

@ -59,7 +59,7 @@ pub struct BarrierWaitResult(bool);
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Barrier {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Barrier { .. }")
}
}
@ -151,7 +151,7 @@ impl Barrier {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for BarrierWaitResult {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("BarrierWaitResult")
.field("is_leader", &self.is_leader())
.finish()

View file

@ -589,7 +589,7 @@ impl Condvar {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Condvar {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Condvar { .. }")
}
}

View file

@ -914,7 +914,7 @@ impl<T> Drop for Sender<T> {
#[stable(feature = "mpsc_debug", since = "1.8.0")]
impl<T> fmt::Debug for Sender<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Sender").finish()
}
}
@ -1044,7 +1044,7 @@ impl<T> Drop for SyncSender<T> {
#[stable(feature = "mpsc_debug", since = "1.8.0")]
impl<T> fmt::Debug for SyncSender<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("SyncSender").finish()
}
}
@ -1463,7 +1463,7 @@ impl<T> Receiver<T> {
/// assert_eq!(iter.next(), None);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter<T> {
pub fn iter(&self) -> Iter<'_, T> {
Iter { rx: self }
}
@ -1506,7 +1506,7 @@ impl<T> Receiver<T> {
/// assert_eq!(iter.next(), None);
/// ```
#[stable(feature = "receiver_try_iter", since = "1.15.0")]
pub fn try_iter(&self) -> TryIter<T> {
pub fn try_iter(&self) -> TryIter<'_, T> {
TryIter { rx: self }
}
@ -1636,21 +1636,21 @@ impl<T> Drop for Receiver<T> {
#[stable(feature = "mpsc_debug", since = "1.8.0")]
impl<T> fmt::Debug for Receiver<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Receiver").finish()
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> fmt::Debug for SendError<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
"SendError(..)".fmt(f)
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> fmt::Display for SendError<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
"sending on a closed channel".fmt(f)
}
}
@ -1668,7 +1668,7 @@ impl<T: Send> error::Error for SendError<T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> fmt::Debug for TrySendError<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
TrySendError::Full(..) => "Full(..)".fmt(f),
TrySendError::Disconnected(..) => "Disconnected(..)".fmt(f),
@ -1678,7 +1678,7 @@ impl<T> fmt::Debug for TrySendError<T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> fmt::Display for TrySendError<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
TrySendError::Full(..) => {
"sending on a full channel".fmt(f)
@ -1720,7 +1720,7 @@ impl<T> From<SendError<T>> for TrySendError<T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Display for RecvError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
"receiving on a closed channel".fmt(f)
}
}
@ -1739,7 +1739,7 @@ impl error::Error for RecvError {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Display for TryRecvError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
TryRecvError::Empty => {
"receiving on an empty channel".fmt(f)
@ -1781,7 +1781,7 @@ impl From<RecvError> for TryRecvError {
#[stable(feature = "mpsc_recv_timeout_error", since = "1.15.0")]
impl fmt::Display for RecvTimeoutError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
RecvTimeoutError::Timeout => {
"timed out waiting on channel".fmt(f)

View file

@ -340,13 +340,13 @@ impl Iterator for Packets {
}
impl fmt::Debug for Select {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Select").finish()
}
}
impl<T: Send> fmt::Debug for Handle<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Handle").finish()
}
}

View file

@ -78,7 +78,7 @@ impl<T> Packet<T> {
// In other case mutex data will be duplicated while cloning
// and that could cause problems on platforms where it is
// represented by opaque data structure
pub fn postinit_lock(&self) -> MutexGuard<()> {
pub fn postinit_lock(&self) -> MutexGuard<'_, ()> {
self.select_lock.lock().unwrap()
}
@ -89,7 +89,7 @@ impl<T> Packet<T> {
// This can only be called at channel-creation time
pub fn inherit_blocker(&self,
token: Option<SignalToken>,
guard: MutexGuard<()>) {
guard: MutexGuard<'_, ()>) {
token.map(|token| {
assert_eq!(self.cnt.load(Ordering::SeqCst), 0);
assert_eq!(self.to_wake.load(Ordering::SeqCst), 0);

View file

@ -153,7 +153,7 @@ fn abort_selection<'a, T>(guard: &mut MutexGuard<'a , State<T>>) -> bool {
}
/// Wakes up a thread, dropping the lock at the correct time
fn wakeup<T>(token: SignalToken, guard: MutexGuard<State<T>>) {
fn wakeup<T>(token: SignalToken, guard: MutexGuard<'_, State<T>>) {
// We need to be careful to wake up the waiting thread *outside* of the mutex
// in case it incurs a context switch.
drop(guard);
@ -184,7 +184,7 @@ impl<T> Packet<T> {
// wait until a send slot is available, returning locked access to
// the channel state.
fn acquire_send_slot(&self) -> MutexGuard<State<T>> {
fn acquire_send_slot(&self) -> MutexGuard<'_, State<T>> {
let mut node = Node { token: None, next: ptr::null_mut() };
loop {
let mut guard = self.lock.lock().unwrap();
@ -316,7 +316,7 @@ impl<T> Packet<T> {
// * `waited` - flag if the receiver blocked to receive some data, or if it
// just picked up some data on the way out
// * `guard` - the lock guard that is held over this channel's lock
fn wakeup_senders(&self, waited: bool, mut guard: MutexGuard<State<T>>) {
fn wakeup_senders(&self, waited: bool, mut guard: MutexGuard<'_, State<T>>) {
let pending_sender1: Option<SignalToken> = guard.queue.dequeue();
// If this is a no-buffer channel (cap == 0), then if we didn't wait we

View file

@ -215,7 +215,7 @@ impl<T: ?Sized> Mutex<T> {
/// assert_eq!(*mutex.lock().unwrap(), 10);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn lock(&self) -> LockResult<MutexGuard<T>> {
pub fn lock(&self) -> LockResult<MutexGuard<'_, T>> {
unsafe {
self.inner.raw_lock();
MutexGuard::new(self)
@ -258,7 +258,7 @@ impl<T: ?Sized> Mutex<T> {
/// assert_eq!(*mutex.lock().unwrap(), 10);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn try_lock(&self) -> TryLockResult<MutexGuard<T>> {
pub fn try_lock(&self) -> TryLockResult<MutexGuard<'_, T>> {
unsafe {
if self.inner.try_lock() {
Ok(MutexGuard::new(self)?)
@ -391,7 +391,7 @@ impl<T: ?Sized + Default> Default for Mutex<T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized + fmt::Debug> fmt::Debug for Mutex<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.try_lock() {
Ok(guard) => f.debug_struct("Mutex").field("data", &&*guard).finish(),
Err(TryLockError::Poisoned(err)) => {
@ -400,7 +400,9 @@ impl<T: ?Sized + fmt::Debug> fmt::Debug for Mutex<T> {
Err(TryLockError::WouldBlock) => {
struct LockedPlaceholder;
impl fmt::Debug for LockedPlaceholder {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("<locked>") }
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("<locked>")
}
}
f.debug_struct("Mutex").field("data", &LockedPlaceholder).finish()
@ -449,14 +451,14 @@ impl<T: ?Sized> Drop for MutexGuard<'_, T> {
#[stable(feature = "std_debug", since = "1.16.0")]
impl<T: ?Sized + fmt::Debug> fmt::Debug for MutexGuard<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&**self, f)
}
}
#[stable(feature = "std_guard_impls", since = "1.20.0")]
impl<T: ?Sized + fmt::Display> fmt::Display for MutexGuard<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
(**self).fmt(f)
}
}

View file

@ -431,7 +431,7 @@ impl Once {
#[stable(feature = "std_debug", since = "1.16.0")]
impl fmt::Debug for Once {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Once { .. }")
}
}

View file

@ -180,7 +180,7 @@ impl<T: ?Sized> RwLock<T> {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn read(&self) -> LockResult<RwLockReadGuard<T>> {
pub fn read(&self) -> LockResult<RwLockReadGuard<'_, T>> {
unsafe {
self.inner.read();
RwLockReadGuard::new(self)
@ -219,7 +219,7 @@ impl<T: ?Sized> RwLock<T> {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn try_read(&self) -> TryLockResult<RwLockReadGuard<T>> {
pub fn try_read(&self) -> TryLockResult<RwLockReadGuard<'_, T>> {
unsafe {
if self.inner.try_read() {
Ok(RwLockReadGuard::new(self)?)
@ -262,7 +262,7 @@ impl<T: ?Sized> RwLock<T> {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn write(&self) -> LockResult<RwLockWriteGuard<T>> {
pub fn write(&self) -> LockResult<RwLockWriteGuard<'_, T>> {
unsafe {
self.inner.write();
RwLockWriteGuard::new(self)
@ -301,7 +301,7 @@ impl<T: ?Sized> RwLock<T> {
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn try_write(&self) -> TryLockResult<RwLockWriteGuard<T>> {
pub fn try_write(&self) -> TryLockResult<RwLockWriteGuard<'_, T>> {
unsafe {
if self.inner.try_write() {
Ok(RwLockWriteGuard::new(self)?)
@ -421,7 +421,7 @@ unsafe impl<#[may_dangle] T: ?Sized> Drop for RwLock<T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized + fmt::Debug> fmt::Debug for RwLock<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.try_read() {
Ok(guard) => f.debug_struct("RwLock").field("data", &&*guard).finish(),
Err(TryLockError::Poisoned(err)) => {
@ -430,7 +430,9 @@ impl<T: ?Sized + fmt::Debug> fmt::Debug for RwLock<T> {
Err(TryLockError::WouldBlock) => {
struct LockedPlaceholder;
impl fmt::Debug for LockedPlaceholder {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("<locked>") }
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("<locked>")
}
}
f.debug_struct("RwLock").field("data", &LockedPlaceholder).finish()
@ -481,7 +483,7 @@ impl<'rwlock, T: ?Sized> RwLockWriteGuard<'rwlock, T> {
#[stable(feature = "std_debug", since = "1.16.0")]
impl<T: fmt::Debug> fmt::Debug for RwLockReadGuard<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("RwLockReadGuard")
.field("lock", &self.__lock)
.finish()
@ -490,14 +492,14 @@ impl<T: fmt::Debug> fmt::Debug for RwLockReadGuard<'_, T> {
#[stable(feature = "std_guard_impls", since = "1.20.0")]
impl<T: ?Sized + fmt::Display> fmt::Display for RwLockReadGuard<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
(**self).fmt(f)
}
}
#[stable(feature = "std_debug", since = "1.16.0")]
impl<T: fmt::Debug> fmt::Debug for RwLockWriteGuard<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("RwLockWriteGuard")
.field("lock", &self.__lock)
.finish()
@ -506,7 +508,7 @@ impl<T: fmt::Debug> fmt::Debug for RwLockWriteGuard<'_, T> {
#[stable(feature = "std_guard_impls", since = "1.20.0")]
impl<T: ?Sized + fmt::Display> fmt::Display for RwLockWriteGuard<'_, T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
(**self).fmt(f)
}
}

View file

@ -24,7 +24,7 @@ impl Error for UnwindError {
}
impl fmt::Display for UnwindError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}: {:?}", self.description(), self.0)
}
}
@ -33,8 +33,9 @@ impl fmt::Display for UnwindError {
// tracing
pub fn unwind_backtrace(frames: &mut [Frame]) -> io::Result<(usize, BacktraceContext)> {
let mut cx = Context { idx: 0, frames };
let result_unwind =
unsafe { uw::_Unwind_Backtrace(trace_fn, &mut cx as *mut Context as *mut libc::c_void) };
let result_unwind = unsafe {
uw::_Unwind_Backtrace(trace_fn, &mut cx as *mut Context<'_> as *mut libc::c_void)
};
// See libunwind:src/unwind/Backtrace.c for the return values.
// No, there is no doc.
match result_unwind {
@ -54,7 +55,7 @@ extern "C" fn trace_fn(
ctx: *mut uw::_Unwind_Context,
arg: *mut libc::c_void,
) -> uw::_Unwind_Reason_Code {
let cx = unsafe { &mut *(arg as *mut Context) };
let cx = unsafe { &mut *(arg as *mut Context<'_>) };
if cx.idx >= cx.frames.len() {
return uw::_URC_NORMAL_STOP;
}

View file

@ -81,7 +81,7 @@ impl PartialEq for FilePermissions {
impl Eq for FilePermissions {}
impl fmt::Debug for FilePermissions {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}
@ -123,13 +123,13 @@ impl Hash for FileType {
}
impl fmt::Debug for FileType {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}
impl fmt::Debug for ReadDir {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}
@ -234,7 +234,7 @@ impl DirBuilder {
}
impl fmt::Debug for File {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}

View file

@ -97,7 +97,7 @@ impl TcpStream {
}
impl fmt::Debug for TcpStream {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}
@ -147,7 +147,7 @@ impl TcpListener {
}
impl fmt::Debug for TcpListener {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}
@ -281,7 +281,7 @@ impl UdpSocket {
}
impl fmt::Debug for UdpSocket {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}

View file

@ -34,7 +34,7 @@ pub fn unsetenv(_: &OsStr) -> io::Result<()> {
pub struct SplitPaths<'a>(&'a Void);
pub fn split_paths(_unparsed: &OsStr) -> SplitPaths {
pub fn split_paths(_unparsed: &OsStr) -> SplitPaths<'_> {
panic!("unsupported")
}
@ -57,7 +57,7 @@ where
}
impl fmt::Display for JoinPathsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
"not supported on CloudABI yet".fmt(f)
}
}

View file

@ -71,7 +71,7 @@ impl From<File> for Stdio {
}
impl fmt::Debug for Command {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
Ok(())
}
}
@ -105,13 +105,13 @@ impl PartialEq for ExitStatus {
impl Eq for ExitStatus {}
impl fmt::Debug for ExitStatus {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}
impl fmt::Display for ExitStatus {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}

View file

@ -21,7 +21,7 @@ impl Error for UnwindError {
}
impl fmt::Display for UnwindError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}: {:?}", self.description(), self.0)
}
}
@ -37,7 +37,7 @@ pub fn unwind_backtrace(frames: &mut [Frame])
};
let result_unwind = unsafe {
uw::_Unwind_Backtrace(trace_fn,
&mut cx as *mut Context
&mut cx as *mut Context<'_>
as *mut libc::c_void)
};
// See libunwind:src/unwind/Backtrace.c for the return values.
@ -57,7 +57,7 @@ pub fn unwind_backtrace(frames: &mut [Frame])
extern fn trace_fn(ctx: *mut uw::_Unwind_Context,
arg: *mut libc::c_void) -> uw::_Unwind_Reason_Code {
let cx = unsafe { &mut *(arg as *mut Context) };
let cx = unsafe { &mut *(arg as *mut Context<'_>) };
if cx.idx >= cx.frames.len() {
return uw::_URC_NORMAL_STOP;
}

View file

@ -90,7 +90,7 @@ impl SocketAddr {
}
#[stable(feature = "unix_socket_redox", since = "1.29")]
impl fmt::Debug for SocketAddr {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "SocketAddr")
}
}
@ -114,7 +114,7 @@ pub struct UnixStream(FileDesc);
#[stable(feature = "unix_socket_redox", since = "1.29")]
impl fmt::Debug for UnixStream {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut builder = fmt.debug_struct("UnixStream");
builder.field("fd", &self.0.raw());
if let Ok(addr) = self.local_addr() {
@ -503,7 +503,7 @@ pub struct UnixListener(FileDesc);
#[stable(feature = "unix_socket_redox", since = "1.29")]
impl fmt::Debug for UnixListener {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut builder = fmt.debug_struct("UnixListener");
builder.field("fd", &self.0.raw());
if let Ok(addr) = self.local_addr() {

View file

@ -123,7 +123,7 @@ impl FromInner<u32> for FilePermissions {
}
impl fmt::Debug for ReadDir {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// This will only be called from std::fs::ReadDir, which will add a "ReadDir()" frame.
// Thus the result will be e g 'ReadDir("/home")'
fmt::Debug::fmt(&*self.root, f)
@ -341,7 +341,7 @@ impl FromInner<usize> for File {
}
impl fmt::Debug for File {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut b = f.debug_struct("File");
b.field("fd", &self.0.raw());
if let Ok(path) = self.path() {

View file

@ -58,7 +58,7 @@ pub struct SplitPaths<'a> {
fn(&'a [u8]) -> PathBuf>,
}
pub fn split_paths(unparsed: &OsStr) -> SplitPaths {
pub fn split_paths(unparsed: &OsStr) -> SplitPaths<'_> {
fn bytes_to_path(b: &[u8]) -> PathBuf {
PathBuf::from(<OsStr as OsStrExt>::from_bytes(b))
}
@ -97,7 +97,7 @@ pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError>
}
impl fmt::Display for JoinPathsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
"path segment contains separator `:`".fmt(f)
}
}

View file

@ -11,7 +11,7 @@ pub fn is_verbatim_sep(b: u8) -> bool {
b == b'/'
}
pub fn parse_prefix(path: &OsStr) -> Option<Prefix> {
pub fn parse_prefix(path: &OsStr) -> Option<Prefix<'_>> {
if let Some(path_str) = path.to_str() {
if let Some(_i) = path_str.find(':') {
// FIXME: Redox specific prefix

View file

@ -492,7 +492,7 @@ impl ChildStdio {
}
impl fmt::Debug for Command {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:?}", self.program)?;
for arg in &self.args {
write!(f, " {:?}", arg)?;
@ -542,7 +542,7 @@ impl From<i32> for ExitStatus {
}
impl fmt::Display for ExitStatus {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if let Some(code) = self.code() {
write!(f, "exit code: {}", code)
} else {

View file

@ -38,13 +38,13 @@ impl Error {
}
impl fmt::Debug for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.text())
}
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.text())
}
}

View file

@ -151,7 +151,7 @@ impl Instant {
}
impl fmt::Debug for Instant {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Instant")
.field("tv_sec", &self.t.t.tv_sec)
.field("tv_nsec", &self.t.t.tv_nsec)
@ -185,7 +185,7 @@ impl From<syscall::TimeSpec> for SystemTime {
}
impl fmt::Debug for SystemTime {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("SystemTime")
.field("tv_sec", &self.t.t.tv_sec)
.field("tv_nsec", &self.t.t.tv_nsec)

View file

@ -84,7 +84,7 @@ impl Tls {
Tls { data: dup!((* * * * * * *) (Cell::new(ptr::null_mut()))) }
}
pub unsafe fn activate(&self) -> ActiveTls {
pub unsafe fn activate(&self) -> ActiveTls<'_> {
set_tls_ptr(self as *const Tls as _);
ActiveTls { tls: self }
}
@ -141,7 +141,7 @@ mod sync_bitset {
}
/// Not atomic.
pub fn iter(&self) -> SyncBitsetIter {
pub fn iter(&self) -> SyncBitsetIter<'_> {
SyncBitsetIter {
iter: self.0.iter().enumerate().peekable(),
elem_idx: 0,

View file

@ -429,7 +429,7 @@ impl<T> UserRef<[T]> where [T]: UserSafe {
}
/// Returns an iterator over the slice.
pub fn iter(&self) -> Iter<T>
pub fn iter(&self) -> Iter<'_, T>
where T: UserSafe // FIXME: should be implied by [T]: UserSafe?
{
unsafe {
@ -438,7 +438,7 @@ impl<T> UserRef<[T]> where [T]: UserSafe {
}
/// Returns an iterator that allows modifying each value.
pub fn iter_mut(&mut self) -> IterMut<T>
pub fn iter_mut(&mut self) -> IterMut<'_, T>
where T: UserSafe // FIXME: should be implied by [T]: UserSafe?
{
unsafe {

View file

@ -23,7 +23,7 @@ impl Error for UnwindError {
}
impl fmt::Display for UnwindError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}: {:?}", self.description(), self.0)
}
}
@ -31,8 +31,9 @@ impl fmt::Display for UnwindError {
#[inline(never)] // this function call can be skipped it when tracing.
pub fn unwind_backtrace(frames: &mut [Frame]) -> io::Result<(usize, BacktraceContext)> {
let mut cx = Context { idx: 0, frames };
let result_unwind =
unsafe { uw::_Unwind_Backtrace(trace_fn, &mut cx as *mut Context as *mut libc::c_void) };
let result_unwind = unsafe {
uw::_Unwind_Backtrace(trace_fn, &mut cx as *mut Context<'_> as *mut libc::c_void)
};
// See libunwind:src/unwind/Backtrace.c for the return values.
// No, there is no doc.
let res = match result_unwind {
@ -53,7 +54,7 @@ extern "C" fn trace_fn(
ctx: *mut uw::_Unwind_Context,
arg: *mut libc::c_void,
) -> uw::_Unwind_Reason_Code {
let cx = unsafe { &mut *(arg as *mut Context) };
let cx = unsafe { &mut *(arg as *mut Context<'_>) };
if cx.idx >= cx.frames.len() {
return uw::_URC_NORMAL_STOP;
}

View file

@ -82,7 +82,7 @@ impl Eq for FilePermissions {
}
impl fmt::Debug for FilePermissions {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}
@ -125,13 +125,13 @@ impl Hash for FileType {
}
impl fmt::Debug for FileType {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}
impl fmt::Debug for ReadDir {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}
@ -236,7 +236,7 @@ impl DirBuilder {
}
impl fmt::Debug for File {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}

View file

@ -48,7 +48,7 @@ pub struct TcpStream {
}
impl fmt::Debug for TcpStream {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut res = f.debug_struct("TcpStream");
if let Some(ref addr) = self.inner.local_addr {
@ -213,7 +213,7 @@ pub struct TcpListener {
}
impl fmt::Debug for TcpListener {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut res = f.debug_struct("TcpListener");
if let Some(ref addr) = self.inner.local_addr {
@ -421,7 +421,7 @@ impl UdpSocket {
}
impl fmt::Debug for UdpSocket {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}
@ -438,7 +438,7 @@ impl error::Error for NonIpSockAddr {
}
impl fmt::Display for NonIpSockAddr {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "Failed to convert address to SocketAddr: {}", self.host)
}
}

View file

@ -37,7 +37,7 @@ pub fn chdir(_: &path::Path) -> io::Result<()> {
pub struct SplitPaths<'a>(&'a Void);
pub fn split_paths(_unparsed: &OsStr) -> SplitPaths {
pub fn split_paths(_unparsed: &OsStr) -> SplitPaths<'_> {
panic!("unsupported")
}
@ -58,7 +58,7 @@ pub fn join_paths<I, T>(_paths: I) -> Result<OsString, JoinPathsError>
}
impl fmt::Display for JoinPathsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
"not supported in SGX yet".fmt(f)
}
}

View file

@ -11,7 +11,7 @@ pub fn is_verbatim_sep(b: u8) -> bool {
b == b'/'
}
pub fn parse_prefix(_: &OsStr) -> Option<Prefix> {
pub fn parse_prefix(_: &OsStr) -> Option<Prefix<'_>> {
None
}

View file

@ -73,7 +73,7 @@ impl From<File> for Stdio {
}
impl fmt::Debug for Command {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
Ok(())
}
}
@ -108,13 +108,13 @@ impl Eq for ExitStatus {
}
impl fmt::Debug for ExitStatus {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}
impl fmt::Display for ExitStatus {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}

View file

@ -93,8 +93,8 @@ impl RWLock {
#[inline]
unsafe fn __read_unlock(
&self,
mut rguard: SpinMutexGuard<WaitVariable<Option<NonZeroUsize>>>,
wguard: SpinMutexGuard<WaitVariable<bool>>,
mut rguard: SpinMutexGuard<'_, WaitVariable<Option<NonZeroUsize>>>,
wguard: SpinMutexGuard<'_, WaitVariable<bool>>,
) {
*rguard.lock_var_mut() = NonZeroUsize::new(rguard.lock_var().unwrap().get() - 1);
if rguard.lock_var().is_some() {
@ -120,8 +120,8 @@ impl RWLock {
#[inline]
unsafe fn __write_unlock(
&self,
rguard: SpinMutexGuard<WaitVariable<Option<NonZeroUsize>>>,
wguard: SpinMutexGuard<WaitVariable<bool>>,
rguard: SpinMutexGuard<'_, WaitVariable<Option<NonZeroUsize>>>,
wguard: SpinMutexGuard<'_, WaitVariable<bool>>,
) {
if let Err(mut wguard) = WaitQueue::notify_one(wguard) {
// No writers waiting, release the write lock

View file

@ -140,7 +140,7 @@ impl WaitQueue {
/// until a wakeup event.
///
/// This function does not return until this thread has been awoken.
pub fn wait<T>(mut guard: SpinMutexGuard<WaitVariable<T>>) {
pub fn wait<T>(mut guard: SpinMutexGuard<'_, WaitVariable<T>>) {
unsafe {
let mut entry = UnsafeListEntry::new(SpinMutex::new(WaitEntry {
tcs: thread::current(),
@ -162,8 +162,8 @@ impl WaitQueue {
///
/// If a waiter is found, a `WaitGuard` is returned which will notify the
/// waiter when it is dropped.
pub fn notify_one<T>(mut guard: SpinMutexGuard<WaitVariable<T>>)
-> Result<WaitGuard<T>, SpinMutexGuard<WaitVariable<T>>>
pub fn notify_one<T>(mut guard: SpinMutexGuard<'_, WaitVariable<T>>)
-> Result<WaitGuard<'_, T>, SpinMutexGuard<'_, WaitVariable<T>>>
{
unsafe {
if let Some(entry) = guard.queue.inner.pop() {
@ -186,8 +186,8 @@ impl WaitQueue {
///
/// If at least one waiter is found, a `WaitGuard` is returned which will
/// notify all waiters when it is dropped.
pub fn notify_all<T>(mut guard: SpinMutexGuard<WaitVariable<T>>)
-> Result<WaitGuard<T>, SpinMutexGuard<WaitVariable<T>>>
pub fn notify_all<T>(mut guard: SpinMutexGuard<'_, WaitVariable<T>>)
-> Result<WaitGuard<'_, T>, SpinMutexGuard<'_, WaitVariable<T>>>
{
unsafe {
let mut count = 0;
@ -433,7 +433,7 @@ mod spin_mutex {
}
#[inline(always)]
pub fn lock(&self) -> SpinMutexGuard<T> {
pub fn lock(&self) -> SpinMutexGuard<'_, T> {
loop {
match self.try_lock() {
None => while self.lock.load(Ordering::Relaxed) {
@ -445,7 +445,7 @@ mod spin_mutex {
}
#[inline(always)]
pub fn try_lock(&self) -> Option<SpinMutexGuard<T>> {
pub fn try_lock(&self) -> Option<SpinMutexGuard<'_, T>> {
if !self.lock.compare_and_swap(false, true, Ordering::Acquire) {
Some(SpinMutexGuard {
mutex: self,

View file

@ -21,7 +21,7 @@ impl Error for UnwindError {
}
impl fmt::Display for UnwindError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}: {:?}", self.description(), self.0)
}
}
@ -37,7 +37,7 @@ pub fn unwind_backtrace(frames: &mut [Frame])
};
let result_unwind = unsafe {
uw::_Unwind_Backtrace(trace_fn,
&mut cx as *mut Context
&mut cx as *mut Context<'_>
as *mut libc::c_void)
};
// See libunwind:src/unwind/Backtrace.c for the return values.
@ -57,7 +57,7 @@ pub fn unwind_backtrace(frames: &mut [Frame])
extern fn trace_fn(ctx: *mut uw::_Unwind_Context,
arg: *mut libc::c_void) -> uw::_Unwind_Reason_Code {
let cx = unsafe { &mut *(arg as *mut Context) };
let cx = unsafe { &mut *(arg as *mut Context<'_>) };
if cx.idx >= cx.frames.len() {
return uw::_URC_NORMAL_STOP;
}

View file

@ -219,7 +219,7 @@ impl SocketAddr {
#[stable(feature = "unix_socket", since = "1.10.0")]
impl fmt::Debug for SocketAddr {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.address() {
AddressKind::Unnamed => write!(fmt, "(unnamed)"),
AddressKind::Abstract(name) => write!(fmt, "{} (abstract)", AsciiEscaped(name)),
@ -231,7 +231,7 @@ impl fmt::Debug for SocketAddr {
struct AsciiEscaped<'a>(&'a [u8]);
impl<'a> fmt::Display for AsciiEscaped<'a> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "\"")?;
for byte in self.0.iter().cloned().flat_map(ascii::escape_default) {
write!(fmt, "{}", byte as char)?;
@ -259,7 +259,7 @@ pub struct UnixStream(Socket);
#[stable(feature = "unix_socket", since = "1.10.0")]
impl fmt::Debug for UnixStream {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut builder = fmt.debug_struct("UnixStream");
builder.field("fd", self.0.as_inner());
if let Ok(addr) = self.local_addr() {
@ -719,7 +719,7 @@ pub struct UnixListener(Socket);
#[stable(feature = "unix_socket", since = "1.10.0")]
impl fmt::Debug for UnixListener {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut builder = fmt.debug_struct("UnixListener");
builder.field("fd", self.0.as_inner());
if let Ok(addr) = self.local_addr() {
@ -998,7 +998,7 @@ pub struct UnixDatagram(Socket);
#[stable(feature = "unix_socket", since = "1.10.0")]
impl fmt::Debug for UnixDatagram {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut builder = fmt.debug_struct("UnixDatagram");
builder.field("fd", self.0.as_inner());
if let Ok(addr) = self.local_addr() {

View file

@ -206,7 +206,7 @@ impl FromInner<u32> for FilePermissions {
}
impl fmt::Debug for ReadDir {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// This will only be called from std::fs::ReadDir, which will add a "ReadDir()" frame.
// Thus the result will be e g 'ReadDir("/home")'
fmt::Debug::fmt(&*self.inner.root, f)
@ -627,7 +627,7 @@ impl FromInner<c_int> for File {
}
impl fmt::Debug for File {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
#[cfg(target_os = "linux")]
fn get_path(fd: c_int) -> Option<PathBuf> {
let mut p = PathBuf::from("/proc/self/fd");

View file

@ -212,7 +212,7 @@ pub mod net {
}
impl fmt::Debug for TcpStream {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "No networking support available on L4Re")
}
}
@ -274,7 +274,7 @@ pub mod net {
}
impl fmt::Debug for TcpListener {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "No networking support available on L4Re.")
}
}
@ -424,7 +424,7 @@ pub mod net {
}
impl fmt::Debug for UdpSocket {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "No networking support on L4Re available.")
}
}

View file

@ -152,7 +152,7 @@ pub struct SplitPaths<'a> {
fn(&'a [u8]) -> PathBuf>,
}
pub fn split_paths(unparsed: &OsStr) -> SplitPaths {
pub fn split_paths(unparsed: &OsStr) -> SplitPaths<'_> {
fn bytes_to_path(b: &[u8]) -> PathBuf {
PathBuf::from(<OsStr as OsStrExt>::from_bytes(b))
}
@ -191,7 +191,7 @@ pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError>
}
impl fmt::Display for JoinPathsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
"path segment contains separator `:`".fmt(f)
}
}

View file

@ -11,7 +11,7 @@ pub fn is_verbatim_sep(b: u8) -> bool {
b == b'/'
}
pub fn parse_prefix(_: &OsStr) -> Option<Prefix> {
pub fn parse_prefix(_: &OsStr) -> Option<Prefix<'_>> {
None
}

View file

@ -330,7 +330,7 @@ impl ChildStdio {
}
impl fmt::Debug for Command {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:?}", self.program)?;
for arg in &self.args {
write!(f, " {:?}", arg)?;
@ -380,7 +380,7 @@ impl From<c_int> for ExitStatus {
}
impl fmt::Display for ExitStatus {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if let Some(code) = self.code() {
write!(f, "exit code: {}", code)
} else {

View file

@ -213,7 +213,7 @@ mod inner {
}
impl fmt::Debug for SystemTime {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("SystemTime")
.field("tv_sec", &self.t.t.tv_sec)
.field("tv_nsec", &self.t.t.tv_nsec)
@ -298,7 +298,7 @@ mod inner {
}
impl fmt::Debug for Instant {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Instant")
.field("tv_sec", &self.t.t.tv_sec)
.field("tv_nsec", &self.t.t.tv_nsec)
@ -332,7 +332,7 @@ mod inner {
}
impl fmt::Debug for SystemTime {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("SystemTime")
.field("tv_sec", &self.t.t.tv_sec)
.field("tv_nsec", &self.t.t.tv_nsec)

View file

@ -23,25 +23,25 @@ pub type RiFlags = u16;
pub type RoFlags = u16;
pub type SiFlags = u16;
fn iovec(a: &mut [IoVecMut]) -> (*const libc::__wasi_iovec_t, usize) {
fn iovec(a: &mut [IoVecMut<'_>]) -> (*const libc::__wasi_iovec_t, usize) {
assert_eq!(
mem::size_of::<IoVecMut>(),
mem::size_of::<IoVecMut<'_>>(),
mem::size_of::<libc::__wasi_iovec_t>()
);
assert_eq!(
mem::align_of::<IoVecMut>(),
mem::align_of::<IoVecMut<'_>>(),
mem::align_of::<libc::__wasi_iovec_t>()
);
(a.as_ptr() as *const libc::__wasi_iovec_t, a.len())
}
fn ciovec(a: &[IoVec]) -> (*const libc::__wasi_ciovec_t, usize) {
fn ciovec(a: &[IoVec<'_>]) -> (*const libc::__wasi_ciovec_t, usize) {
assert_eq!(
mem::size_of::<IoVec>(),
mem::size_of::<IoVec<'_>>(),
mem::size_of::<libc::__wasi_ciovec_t>()
);
assert_eq!(
mem::align_of::<IoVec>(),
mem::align_of::<IoVec<'_>>(),
mem::align_of::<libc::__wasi_ciovec_t>()
);
(a.as_ptr() as *const libc::__wasi_ciovec_t, a.len())
@ -56,28 +56,28 @@ impl WasiFd {
cvt_wasi(unsafe { libc::__wasi_fd_datasync(self.fd) })
}
pub fn pread(&self, bufs: &mut [IoVecMut], offset: u64) -> io::Result<usize> {
pub fn pread(&self, bufs: &mut [IoVecMut<'_>], offset: u64) -> io::Result<usize> {
let mut read = 0;
let (ptr, len) = iovec(bufs);
cvt_wasi(unsafe { libc::__wasi_fd_pread(self.fd, ptr, len, offset, &mut read) })?;
Ok(read)
}
pub fn pwrite(&self, bufs: &[IoVec], offset: u64) -> io::Result<usize> {
pub fn pwrite(&self, bufs: &[IoVec<'_>], offset: u64) -> io::Result<usize> {
let mut read = 0;
let (ptr, len) = ciovec(bufs);
cvt_wasi(unsafe { libc::__wasi_fd_pwrite(self.fd, ptr, len, offset, &mut read) })?;
Ok(read)
}
pub fn read(&self, bufs: &mut [IoVecMut]) -> io::Result<usize> {
pub fn read(&self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
let mut read = 0;
let (ptr, len) = iovec(bufs);
cvt_wasi(unsafe { libc::__wasi_fd_read(self.fd, ptr, len, &mut read) })?;
Ok(read)
}
pub fn write(&self, bufs: &[IoVec]) -> io::Result<usize> {
pub fn write(&self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
let mut read = 0;
let (ptr, len) = ciovec(bufs);
cvt_wasi(unsafe { libc::__wasi_fd_write(self.fd, ptr, len, &mut read) })?;
@ -281,7 +281,7 @@ impl WasiFd {
pub fn sock_recv(
&self,
ri_data: &mut [IoVecMut],
ri_data: &mut [IoVecMut<'_>],
ri_flags: RiFlags,
) -> io::Result<(usize, RoFlags)> {
let mut ro_datalen = 0;
@ -293,7 +293,7 @@ impl WasiFd {
Ok((ro_datalen, ro_flags))
}
pub fn sock_send(&self, si_data: &[IoVec], si_flags: SiFlags) -> io::Result<usize> {
pub fn sock_send(&self, si_data: &[IoVec<'_>], si_flags: SiFlags) -> io::Result<usize> {
let mut so_datalen = 0;
let (ptr, len) = ciovec(si_data);
cvt_wasi(unsafe { libc::__wasi_sock_send(self.fd, ptr, len, si_flags, &mut so_datalen) })?;

View file

@ -82,7 +82,7 @@ impl Eq for FilePermissions {
}
impl fmt::Debug for FilePermissions {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}
@ -125,13 +125,13 @@ impl Hash for FileType {
}
impl fmt::Debug for FileType {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}
impl fmt::Debug for ReadDir {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}
@ -236,7 +236,7 @@ impl DirBuilder {
}
impl fmt::Debug for File {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}

View file

@ -94,7 +94,7 @@ impl TcpStream {
}
impl fmt::Debug for TcpStream {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}
@ -144,7 +144,7 @@ impl TcpListener {
}
impl fmt::Debug for TcpListener {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}
@ -282,7 +282,7 @@ impl UdpSocket {
}
impl fmt::Debug for UdpSocket {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}

View file

@ -41,7 +41,7 @@ pub fn chdir(_: &path::Path) -> io::Result<()> {
pub struct SplitPaths<'a>(&'a Void);
pub fn split_paths(_unparsed: &OsStr) -> SplitPaths {
pub fn split_paths(_unparsed: &OsStr) -> SplitPaths<'_> {
panic!("unsupported")
}
@ -62,7 +62,7 @@ pub fn join_paths<I, T>(_paths: I) -> Result<OsString, JoinPathsError>
}
impl fmt::Display for JoinPathsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
"not supported on wasm yet".fmt(f)
}
}

View file

@ -11,7 +11,7 @@ pub fn is_verbatim_sep(b: u8) -> bool {
b == b'/'
}
pub fn parse_prefix(_: &OsStr) -> Option<Prefix> {
pub fn parse_prefix(_: &OsStr) -> Option<Prefix<'_>> {
None
}

View file

@ -73,7 +73,7 @@ impl From<File> for Stdio {
}
impl fmt::Debug for Command {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
Ok(())
}
}
@ -108,13 +108,13 @@ impl Eq for ExitStatus {
}
impl fmt::Debug for ExitStatus {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}
impl fmt::Display for ExitStatus {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}

View file

@ -82,7 +82,7 @@ impl Eq for FilePermissions {
}
impl fmt::Debug for FilePermissions {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}
@ -125,13 +125,13 @@ impl Hash for FileType {
}
impl fmt::Debug for FileType {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}
impl fmt::Debug for ReadDir {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}
@ -236,7 +236,7 @@ impl DirBuilder {
}
impl fmt::Debug for File {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}

View file

@ -94,7 +94,7 @@ impl TcpStream {
}
impl fmt::Debug for TcpStream {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}
@ -144,7 +144,7 @@ impl TcpListener {
}
impl fmt::Debug for TcpListener {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}
@ -282,7 +282,7 @@ impl UdpSocket {
}
impl fmt::Debug for UdpSocket {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}

View file

@ -24,7 +24,7 @@ pub fn chdir(_: &path::Path) -> io::Result<()> {
pub struct SplitPaths<'a>(&'a Void);
pub fn split_paths(_unparsed: &OsStr) -> SplitPaths {
pub fn split_paths(_unparsed: &OsStr) -> SplitPaths<'_> {
panic!("unsupported")
}
@ -45,7 +45,7 @@ pub fn join_paths<I, T>(_paths: I) -> Result<OsString, JoinPathsError>
}
impl fmt::Display for JoinPathsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
"not supported on wasm yet".fmt(f)
}
}

View file

@ -11,7 +11,7 @@ pub fn is_verbatim_sep(b: u8) -> bool {
b == b'/'
}
pub fn parse_prefix(_: &OsStr) -> Option<Prefix> {
pub fn parse_prefix(_: &OsStr) -> Option<Prefix<'_>> {
None
}

View file

@ -73,7 +73,7 @@ impl From<File> for Stdio {
}
impl fmt::Debug for Command {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
Ok(())
}
}
@ -108,13 +108,13 @@ impl Eq for ExitStatus {
}
impl fmt::Debug for ExitStatus {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}
impl fmt::Display for ExitStatus {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.0 {}
}
}

View file

@ -164,13 +164,13 @@ pub struct ArgsInnerDebug<'a> {
}
impl<'a> fmt::Debug for ArgsInnerDebug<'a> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.args.parsed_args_list.as_slice().fmt(f)
}
}
impl Args {
pub fn inner_debug(&self) -> ArgsInnerDebug {
pub fn inner_debug(&self) -> ArgsInnerDebug<'_> {
ArgsInnerDebug {
args: self
}

View file

@ -131,12 +131,12 @@ pub trait OsStrExt {
///
/// [`OsString::from_wide`]: ./trait.OsStringExt.html#tymethod.from_wide
#[stable(feature = "rust1", since = "1.0.0")]
fn encode_wide(&self) -> EncodeWide;
fn encode_wide(&self) -> EncodeWide<'_>;
}
#[stable(feature = "rust1", since = "1.0.0")]
impl OsStrExt for OsStr {
fn encode_wide(&self) -> EncodeWide {
fn encode_wide(&self) -> EncodeWide<'_> {
self.as_inner().inner.encode_wide()
}
}

View file

@ -74,7 +74,7 @@ pub struct FilePermissions { attrs: c::DWORD }
pub struct DirBuilder;
impl fmt::Debug for ReadDir {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// This will only be called from std::fs::ReadDir, which will add a "ReadDir()" frame.
// Thus the result will be e g 'ReadDir("C:\")'
fmt::Debug::fmt(&*self.root, f)
@ -435,7 +435,7 @@ impl FromInner<c::HANDLE> for File {
}
impl fmt::Debug for File {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// FIXME(#24570): add more info here (e.g., mode)
let mut b = f.debug_struct("File");
b.field("handle", &self.handle.raw());

View file

@ -136,7 +136,7 @@ pub struct SplitPaths<'a> {
must_yield: bool,
}
pub fn split_paths(unparsed: &OsStr) -> SplitPaths {
pub fn split_paths(unparsed: &OsStr) -> SplitPaths<'_> {
SplitPaths {
data: unparsed.encode_wide(),
must_yield: true,
@ -212,7 +212,7 @@ pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError>
}
impl fmt::Display for JoinPathsError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
"path segment contains `\"`".fmt(f)
}
}

View file

@ -33,13 +33,13 @@ impl AsInner<Wtf8> for Buf {
}
impl fmt::Debug for Buf {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(self.as_slice(), formatter)
}
}
impl fmt::Display for Buf {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(self.as_slice(), formatter)
}
}
@ -49,13 +49,13 @@ pub struct Slice {
}
impl fmt::Debug for Slice {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&self.inner, formatter)
}
}
impl fmt::Display for Slice {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(&self.inner, formatter)
}
}
@ -139,7 +139,7 @@ impl Slice {
self.inner.as_str()
}
pub fn to_string_lossy(&self) -> Cow<str> {
pub fn to_string_lossy(&self) -> Cow<'_, str> {
self.inner.to_string_lossy()
}

View file

@ -19,7 +19,7 @@ pub fn is_verbatim_sep(b: u8) -> bool {
b == b'\\'
}
pub fn parse_prefix<'a>(path: &'a OsStr) -> Option<Prefix> {
pub fn parse_prefix<'a>(path: &'a OsStr) -> Option<Prefix<'a>> {
use crate::path::Prefix::*;
unsafe {
// The unsafety here stems from converting between &OsStr and &[u8]

View file

@ -219,7 +219,7 @@ impl Command {
}
impl fmt::Debug for Command {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:?}", self.program)?;
for arg in &self.args {
write!(f, " {:?}", arg)?;
@ -393,7 +393,7 @@ impl From<c::DWORD> for ExitStatus {
}
impl fmt::Display for ExitStatus {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// Windows exit codes with the high bit set typically mean some form of
// unhandled exception or warning. In this scenario printing the exit
// code in decimal doesn't always make sense because it's a very large

View file

@ -139,7 +139,7 @@ impl Ord for SystemTime {
}
impl fmt::Debug for SystemTime {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("SystemTime")
.field("intervals", &self.intervals())
.finish()

View file

@ -3,9 +3,9 @@
use crate::fmt::{Formatter, Result, Write};
use core::str::lossy::{Utf8Lossy, Utf8LossyChunk};
pub fn debug_fmt_bytestring(slice: &[u8], f: &mut Formatter) -> Result {
pub fn debug_fmt_bytestring(slice: &[u8], f: &mut Formatter<'_>) -> Result {
// Writes out a valid unicode string with the correct escape sequences
fn write_str_escaped(f: &mut Formatter, s: &str) -> Result {
fn write_str_escaped(f: &mut Formatter<'_>, s: &str) -> Result {
for c in s.chars().flat_map(|c| c.escape_debug()) {
f.write_char(c)?
}
@ -32,7 +32,7 @@ mod tests {
struct Helper<'a>(&'a [u8]);
impl Debug for Helper<'_> {
fn fmt(&self, f: &mut Formatter) -> Result {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
debug_fmt_bytestring(self.0, f)
}
}

View file

@ -38,7 +38,7 @@ impl Mutex {
/// Calls raw_lock() and then returns an RAII guard to guarantee the mutex
/// will be unlocked.
#[inline]
pub unsafe fn lock(&self) -> MutexGuard {
pub unsafe fn lock(&self) -> MutexGuard<'_> {
self.raw_lock();
MutexGuard(&self.0)
}

View file

@ -328,7 +328,7 @@ impl FromInner<Socket> for TcpStream {
}
impl fmt::Debug for TcpStream {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut res = f.debug_struct("TcpStream");
if let Ok(addr) = self.socket_addr() {
@ -435,7 +435,7 @@ impl FromInner<Socket> for TcpListener {
}
impl fmt::Debug for TcpListener {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut res = f.debug_struct("TcpListener");
if let Ok(addr) = self.socket_addr() {
@ -644,7 +644,7 @@ impl FromInner<Socket> for UdpSocket {
}
impl fmt::Debug for UdpSocket {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut res = f.debug_struct("UdpSocket");
if let Ok(addr) = self.socket_addr() {

View file

@ -23,25 +23,25 @@ pub(crate) struct Slice {
}
impl fmt::Debug for Slice {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
debug_fmt_bytestring(&self.inner, formatter)
}
}
impl fmt::Display for Slice {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(&Utf8Lossy::from_bytes(&self.inner), formatter)
}
}
impl fmt::Debug for Buf {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(self.as_slice(), formatter)
}
}
impl fmt::Display for Buf {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(self.as_slice(), formatter)
}
}
@ -148,7 +148,7 @@ impl Slice {
str::from_utf8(&self.inner).ok()
}
pub fn to_string_lossy(&self) -> Cow<str> {
pub fn to_string_lossy(&self) -> Cow<'_, str> {
String::from_utf8_lossy(&self.inner)
}

View file

@ -136,14 +136,14 @@ pub type TryLockResult<Guard> = Result<Guard, TryLockError<Guard>>;
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> fmt::Debug for PoisonError<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
"PoisonError { inner: .. }".fmt(f)
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> fmt::Display for PoisonError<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
"poisoned lock: another task failed inside".fmt(f)
}
}
@ -214,7 +214,7 @@ impl<T> From<PoisonError<T>> for TryLockError<T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> fmt::Debug for TryLockError<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
TryLockError::Poisoned(..) => "Poisoned(..)".fmt(f),
TryLockError::WouldBlock => "WouldBlock".fmt(f)
@ -224,7 +224,7 @@ impl<T> fmt::Debug for TryLockError<T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> fmt::Display for TryLockError<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
TryLockError::Poisoned(..) => "poisoned lock: another task failed inside",
TryLockError::WouldBlock => "try_lock failed because the operation would block"

View file

@ -72,7 +72,7 @@ impl<T> ReentrantMutex<T> {
/// If another user of this mutex panicked while holding the mutex, then
/// this call will return failure if the mutex would otherwise be
/// acquired.
pub fn lock(&self) -> LockResult<ReentrantMutexGuard<T>> {
pub fn lock(&self) -> LockResult<ReentrantMutexGuard<'_, T>> {
unsafe { self.inner.lock() }
ReentrantMutexGuard::new(&self)
}
@ -89,7 +89,7 @@ impl<T> ReentrantMutex<T> {
/// If another user of this mutex panicked while holding the mutex, then
/// this call will return failure if the mutex would otherwise be
/// acquired.
pub fn try_lock(&self) -> TryLockResult<ReentrantMutexGuard<T>> {
pub fn try_lock(&self) -> TryLockResult<ReentrantMutexGuard<'_, T>> {
if unsafe { self.inner.try_lock() } {
Ok(ReentrantMutexGuard::new(&self)?)
} else {
@ -108,7 +108,7 @@ impl<T> Drop for ReentrantMutex<T> {
}
impl<T: fmt::Debug + 'static> fmt::Debug for ReentrantMutex<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.try_lock() {
Ok(guard) => f.debug_struct("ReentrantMutex").field("data", &*guard).finish(),
Err(TryLockError::Poisoned(err)) => {
@ -117,7 +117,9 @@ impl<T: fmt::Debug + 'static> fmt::Debug for ReentrantMutex<T> {
Err(TryLockError::WouldBlock) => {
struct LockedPlaceholder;
impl fmt::Debug for LockedPlaceholder {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("<locked>") }
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str("<locked>")
}
}
f.debug_struct("ReentrantMutex").field("data", &LockedPlaceholder).finish()

View file

@ -3,7 +3,7 @@ use crate::io::prelude::*;
use crate::sys::stdio::panic_output;
use crate::thread;
pub fn dumb_print(args: fmt::Arguments) {
pub fn dumb_print(args: fmt::Arguments<'_>) {
if let Some(mut out) = panic_output() {
let _ = out.write_fmt(args);
}
@ -14,7 +14,7 @@ pub fn dumb_print(args: fmt::Arguments) {
// crate::intrinsics::abort() may be used instead. The above implementations cover
// all targets currently supported by libstd.
pub fn abort(args: fmt::Arguments) -> ! {
pub fn abort(args: fmt::Arguments<'_>) -> ! {
dumb_print(format_args!("fatal runtime error: {}\n", args));
unsafe { crate::sys::abort_internal(); }
}

View file

@ -46,7 +46,7 @@ pub struct CodePoint {
/// Example: `U+1F4A9`
impl fmt::Debug for CodePoint {
#[inline]
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(formatter, "U+{:04X}", self.value)
}
}
@ -134,7 +134,7 @@ impl ops::DerefMut for Wtf8Buf {
/// Example: `"a\u{D800}"` for a string with code points [U+0061, U+D800]
impl fmt::Debug for Wtf8Buf {
#[inline]
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&**self, formatter)
}
}
@ -411,8 +411,8 @@ impl AsInner<[u8]> for Wtf8 {
/// and surrogates as `\u` followed by four hexadecimal digits.
/// Example: `"a\u{D800}"` for a slice with code points [U+0061, U+D800]
impl fmt::Debug for Wtf8 {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
fn write_str_escaped(f: &mut fmt::Formatter, s: &str) -> fmt::Result {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
fn write_str_escaped(f: &mut fmt::Formatter<'_>, s: &str) -> fmt::Result {
use crate::fmt::Write;
for c in s.chars().flat_map(|c| c.escape_debug()) {
f.write_char(c)?
@ -441,7 +441,7 @@ impl fmt::Debug for Wtf8 {
}
impl fmt::Display for Wtf8 {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
let wtf8_bytes = &self.bytes;
let mut pos = 0;
loop {
@ -522,7 +522,7 @@ impl Wtf8 {
/// Returns an iterator for the strings code points.
#[inline]
pub fn code_points(&self) -> Wtf8CodePoints {
pub fn code_points(&self) -> Wtf8CodePoints<'_> {
Wtf8CodePoints { bytes: self.bytes.iter() }
}
@ -547,7 +547,7 @@ impl Wtf8 {
/// Surrogates are replaced with `"\u{FFFD}"` (the replacement character “<>”).
///
/// This only copies the data if necessary (if it contains any surrogate).
pub fn to_string_lossy(&self) -> Cow<str> {
pub fn to_string_lossy(&self) -> Cow<'_, str> {
let surrogate_pos = match self.next_surrogate(0) {
None => return Cow::Borrowed(unsafe { str::from_utf8_unchecked(&self.bytes) }),
Some((pos, _)) => pos,
@ -579,7 +579,7 @@ impl Wtf8 {
/// calling `Wtf8Buf::from_ill_formed_utf16` on the resulting code units
/// would always return the original WTF-8 string.
#[inline]
pub fn encode_wide(&self) -> EncodeWide {
pub fn encode_wide(&self) -> EncodeWide<'_> {
EncodeWide { code_points: self.code_points(), extra: 0 }
}
@ -1228,7 +1228,7 @@ mod tests {
assert_eq!(Wtf8::from_str("aé 💩").to_string_lossy(), Cow::Borrowed("aé 💩"));
let mut string = Wtf8Buf::from_str("aé 💩");
string.push(CodePoint::from_u32(0xD800).unwrap());
let expected: Cow<str> = Cow::Owned(String::from("aé 💩<>"));
let expected: Cow<'_, str> = Cow::Owned(String::from("aé 💩<>"));
assert_eq!(string.to_string_lossy(), expected);
}

View file

@ -100,7 +100,7 @@ pub struct LocalKey<T: 'static> {
#[stable(feature = "std_debug", since = "1.16.0")]
impl<T: 'static> fmt::Debug for LocalKey<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("LocalKey { .. }")
}
}
@ -204,14 +204,14 @@ pub struct AccessError {
#[stable(feature = "thread_local_try_with", since = "1.26.0")]
impl fmt::Debug for AccessError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("AccessError").finish()
}
}
#[stable(feature = "thread_local_try_with", since = "1.26.0")]
impl fmt::Display for AccessError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt("already destroyed", f)
}
}
@ -319,7 +319,7 @@ pub mod statik {
unsafe impl<T> Sync for Key<T> { }
impl<T> fmt::Debug for Key<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Key { .. }")
}
}
@ -356,7 +356,7 @@ pub mod fast {
}
impl<T> fmt::Debug for Key<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Key { .. }")
}
}
@ -424,7 +424,7 @@ pub mod os {
}
impl<T> fmt::Debug for Key<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("Key { .. }")
}
}

View file

@ -1256,7 +1256,7 @@ impl Thread {
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for Thread {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Thread")
.field("id", &self.id())
.field("name", &self.name())
@ -1469,7 +1469,7 @@ impl<T> IntoInner<imp::Thread> for JoinHandle<T> {
#[stable(feature = "std_debug", since = "1.16.0")]
impl<T> fmt::Debug for JoinHandle<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("JoinHandle { .. }")
}
}

View file

@ -349,7 +349,7 @@ impl Sub<Instant> for Instant {
#[stable(feature = "time2", since = "1.8.0")]
impl fmt::Debug for Instant {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}
@ -513,7 +513,7 @@ impl SubAssign<Duration> for SystemTime {
#[stable(feature = "time2", since = "1.8.0")]
impl fmt::Debug for SystemTime {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.0.fmt(f)
}
}
@ -581,7 +581,7 @@ impl Error for SystemTimeError {
#[stable(feature = "time2", since = "1.8.0")]
impl fmt::Display for SystemTimeError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "second time provided was later than self")
}
}

View file

@ -5,5 +5,5 @@ LL | m!();
| ^^^^^
|
= note: `use $crate;` was erroneously allowed and will become a hard error in a future release
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

View file

@ -0,0 +1,18 @@
#![allow(dead_code)]
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
// This test checks that generic parameter re-ordering diagnostic suggestions mention that
// consts come after types and lifetimes when the `const_generics` feature is enabled.
// We cannot run rustfix on this test because of the above const generics warning.
struct A;
impl A {
pub fn do_things<T, 'a, 'b: 'a>() {
//~^ ERROR lifetime parameters must be declared prior to type parameters
println!("panic");
}
}
fn main() {}

Some files were not shown because too many files have changed in this diff Show more