Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for Extra pointer dereferencing #7643

Merged
merged 1 commit into from Sep 27, 2015
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -681,7 +681,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {

fn collect_old_layers(&mut self,
pipeline_id: PipelineId,
new_layers: &Vec<LayerProperties>) {
new_layers: &[LayerProperties]) {
let root_layer = match self.scene.root {
Some(ref root_layer) => root_layer.clone(),
None => return,
@@ -102,7 +102,7 @@ pub trait CompositorLayer {
fn collect_old_layers<Window>(&self,
compositor: &mut IOCompositor<Window>,
pipeline_id: PipelineId,
new_layers: &Vec<LayerProperties>)
new_layers: &[LayerProperties])
where Window: WindowMethods;

/// Destroys all tiles of all layers, including children, *without* sending them back to the
@@ -282,7 +282,7 @@ impl CompositorLayer for Layer<CompositorData> {
fn collect_old_layers<Window>(&self,
compositor: &mut IOCompositor<Window>,
pipeline_id: PipelineId,
new_layers: &Vec<LayerProperties>)
new_layers: &[LayerProperties])
where Window: WindowMethods {
// Traverse children first so that layers are removed
// bottom up - allowing each layer being removed to properly
@@ -57,14 +57,14 @@ pub fn start_sending(start_chan: LoadConsumer, metadata: Metadata) -> ProgressSe

/// For use by loaders in responding to a Load message that allows content sniffing.
pub fn start_sending_sniffed(start_chan: LoadConsumer, metadata: Metadata,
classifier: Arc<MIMEClassifier>, partial_body: &Vec<u8>)
classifier: Arc<MIMEClassifier>, partial_body: &[u8])
-> ProgressSender {
start_sending_sniffed_opt(start_chan, metadata, classifier, partial_body).ok().unwrap()
}

/// For use by loaders in responding to a Load message that allows content sniffing.
pub fn start_sending_sniffed_opt(start_chan: LoadConsumer, mut metadata: Metadata,
classifier: Arc<MIMEClassifier>, partial_body: &Vec<u8>)
classifier: Arc<MIMEClassifier>, partial_body: &[u8])
-> Result<ProgressSender, ()> {
if opts::get().sniff_mime_types {
// TODO: should be calculated in the resource loader, from pull requeset #4094
@@ -736,8 +736,8 @@ impl Interpolate for TextShadowList {
/// Check if it's possible to do a direct numerical interpolation
/// between these two transform lists.
/// http://dev.w3.org/csswg/css-transforms/#transform-transform-animation
fn can_interpolate_list(from_list: &Vec<TransformOperation>,
to_list: &Vec<TransformOperation>) -> bool {
fn can_interpolate_list(from_list: &[TransformOperation],
to_list: &[TransformOperation]) -> bool {
// Lists must be equal length
if from_list.len() != to_list.len() {
return false;
@@ -763,8 +763,8 @@ fn can_interpolate_list(from_list: &Vec<TransformOperation>,

/// Interpolate two transform lists.
/// http://dev.w3.org/csswg/css-transforms/#interpolation-of-transforms
fn interpolate_transform_list(from_list: &Vec<TransformOperation>,
to_list: &Vec<TransformOperation>,
fn interpolate_transform_list(from_list: &[TransformOperation],
to_list: &[TransformOperation],
time: f64) -> TransformList {
let mut result = vec!();

@@ -823,7 +823,7 @@ fn interpolate_transform_list(from_list: &Vec<TransformOperation>,
/// Build an equivalent 'identity transform function list' based
/// on an existing transform list.
/// http://dev.w3.org/csswg/css-transforms/#none-transform-animation
fn build_identity_transform_list(list: &Vec<TransformOperation>) -> Vec<TransformOperation> {
fn build_identity_transform_list(list: &[TransformOperation]) -> Vec<TransformOperation> {
let mut result = vec!();

for operation in list {
@@ -111,6 +111,7 @@ def check_by_line(file_name, contents):
check_whitespace(idx, line),
check_whatwg_url(idx, line),
)

for error in errors:
yield error

@@ -349,6 +350,10 @@ def check_rust(file_name, contents):
yield (idx + 1 - len(mods) + i, message + expected + found)
mods = []

# There should not be any extra pointer dereferencing
if re.search(r": &Vec<", line) is not None:
yield (idx + 1, "use &[T] instead of &Vec<T>")


# Avoid flagging <Item=Foo> constructs
def is_associated_type(match, line, index):
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.