Skip to content

Commit

Permalink
arc lint -e extra
Browse files Browse the repository at this point in the history
Summary: Fixed lint extras.  Also changed input to mk_afkvalues() to be an iterator instead of a slice so we don't have to allocate an extra Vec.

Reviewed By: edwinsmith

Differential Revision: D40511947

fbshipit-source-id: f11c1d57b83540cd140f64526b914e4255446994
  • Loading branch information
aorenste authored and facebook-github-bot committed Oct 20, 2022
1 parent 886a89f commit 9744f1c
Show file tree
Hide file tree
Showing 11 changed files with 111 additions and 140 deletions.
2 changes: 1 addition & 1 deletion hphp/hack/src/hackc/bytecode_printer/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub struct Context<'a> {
}

impl<'a> Context<'a> {
pub fn new<'arena, 'decl>(
pub fn new(
include_processor: &'a dyn IncludeProcessor,
path: Option<&'a RelativePath>,
array_provenance: bool,
Expand Down
6 changes: 3 additions & 3 deletions hphp/hack/src/hackc/compile/closure_convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ impl<'arena> State<'arena> {
if !coeffects_of_scope.get_static_coeffects().is_empty() {
self.global_state
.lambda_coeffects_of_scope
.insert(key.clone(), coeffects_of_scope);
.insert(key, coeffects_of_scope);
}
}

Expand Down Expand Up @@ -1210,7 +1210,7 @@ impl<'a: 'b, 'b, 'arena: 'a + 'b> ClosureVisitor<'a, 'b, 'arena> {
let mangled_class_name = mangled_class_name.unsafe_as_str();
Ok(self.convert_meth_caller_to_func_ptr(
scope,
&*pos,
pos,
pc,
mangled_class_name,
pf,
Expand All @@ -1224,7 +1224,7 @@ impl<'a: 'b, 'b, 'arena: 'a + 'b> ClosureVisitor<'a, 'b, 'arena> {
}
(Expr_::String(cls_name), Some(fname)) => Ok(self.convert_meth_caller_to_func_ptr(
scope,
&*pos,
pos,
pc,
// FIXME: This is not safe--string literals are binary strings.
// There's no guarantee that they're valid UTF-8.
Expand Down
4 changes: 2 additions & 2 deletions hphp/hack/src/hackc/compile/dump_expr_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl<'ast> Visitor<'ast> for ExprTreeLiteralExtractor {
use aast::Expr_;
match &e.2 {
Expr_::ExpressionTree(et) => {
self.literals.push((e.1.clone(), (&**et).clone()));
self.literals.push((e.1.clone(), (**et).clone()));
}
_ => e.recurse(env, self)?,
}
Expand Down Expand Up @@ -68,7 +68,7 @@ fn find_et_literals(program: ast::Program) -> Vec<(Pos, ast::ExpressionTree)> {
visitor.literals
}

fn sort_by_start_pos<T>(items: &mut Vec<(Pos, T)>) {
fn sort_by_start_pos<T>(items: &mut [(Pos, T)]) {
items.sort_by(|(p1, _), (p2, _)| p1.start_offset().cmp(&p2.start_offset()));
}

Expand Down
11 changes: 3 additions & 8 deletions hphp/hack/src/hackc/emitter/emit_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ fn validate_class_name(ns: &namespace_env::Env, ast::Id(p, class_name): &ast::Id
format!(
"Cannot use '{}' as class name as it is reserved",
if is_reserved_global_name {
&name
name
} else {
string_utils::strip_global_ns(class_name)
}
Expand All @@ -413,12 +413,7 @@ fn emit_reified_extends_params<'a, 'arena, 'decl>(
[h, ..] => match h.1.as_happly() {
Some((_, l)) if !l.is_empty() => {
return Ok(InstrSeq::gather(vec![
emit_expression::emit_reified_targs(
e,
env,
&ast_class.span,
&l.iter().collect::<Vec<_>>(),
)?,
emit_expression::emit_reified_targs(e, env, &ast_class.span, l.iter())?,
instr::record_reified_generic(),
]));
}
Expand Down Expand Up @@ -921,7 +916,7 @@ pub fn emit_class<'a, 'arena, 'decl>(
enum_type: Maybe::from(enum_type),
upper_bounds: Slice::fill_iter(alloc, upper_bounds.into_iter()),
properties: Slice::fill_iter(alloc, properties.into_iter().map(|p| p.prop)),
requirements: Slice::fill_iter(alloc, requirements.into_iter().map(|r| r.into())),
requirements: Slice::fill_iter(alloc, requirements.into_iter()),
type_constants: Slice::fill_iter(alloc, type_constants.into_iter()),
ctx_constants: Slice::fill_iter(alloc, ctx_constants.into_iter()),
constants: Slice::fill_iter(alloc, constants.into_iter().map(|(c, _)| c)),
Expand Down
Loading

0 comments on commit 9744f1c

Please sign in to comment.