mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
clippy: Fix various clippy warnings throughout the code (#33003)
* replace u64::max_value() with u64::MAX Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * removed redundant import Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * Fixed dereference Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * Fixed a probable bug Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * fixed imports Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * fixed dereference Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * dereference formatting Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * removed unnessicary number imports Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * removed unnessicary number imports Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * removed excess borrow Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * ran mach fmt Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * fixed doc comment Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * removed deref on an immutable reference Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * fixed minor syntax error Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * reverted clamping Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * formatting Signed-off-by: Ashwin Naren <arihant2math@gmail.com> * reverted final clamp Signed-off-by: Ashwin Naren <arihant2math@gmail.com> --------- Signed-off-by: Ashwin Naren <arihant2math@gmail.com> Co-authored-by: Ashwin Naren <ashwin@pixelators.org>
This commit is contained in:
parent
0d137d276a
commit
ea5cf75169
17 changed files with 25 additions and 29 deletions
|
@ -2878,8 +2878,8 @@ fn flip_pixels_y(
|
|||
|
||||
// Clamp a size to the current GL context's max viewport
|
||||
fn clamp_viewport(gl: &Gl, size: Size2D<u32>) -> Size2D<u32> {
|
||||
let mut max_viewport = [i32::max_value(), i32::max_value()];
|
||||
let mut max_renderbuffer = [i32::max_value()];
|
||||
let mut max_viewport = [i32::MAX, i32::MAX];
|
||||
let mut max_renderbuffer = [i32::MAX];
|
||||
#[allow(unsafe_code)]
|
||||
unsafe {
|
||||
gl.get_integer_v(gl::MAX_VIEWPORT_DIMS, &mut max_viewport);
|
||||
|
|
|
@ -1824,9 +1824,9 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
|||
if previous_pipeline_id.replace(pipeline_id) != Some(pipeline_id) {
|
||||
let scroll_result = self
|
||||
.pipeline_details
|
||||
.get_mut(&pipeline_id)?
|
||||
.get_mut(pipeline_id)?
|
||||
.scroll_tree
|
||||
.scroll_node_or_ancestor(&scroll_tree_node, scroll_location);
|
||||
.scroll_node_or_ancestor(scroll_tree_node, scroll_location);
|
||||
if let Some((external_id, offset)) = scroll_result {
|
||||
return Some((*pipeline_id, external_id, offset));
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ impl Actor for AccessibilityActor {
|
|||
/// - `getTraits`: Informs the DevTools client about the configuration of the accessibility actor
|
||||
///
|
||||
/// - `getWalker`: Returns a new AccessibleWalker actor (not to be confused with the general
|
||||
/// inspector Walker actor)
|
||||
/// inspector Walker actor)
|
||||
fn handle_message(
|
||||
&self,
|
||||
registry: &ActorRegistry,
|
||||
|
|
|
@ -42,7 +42,7 @@ impl Actor for CssPropertiesActor {
|
|||
/// The css properties actor can handle the following messages:
|
||||
///
|
||||
/// - `getCSSDatabase`: Returns a big list of every supported css property so that the
|
||||
/// inspector can show the available options
|
||||
/// inspector can show the available options
|
||||
fn handle_message(
|
||||
&self,
|
||||
_registry: &ActorRegistry,
|
||||
|
|
|
@ -89,7 +89,7 @@ impl Actor for NodeActor {
|
|||
/// The node actor can handle the following messages:
|
||||
///
|
||||
/// - `modifyAttributes`: Asks the script to change a value in the attribute of the
|
||||
/// corresponding node
|
||||
/// corresponding node
|
||||
///
|
||||
/// - `getUniqueSelector`: Returns the display name of this node
|
||||
fn handle_message(
|
||||
|
|
|
@ -120,7 +120,7 @@ impl Actor for WalkerActor {
|
|||
/// - `getOffsetParent`: Placeholder
|
||||
///
|
||||
/// - `querySelector`: Recursively looks for the specified selector in the tree, reutrning the
|
||||
/// node and its ascendents
|
||||
/// node and its ascendents
|
||||
fn handle_message(
|
||||
&self,
|
||||
registry: &ActorRegistry,
|
||||
|
|
|
@ -77,7 +77,7 @@ impl Actor for TabDescriptorActor {
|
|||
/// - `getFavicon`: Should return the tab favicon, but it is not yet supported.
|
||||
///
|
||||
/// - `getWatcher`: Returns a `WatcherActor` linked to the tab's `BrowsingContext`. It is used
|
||||
/// to describe the debugging capabilities of this tab.
|
||||
/// to describe the debugging capabilities of this tab.
|
||||
fn handle_message(
|
||||
&self,
|
||||
registry: &ActorRegistry,
|
||||
|
|
|
@ -160,17 +160,17 @@ impl Actor for WatcherActor {
|
|||
/// The watcher actor can handle the following messages:
|
||||
///
|
||||
/// - `watchTargets`: Returns a list of objects to debug. Since we only support web views, it
|
||||
/// returns the associated `BrowsingContextActor`. Every target sent creates a
|
||||
/// `target-available-form` event.
|
||||
/// returns the associated `BrowsingContextActor`. Every target sent creates a
|
||||
/// `target-available-form` event.
|
||||
///
|
||||
/// - `watchResources`: Start watching certain resource types. This sends
|
||||
/// `resource-available-form` events.
|
||||
/// `resource-available-form` events.
|
||||
///
|
||||
/// - `getNetworkParentActor`: Returns the network parent actor. It doesn't seem to do much at
|
||||
/// the moment.
|
||||
/// the moment.
|
||||
///
|
||||
/// - `getTargetConfigurationActor`: Returns the configuration actor for a specific target, so
|
||||
/// that the server can update its settings.
|
||||
/// that the server can update its settings.
|
||||
///
|
||||
/// - `getThreadConfigurationActor`: The same but with the configuration actor for the thread
|
||||
fn handle_message(
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
use std::cmp::{Ordering, PartialOrd};
|
||||
use std::sync::Arc;
|
||||
use std::vec::Vec;
|
||||
use std::{fmt, mem, u16};
|
||||
use std::{fmt, mem};
|
||||
|
||||
use app_units::Au;
|
||||
use euclid::default::Point2D;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
use std::cmp::max;
|
||||
use std::collections::VecDeque;
|
||||
use std::sync::Arc;
|
||||
use std::{fmt, i32, isize, mem};
|
||||
use std::{fmt, mem};
|
||||
|
||||
use app_units::{Au, MIN_AU};
|
||||
use base::print_tree::PrintTree;
|
||||
|
|
|
@ -1006,7 +1006,7 @@ impl<'a> BuilderForBoxFragment<'a> {
|
|||
repeat_vertical: border_image_repeat.1.to_webrender(),
|
||||
});
|
||||
builder.wr().push_border(
|
||||
&common,
|
||||
common,
|
||||
border_image_area.to_box2d(),
|
||||
border_image_widths,
|
||||
details,
|
||||
|
|
|
@ -220,7 +220,7 @@ impl FlexContainer {
|
|||
let mut item_infos = vec![];
|
||||
|
||||
let container_is_horizontal = self.style.writing_mode.is_horizontal();
|
||||
let flex_direction = used_flex_direction(&*self.style);
|
||||
let flex_direction = used_flex_direction(&self.style);
|
||||
let flex_axis = FlexAxis::from(flex_direction);
|
||||
let flex_wrap = self.style.get_position().flex_wrap;
|
||||
let flex_wrap_reverse = match flex_wrap {
|
||||
|
@ -1262,7 +1262,7 @@ impl InitialFlexLineLayout<'_> {
|
|||
let mut max_ascent = Au::zero();
|
||||
let mut max_descent = Au::zero();
|
||||
let mut max_outer_hypothetical_cross_size = Au::zero();
|
||||
for (item_result, item) in item_layout_results.iter().zip(&*items) {
|
||||
for (item_result, item) in item_layout_results.iter().zip(items) {
|
||||
// TODO: check inline-axis is parallel to main axis, check no auto cross margins
|
||||
if matches!(
|
||||
item.align_self.0.value(),
|
||||
|
|
|
@ -28,7 +28,8 @@ pub(crate) struct ContainingBlockManager<'a, T> {
|
|||
/// element is split across multiple lines, the containing block is
|
||||
/// undefined.
|
||||
/// 2. Otherwise, the containing block is formed by the padding edge of the
|
||||
/// ancestor."
|
||||
/// ancestor.
|
||||
///
|
||||
/// <https://www.w3.org/TR/CSS2/visudet.html#containing-block-details>
|
||||
/// If the ancestor forms a containing block for all descendants (see below),
|
||||
/// this value will be None and absolute descendants will use the containing
|
||||
|
|
|
@ -416,7 +416,7 @@ fn handle_range_request(
|
|||
// whose body is in the ResponseBody::Receiving state.
|
||||
(&(Bound::Included(beginning), Bound::Included(end)), Some(complete_resource)) => {
|
||||
if let ResponseBody::Done(ref body) = *complete_resource.body.lock().unwrap() {
|
||||
if end == u64::max_value() {
|
||||
if end == u64::MAX {
|
||||
// Prevent overflow on the addition below.
|
||||
return None;
|
||||
}
|
||||
|
@ -552,11 +552,7 @@ fn handle_range_request(
|
|||
} else {
|
||||
continue;
|
||||
};
|
||||
if total < res_beginning ||
|
||||
total < res_end ||
|
||||
offset == 0 ||
|
||||
offset == u64::max_value()
|
||||
{
|
||||
if total < res_beginning || total < res_end || offset == 0 || offset == u64::MAX {
|
||||
// Prevent overflow in the below operations from occuring.
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@ use std::collections::{BTreeMap, HashMap};
|
|||
use std::fs::File;
|
||||
use std::io::{self, Write};
|
||||
use std::path::Path;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
use std::{f64, thread, u32, u64};
|
||||
|
||||
use ipc_channel::ipc::{self, IpcReceiver};
|
||||
use profile_traits::time::{
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
use std::sync::Mutex;
|
||||
use std::u64;
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
use log::trace;
|
||||
|
|
|
@ -97,7 +97,7 @@ impl RenderingContext {
|
|||
let device = &mut self.0.device.borrow_mut();
|
||||
let context = &self.0.context.borrow();
|
||||
let surface_access = SurfaceAccess::GPUOnly;
|
||||
device.create_surface(&context, surface_access, surface_type)
|
||||
device.create_surface(context, surface_access, surface_type)
|
||||
}
|
||||
|
||||
pub fn destroy_surface(&self, mut surface: Surface) -> Result<(), Error> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue