Skip to content

Commit

Permalink
use American spelling for pluralize!
Browse files Browse the repository at this point in the history
  • Loading branch information
euclio committed Nov 5, 2019
1 parent 1423bec commit ad550b8
Show file tree
Hide file tree
Showing 21 changed files with 57 additions and 57 deletions.
4 changes: 2 additions & 2 deletions src/librustc/lint/builtin.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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
);
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/resolve_lifetime.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -3044,7 +3044,7 @@ pub fn report_missing_lifetime_specifiers(
span,
E0106,
"missing lifetime specifier{}",
pluralise!(count)
pluralize!(count)
)
}

Expand Down
4 changes: 2 additions & 2 deletions src/librustc/traits/error_reporting.rs
Expand Up @@ -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};
Expand Down Expand Up @@ -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))
}
};

Expand Down
14 changes: 7 additions & 7 deletions src/librustc/ty/error.rs
Expand Up @@ -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;

Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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(),
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_errors/emitter.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_errors/lib.rs
Expand Up @@ -1027,7 +1027,7 @@ impl Level {
}

#[macro_export]
macro_rules! pluralise {
macro_rules! pluralize {
($x:expr) => {
if $x != 1 { "s" } else { "" }
};
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_lint/unused.rs
Expand Up @@ -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};
Expand Down Expand Up @@ -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() => {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/hair/pattern/check_match.rs
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_resolve/check_unused.rs
Expand Up @@ -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};
Expand Down Expand Up @@ -297,7 +297,7 @@ impl Resolver<'_> {
}).collect::<Vec<String>>();
span_snippets.sort();
let msg = format!("unused import{}{}",
pluralise!(len),
pluralize!(len),
if !span_snippets.is_empty() {
format!(": {}", span_snippets.join(", "))
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_resolve/resolve_imports.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -730,7 +730,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {

let msg = format!(
"unresolved import{} {}",
pluralise!(paths.len()),
pluralize!(paths.len()),
paths.join(", "),
);

Expand Down
6 changes: 3 additions & 3 deletions src/librustc_typeck/astconv.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -392,7 +392,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
quantifier,
bound,
kind,
pluralise!(bound),
pluralize!(bound),
))
};

Expand Down Expand Up @@ -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) =
Expand Down
10 changes: 5 additions & 5 deletions src/librustc_typeck/check/compare_method.rs
Expand Up @@ -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};

Expand Down Expand Up @@ -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()),
Expand All @@ -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 {
Expand All @@ -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()),
));
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_typeck/check/expr.rs
Expand Up @@ -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};
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_typeck/check/method/suggest.rs
Expand Up @@ -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};
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_typeck/check/mod.rs
Expand Up @@ -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};
Expand Down Expand Up @@ -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))
}
14 changes: 7 additions & 7 deletions 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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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();
}

Expand All @@ -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();
}
Expand Down
6 changes: 3 additions & 3 deletions src/libsyntax/parse/parser/diagnostics.rs
Expand Up @@ -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};
Expand Down Expand Up @@ -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,
)
Expand Down

0 comments on commit ad550b8

Please sign in to comment.