From ad550b8ef32e336ad74a87669de041eba9f7d1c6 Mon Sep 17 00:00:00 2001 From: Andy Russell Date: Tue, 5 Nov 2019 15:10:24 -0500 Subject: [PATCH] use American spelling for `pluralize!` --- src/librustc/lint/builtin.rs | 4 ++-- src/librustc/middle/resolve_lifetime.rs | 4 ++-- src/librustc/traits/error_reporting.rs | 4 ++-- src/librustc/ty/error.rs | 14 +++++++------- src/librustc_errors/emitter.rs | 4 ++-- src/librustc_errors/lib.rs | 2 +- src/librustc_lint/unused.rs | 4 ++-- src/librustc_mir/hair/pattern/check_match.rs | 2 +- src/librustc_resolve/check_unused.rs | 4 ++-- src/librustc_resolve/resolve_imports.rs | 4 ++-- src/librustc_typeck/astconv.rs | 6 +++--- src/librustc_typeck/check/compare_method.rs | 10 +++++----- src/librustc_typeck/check/expr.rs | 4 ++-- src/librustc_typeck/check/method/suggest.rs | 4 ++-- src/librustc_typeck/check/mod.rs | 4 ++-- src/librustc_typeck/check/pat.rs | 14 +++++++------- src/libsyntax/parse/parser/diagnostics.rs | 6 +++--- src/libsyntax/parse/parser/path.rs | 6 +++--- src/libsyntax/parse/parser/ty.rs | 4 ++-- src/libsyntax_expand/mbe/transcribe.rs | 6 +++--- src/libsyntax_ext/format.rs | 4 ++-- 21 files changed, 57 insertions(+), 57 deletions(-) diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index 5c871bb6b6988..65777fe78db39 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -7,7 +7,7 @@ use crate::lint::{LintPass, LateLintPass, LintArray, FutureIncompatibleInfo}; use crate::middle::stability; use crate::session::Session; -use errors::{Applicability, DiagnosticBuilder, pluralise}; +use errors::{Applicability, DiagnosticBuilder, pluralize}; use syntax::ast; use syntax::edition::Edition; use syntax::source_map::Span; @@ -651,7 +651,7 @@ pub(crate) fn add_elided_lifetime_in_path_suggestion( }; db.span_suggestion( replace_span, - &format!("indicate the anonymous lifetime{}", pluralise!(n)), + &format!("indicate the anonymous lifetime{}", pluralize!(n)), suggestion, Applicability::MachineApplicable ); diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index a122d84a5aa7e..488d6332f7e39 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -17,7 +17,7 @@ use crate::ty::{self, DefIdTree, GenericParamDefKind, TyCtxt}; use crate::rustc::lint; use crate::session::Session; use crate::util::nodemap::{DefIdMap, FxHashMap, FxHashSet, HirIdMap, HirIdSet}; -use errors::{Applicability, DiagnosticBuilder, pluralise}; +use errors::{Applicability, DiagnosticBuilder, pluralize}; use rustc_macros::HashStable; use std::borrow::Cow; use std::cell::Cell; @@ -3044,7 +3044,7 @@ pub fn report_missing_lifetime_specifiers( span, E0106, "missing lifetime specifier{}", - pluralise!(count) + pluralize!(count) ) } diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 1f7bce1c644c5..080ca8dfa73af 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -33,7 +33,7 @@ use crate::ty::subst::Subst; use crate::ty::SubtypePredicate; use crate::util::nodemap::{FxHashMap, FxHashSet}; -use errors::{Applicability, DiagnosticBuilder, pluralise}; +use errors::{Applicability, DiagnosticBuilder, pluralize}; use std::fmt; use syntax::ast; use syntax::symbol::{sym, kw}; @@ -1553,7 +1553,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { _ => format!("{} {}argument{}", arg_length, if distinct && arg_length > 1 { "distinct " } else { "" }, - pluralise!(arg_length)) + pluralize!(arg_length)) } }; diff --git a/src/librustc/ty/error.rs b/src/librustc/ty/error.rs index 77613b548cfdb..6af265f4901d1 100644 --- a/src/librustc/ty/error.rs +++ b/src/librustc/ty/error.rs @@ -4,7 +4,7 @@ use std::borrow::Cow; use std::fmt; use rustc_target::spec::abi; use syntax::ast; -use syntax::errors::pluralise; +use syntax::errors::pluralize; use errors::{Applicability, DiagnosticBuilder}; use syntax_pos::Span; @@ -100,17 +100,17 @@ impl<'tcx> fmt::Display for TypeError<'tcx> { write!(f, "expected a tuple with {} element{}, \ found one with {} element{}", values.expected, - pluralise!(values.expected), + pluralize!(values.expected), values.found, - pluralise!(values.found)) + pluralize!(values.found)) } FixedArraySize(values) => { write!(f, "expected an array with a fixed size of {} element{}, \ found one with {} element{}", values.expected, - pluralise!(values.expected), + pluralize!(values.expected), values.found, - pluralise!(values.found)) + pluralize!(values.found)) } ArgCount => { write!(f, "incorrect number of function parameters") @@ -165,7 +165,7 @@ impl<'tcx> fmt::Display for TypeError<'tcx> { ProjectionBoundsLength(ref values) => { write!(f, "expected {} associated type binding{}, found {}", values.expected, - pluralise!(values.expected), + pluralize!(values.expected), values.found) }, ExistentialMismatch(ref values) => { @@ -196,7 +196,7 @@ impl<'tcx> ty::TyS<'tcx> { let n = tcx.lift(&n).unwrap(); match n.try_eval_usize(tcx, ty::ParamEnv::empty()) { Some(n) => { - format!("array of {} element{}", n, pluralise!(n)).into() + format!("array of {} element{}", n, pluralize!(n)).into() } None => "array".into(), } diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index b153f0f0e82bf..de00df2765a1d 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -12,7 +12,7 @@ use Destination::*; use syntax_pos::{SourceFile, Span, MultiSpan}; use crate::{ - Level, CodeSuggestion, Diagnostic, SubDiagnostic, pluralise, + Level, CodeSuggestion, Diagnostic, SubDiagnostic, pluralize, SuggestionStyle, SourceMapper, SourceMapperDyn, DiagnosticId, }; use crate::Level::Error; @@ -1573,7 +1573,7 @@ impl EmitterWriter { } if suggestions.len() > MAX_SUGGESTIONS { let others = suggestions.len() - MAX_SUGGESTIONS; - let msg = format!("and {} other candidate{}", others, pluralise!(others)); + let msg = format!("and {} other candidate{}", others, pluralize!(others)); buffer.puts(row_num, max_line_num_len + 3, &msg, Style::NoStyle); } else if notice_capitalization { let msg = "notice the capitalization difference"; diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index 9743cf0d805a3..67c180a05e921 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -1027,7 +1027,7 @@ impl Level { } #[macro_export] -macro_rules! pluralise { +macro_rules! pluralize { ($x:expr) => { if $x != 1 { "s" } else { "" } }; diff --git a/src/librustc_lint/unused.rs b/src/librustc_lint/unused.rs index 3f85e6d772ec1..642b8e3279d66 100644 --- a/src/librustc_lint/unused.rs +++ b/src/librustc_lint/unused.rs @@ -10,7 +10,7 @@ use lint::{LintPass, EarlyLintPass, LateLintPass}; use syntax::ast; use syntax::attr; -use syntax::errors::{Applicability, pluralise}; +use syntax::errors::{Applicability, pluralize}; use syntax::feature_gate::{AttributeType, BuiltinAttribute, BUILTIN_ATTRIBUTE_MAP}; use syntax::print::pprust; use syntax::symbol::{kw, sym}; @@ -144,7 +144,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults { return true; } - let plural_suffix = pluralise!(plural_len); + let plural_suffix = pluralize!(plural_len); match ty.kind { ty::Adt(..) if ty.is_box() => { diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index 9d370554e86b4..29423536e653a 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -548,7 +548,7 @@ fn joined_uncovered_patterns(witnesses: &[super::Pat<'_>]) -> String { } fn pattern_not_covered_label(witnesses: &[super::Pat<'_>], joined_patterns: &str) -> String { - format!("pattern{} {} not covered", rustc_errors::pluralise!(witnesses.len()), joined_patterns) + format!("pattern{} {} not covered", rustc_errors::pluralize!(witnesses.len()), joined_patterns) } /// Point at the definition of non-covered `enum` variants. diff --git a/src/librustc_resolve/check_unused.rs b/src/librustc_resolve/check_unused.rs index 44b7a9fa047c2..0624b5eedfb8a 100644 --- a/src/librustc_resolve/check_unused.rs +++ b/src/librustc_resolve/check_unused.rs @@ -26,7 +26,7 @@ use crate::Resolver; use crate::resolve_imports::ImportDirectiveSubclass; -use errors::pluralise; +use errors::pluralize; use rustc::util::nodemap::NodeMap; use rustc::{lint, ty}; @@ -297,7 +297,7 @@ impl Resolver<'_> { }).collect::>(); span_snippets.sort(); let msg = format!("unused import{}{}", - pluralise!(len), + pluralize!(len), if !span_snippets.is_empty() { format!(": {}", span_snippets.join(", ")) } else { diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index c39f0c90f98a5..c06be18dc2c18 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -11,7 +11,7 @@ use crate::{Resolver, ResolutionError, BindingKey, Segment, ModuleKind}; use crate::{names_to_string, module_to_string}; use crate::diagnostics::Suggestion; -use errors::{Applicability, pluralise}; +use errors::{Applicability, pluralize}; use rustc_data_structures::ptr_key::PtrKey; use rustc::ty; @@ -730,7 +730,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> { let msg = format!( "unresolved import{} {}", - pluralise!(paths.len()), + pluralize!(paths.len()), paths.join(", "), ); diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index b14121da79f59..5c66151338272 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -23,7 +23,7 @@ use rustc_target::spec::abi; use crate::require_c_abi_if_c_variadic; use smallvec::SmallVec; use syntax::ast; -use syntax::errors::pluralise; +use syntax::errors::pluralize; use syntax::feature_gate::{GateIssue, emit_feature_err}; use syntax::util::lev_distance::find_best_match_for_name; use syntax::symbol::sym; @@ -392,7 +392,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { quantifier, bound, kind, - pluralise!(bound), + pluralize!(bound), )) }; @@ -1360,7 +1360,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { span, E0191, "the value of the associated type{} {} must be specified", - pluralise!(associated_types.len()), + pluralize!(associated_types.len()), names, ); let (suggest, potential_assoc_types_spans) = diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs index 6818d5f521d00..af0943db4cc9e 100644 --- a/src/librustc_typeck/check/compare_method.rs +++ b/src/librustc_typeck/check/compare_method.rs @@ -10,7 +10,7 @@ use rustc::util::common::ErrorReported; use errors::{Applicability, DiagnosticId}; use syntax_pos::Span; -use syntax::errors::pluralise; +use syntax::errors::pluralize; use super::{Inherited, FnCtxt, potentially_plural_count}; @@ -649,9 +649,9 @@ fn compare_number_of_generics<'tcx>( declaration has {} {kind} parameter{}", trait_.ident, impl_count, - pluralise!(impl_count), + pluralize!(impl_count), trait_count, - pluralise!(trait_count), + pluralize!(trait_count), kind = kind, ), DiagnosticId::Error("E0049".into()), @@ -666,7 +666,7 @@ fn compare_number_of_generics<'tcx>( "expected {} {} parameter{}", trait_count, kind, - pluralise!(trait_count), + pluralize!(trait_count), )); } for span in spans { @@ -681,7 +681,7 @@ fn compare_number_of_generics<'tcx>( "found {} {} parameter{}{}", impl_count, kind, - pluralise!(impl_count), + pluralize!(impl_count), suffix.unwrap_or_else(|| String::new()), )); } diff --git a/src/librustc_typeck/check/expr.rs b/src/librustc_typeck/check/expr.rs index 8668dd99a8cf4..2428429c4ddaf 100644 --- a/src/librustc_typeck/check/expr.rs +++ b/src/librustc_typeck/check/expr.rs @@ -17,7 +17,7 @@ use crate::util::common::ErrorReported; use crate::util::nodemap::FxHashMap; use crate::astconv::AstConv as _; -use errors::{Applicability, DiagnosticBuilder, pluralise}; +use errors::{Applicability, DiagnosticBuilder, pluralize}; use syntax_pos::hygiene::DesugaringKind; use syntax::ast; use syntax::symbol::{Symbol, kw, sym}; @@ -1210,7 +1210,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { struct_span_err!(tcx.sess, span, E0063, "missing field{} {}{} in initializer of `{}`", - pluralise!(remaining_fields.len()), + pluralize!(remaining_fields.len()), remaining_fields_names, truncated_fields_error, adt_ty) diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index d90ed2a790bb6..9e22979b8555b 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -5,7 +5,7 @@ use crate::check::FnCtxt; use crate::middle::lang_items::FnOnceTraitLangItem; use crate::namespace::Namespace; use crate::util::nodemap::FxHashSet; -use errors::{Applicability, DiagnosticBuilder, pluralise}; +use errors::{Applicability, DiagnosticBuilder, pluralize}; use rustc::hir::{self, ExprKind, Node, QPath}; use rustc::hir::def::{Res, DefKind}; use rustc::hir::def_id::{CRATE_DEF_INDEX, LOCAL_CRATE, DefId}; @@ -601,7 +601,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { "{an}other candidate{s} {were} found in the following trait{s}, perhaps \ add a `use` for {one_of_them}:", an = if candidates.len() == 1 {"an" } else { "" }, - s = pluralise!(candidates.len()), + s = pluralize!(candidates.len()), were = if candidates.len() == 1 { "was" } else { "were" }, one_of_them = if candidates.len() == 1 { "it" diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index a2af29aef094b..14d21fc217fac 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -88,7 +88,7 @@ pub mod intrinsic; mod op; use crate::astconv::{AstConv, PathSeg}; -use errors::{Applicability, DiagnosticBuilder, DiagnosticId, pluralise}; +use errors::{Applicability, DiagnosticBuilder, DiagnosticId, pluralize}; use rustc::hir::{self, ExprKind, GenericArg, ItemKind, Node, PatKind, QPath}; use rustc::hir::def::{CtorOf, Res, DefKind}; use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; @@ -5167,5 +5167,5 @@ fn fatally_break_rust(sess: &Session) { } fn potentially_plural_count(count: usize, word: &str) -> String { - format!("{} {}{}", count, word, pluralise!(count)) + format!("{} {}{}", count, word, pluralize!(count)) } diff --git a/src/librustc_typeck/check/pat.rs b/src/librustc_typeck/check/pat.rs index 950ae7c1d62e2..292e55e660803 100644 --- a/src/librustc_typeck/check/pat.rs +++ b/src/librustc_typeck/check/pat.rs @@ -1,6 +1,6 @@ use crate::check::FnCtxt; use crate::util::nodemap::FxHashMap; -use errors::{Applicability, DiagnosticBuilder, pluralise}; +use errors::{Applicability, DiagnosticBuilder, pluralize}; use rustc::hir::{self, PatKind, Pat, HirId}; use rustc::hir::def::{Res, DefKind, CtorKind}; use rustc::hir::pat_util::EnumerateAndAdjustIterator; @@ -703,8 +703,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { fields: &[ty::FieldDef], expected: Ty<'tcx> ) { - let subpats_ending = pluralise!(subpats.len()); - let fields_ending = pluralise!(fields.len()); + let subpats_ending = pluralize!(subpats.len()); + let fields_ending = pluralize!(fields.len()); let res_span = self.tcx.def_span(res.def_id()); let mut err = struct_span_err!( self.tcx.sess, @@ -1174,10 +1174,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { E0527, "pattern requires {} element{} but array has {}", min_len, - pluralise!(min_len), + pluralize!(min_len), size, ) - .span_label(span, format!("expected {} element{}", size, pluralise!(size))) + .span_label(span, format!("expected {} element{}", size, pluralize!(size))) .emit(); } @@ -1188,14 +1188,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { E0528, "pattern requires at least {} element{} but array has {}", min_len, - pluralise!(min_len), + pluralize!(min_len), size, ).span_label( span, format!( "pattern cannot match array of {} element{}", size, - pluralise!(size), + pluralize!(size), ), ).emit(); } diff --git a/src/libsyntax/parse/parser/diagnostics.rs b/src/libsyntax/parse/parser/diagnostics.rs index fcf3b4c0aa891..376916c371fc5 100644 --- a/src/libsyntax/parse/parser/diagnostics.rs +++ b/src/libsyntax/parse/parser/diagnostics.rs @@ -12,7 +12,7 @@ use crate::ptr::P; use crate::symbol::{kw, sym}; use crate::ThinVec; use crate::util::parser::AssocOp; -use errors::{Applicability, DiagnosticBuilder, DiagnosticId, pluralise}; +use errors::{Applicability, DiagnosticBuilder, DiagnosticId, pluralize}; use rustc_data_structures::fx::FxHashSet; use syntax_pos::{Span, DUMMY_SP, MultiSpan, SpanSnippetError}; use log::{debug, trace}; @@ -515,11 +515,11 @@ impl<'a> Parser<'a> { self.diagnostic() .struct_span_err( span, - &format!("unmatched angle bracket{}", pluralise!(total_num_of_gt)), + &format!("unmatched angle bracket{}", pluralize!(total_num_of_gt)), ) .span_suggestion( span, - &format!("remove extra angle bracket{}", pluralise!(total_num_of_gt)), + &format!("remove extra angle bracket{}", pluralize!(total_num_of_gt)), String::new(), Applicability::MachineApplicable, ) diff --git a/src/libsyntax/parse/parser/path.rs b/src/libsyntax/parse/parser/path.rs index 38a28224daba4..f9944e36e2f60 100644 --- a/src/libsyntax/parse/parser/path.rs +++ b/src/libsyntax/parse/parser/path.rs @@ -9,7 +9,7 @@ use crate::symbol::kw; use std::mem; use log::debug; -use errors::{Applicability, pluralise}; +use errors::{Applicability, pluralize}; /// Specifies how to parse a path. #[derive(Copy, Clone, PartialEq)] @@ -368,14 +368,14 @@ impl<'a> Parser<'a> { span, &format!( "unmatched angle bracket{}", - pluralise!(snapshot.unmatched_angle_bracket_count) + pluralize!(snapshot.unmatched_angle_bracket_count) ), ) .span_suggestion( span, &format!( "remove extra angle bracket{}", - pluralise!(snapshot.unmatched_angle_bracket_count) + pluralize!(snapshot.unmatched_angle_bracket_count) ), String::new(), Applicability::MachineApplicable, diff --git a/src/libsyntax/parse/parser/ty.rs b/src/libsyntax/parse/parser/ty.rs index e8f718a24835c..b770b90705cbe 100644 --- a/src/libsyntax/parse/parser/ty.rs +++ b/src/libsyntax/parse/parser/ty.rs @@ -10,7 +10,7 @@ use crate::parse::token::{self, Token}; use crate::source_map::Span; use crate::symbol::{kw}; -use errors::{Applicability, pluralise}; +use errors::{Applicability, pluralize}; /// Returns `true` if `IDENT t` can start a type -- `IDENT::a::b`, `IDENT`, /// `IDENT<::AssocTy>`. @@ -412,7 +412,7 @@ impl<'a> Parser<'a> { } err.span_suggestion_hidden( bound_list, - &format!("remove the trait bound{}", pluralise!(negative_bounds_len)), + &format!("remove the trait bound{}", pluralize!(negative_bounds_len)), new_bound_list, Applicability::MachineApplicable, ); diff --git a/src/libsyntax_expand/mbe/transcribe.rs b/src/libsyntax_expand/mbe/transcribe.rs index 94523bbf91b5a..6f060103ef48e 100644 --- a/src/libsyntax_expand/mbe/transcribe.rs +++ b/src/libsyntax_expand/mbe/transcribe.rs @@ -9,7 +9,7 @@ use syntax::tokenstream::{DelimSpan, TokenStream, TokenTree, TreeAndJoint}; use smallvec::{smallvec, SmallVec}; -use errors::pluralise; +use errors::pluralize; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync::Lrc; use syntax_pos::hygiene::{ExpnId, Transparency}; @@ -350,10 +350,10 @@ impl LockstepIterSize { "meta-variable `{}` repeats {} time{}, but `{}` repeats {} time{}", l_id, l_len, - pluralise!(l_len), + pluralize!(l_len), r_id, r_len, - pluralise!(r_len), + pluralize!(r_len), ); LockstepIterSize::Contradiction(msg) } diff --git a/src/libsyntax_ext/format.rs b/src/libsyntax_ext/format.rs index 37310f46f7eed..bdc8b95919102 100644 --- a/src/libsyntax_ext/format.rs +++ b/src/libsyntax_ext/format.rs @@ -5,7 +5,7 @@ use fmt_macros as parse; use errors::DiagnosticBuilder; use errors::Applicability; -use errors::pluralise; +use errors::pluralize; use syntax::ast; use syntax_expand::base::{self, *}; @@ -300,7 +300,7 @@ impl<'a, 'b> Context<'a, 'b> { &format!( "{} positional argument{} in format string, but {}", count, - pluralise!(count), + pluralize!(count), self.describe_num_args(), ), );