diff --git a/.rustfmt.toml b/.rustfmt.toml index 0d4356fd0e..f0b708a380 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml @@ -13,6 +13,6 @@ reorder_impl_items = true fn_single_line = true inline_attribute_width = 50 match_block_trailing_comma = true -merge_imports = true +imports_granularity="Crate" overflow_delimited_expr = true use_field_init_shorthand = true diff --git a/Cargo.lock b/Cargo.lock index 0e7da1c04d..89d57d4ede 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "ab_glyph" version = "0.2.10" diff --git a/client/src/lib.rs b/client/src/lib.rs index 66ed7474e6..9ea8f409e9 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -1,6 +1,6 @@ #![deny(unsafe_code)] #![deny(clippy::clone_on_ref_ptr)] -#![feature(label_break_value, option_zip, str_split_once)] +#![feature(label_break_value, option_zip)] pub mod addr; pub mod cmd; @@ -1045,7 +1045,7 @@ impl Client { where C: Clone, { - Some(self.state.read_storage::().get(self.entity()).cloned()?) + self.state.read_storage::().get(self.entity()).cloned() } pub fn current_biome(&self) -> BiomeKind { diff --git a/common/net/src/msg/client.rs b/common/net/src/msg/client.rs index 2ebf0c251e..66f87da4db 100644 --- a/common/net/src/msg/client.rs +++ b/common/net/src/msg/client.rs @@ -133,18 +133,18 @@ impl ClientMsg { end of 2nd level Enums */ -impl Into for ClientType { - fn into(self) -> ClientMsg { ClientMsg::Type(self) } +impl From for ClientMsg { + fn from(other: ClientType) -> ClientMsg { ClientMsg::Type(other) } } -impl Into for ClientRegister { - fn into(self) -> ClientMsg { ClientMsg::Register(self) } +impl From for ClientMsg { + fn from(other: ClientRegister) -> ClientMsg { ClientMsg::Register(other) } } -impl Into for ClientGeneral { - fn into(self) -> ClientMsg { ClientMsg::General(self) } +impl From for ClientMsg { + fn from(other: ClientGeneral) -> ClientMsg { ClientMsg::General(other) } } -impl Into for PingMsg { - fn into(self) -> ClientMsg { ClientMsg::Ping(self) } +impl From for ClientMsg { + fn from(other: PingMsg) -> ClientMsg { ClientMsg::Ping(other) } } diff --git a/common/net/src/msg/server.rs b/common/net/src/msg/server.rs index d761db5b40..1cc6ff0fd6 100644 --- a/common/net/src/msg/server.rs +++ b/common/net/src/msg/server.rs @@ -268,22 +268,22 @@ impl From for ServerGeneral { fn from(v: comp::ChatMsg) -> Self { ServerGeneral::ChatMsg(v) } } -impl Into for ServerInfo { - fn into(self) -> ServerMsg { ServerMsg::Info(self) } +impl From for ServerMsg { + fn from(o: ServerInfo) -> ServerMsg { ServerMsg::Info(o) } } -impl Into for ServerInit { - fn into(self) -> ServerMsg { ServerMsg::Init(Box::new(self)) } +impl From for ServerMsg { + fn from(o: ServerInit) -> ServerMsg { ServerMsg::Init(Box::new(o)) } } -impl Into for ServerRegisterAnswer { - fn into(self) -> ServerMsg { ServerMsg::RegisterAnswer(self) } +impl From for ServerMsg { + fn from(o: ServerRegisterAnswer) -> ServerMsg { ServerMsg::RegisterAnswer(o) } } -impl Into for ServerGeneral { - fn into(self) -> ServerMsg { ServerMsg::General(self) } +impl From for ServerMsg { + fn from(o: ServerGeneral) -> ServerMsg { ServerMsg::General(o) } } -impl Into for PingMsg { - fn into(self) -> ServerMsg { ServerMsg::Ping(self) } +impl From for ServerMsg { + fn from(o: PingMsg) -> ServerMsg { ServerMsg::Ping(o) } } diff --git a/common/src/assets.rs b/common/src/assets.rs index c30fec186e..cf016cdca2 100644 --- a/common/src/assets.rs +++ b/common/src/assets.rs @@ -211,19 +211,17 @@ lazy_static! { pub fn path_of(specifier: &str, ext: &str) -> PathBuf { ASSETS.source().path_of(specifier, ext) } fn get_dir_files(files: &mut Vec, path: &Path, specifier: &str) -> io::Result<()> { - for entry in fs::read_dir(path)? { - if let Ok(entry) = entry { - let path = entry.path(); - let maybe_stem = path.file_stem().and_then(|stem| stem.to_str()); + for entry in (fs::read_dir(path)?).flatten() { + let path = entry.path(); + let maybe_stem = path.file_stem().and_then(|stem| stem.to_str()); - if let Some(stem) = maybe_stem { - let specifier = format!("{}.{}", specifier, stem); + if let Some(stem) = maybe_stem { + let specifier = format!("{}.{}", specifier, stem); - if path.is_dir() { - get_dir_files(files, &path, &specifier)?; - } else { - files.push(specifier); - } + if path.is_dir() { + get_dir_files(files, &path, &specifier)?; + } else { + files.push(specifier); } } } diff --git a/common/src/comp/chat.rs b/common/src/comp/chat.rs index 9ad3ff27a2..57500ba6b6 100644 --- a/common/src/comp/chat.rs +++ b/common/src/comp/chat.rs @@ -289,8 +289,8 @@ impl SpeechBubble { let timeout = Instant::now() + Duration::from_secs_f64(SpeechBubble::DEFAULT_DURATION); Self { message, - timeout, icon, + timeout, } } @@ -299,8 +299,8 @@ impl SpeechBubble { let timeout = Instant::now() + Duration::from_secs_f64(SpeechBubble::DEFAULT_DURATION); Self { message, - timeout, icon, + timeout, } } diff --git a/common/src/comp/inventory/item/modular.rs b/common/src/comp/inventory/item/modular.rs index f77c0b3185..c30a8ca24c 100644 --- a/common/src/comp/inventory/item/modular.rs +++ b/common/src/comp/inventory/item/modular.rs @@ -261,7 +261,7 @@ fn make_tagexample_def( modkind.identifier_name(), toolkind.identifier_name(), ); - let tag = ModularComponentTag { modkind, toolkind }; + let tag = ModularComponentTag { toolkind, modkind }; // TODO: i18n let name = format!("Any {}", tag.name()); let description = format!( @@ -293,7 +293,7 @@ fn initialize_modular_assets() -> (HashMap, RawRecipeBook) { for &modkind in &MODKINDS { for tier in 0..=5 { let (identifier, item) = make_component_def(toolkind, modkind, tier); - let tag = ModularComponentTag { modkind, toolkind }; + let tag = ModularComponentTag { toolkind, modkind }; exemplars .entry(tag) .or_insert_with(Vec::new) diff --git a/common/src/comp/ori.rs b/common/src/comp/ori.rs index 351db07066..1961a04256 100644 --- a/common/src/comp/ori.rs +++ b/common/src/comp/ori.rs @@ -285,8 +285,9 @@ impl From for Ori { } } } -impl Into for Ori { - fn into(self) -> SerdeOri { SerdeOri(self.to_quat()) } + +impl From for SerdeOri { + fn from(other: Ori) -> SerdeOri { SerdeOri(other.to_quat()) } } impl Component for Ori { diff --git a/common/src/comp/stats.rs b/common/src/comp/stats.rs index a233b99c12..365c0d40bf 100644 --- a/common/src/comp/stats.rs +++ b/common/src/comp/stats.rs @@ -5,6 +5,7 @@ use specs_idvs::IdvStorage; use std::{error::Error, fmt}; #[derive(Debug)] +#[allow(dead_code)] // TODO: remove once trade sim hits master pub enum StatChangeError { Underflow, Overflow, diff --git a/common/src/lib.rs b/common/src/lib.rs index f5d86241e6..505b38940f 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -7,7 +7,6 @@ arbitrary_enum_discriminant, associated_type_defaults, bool_to_option, - const_checked_int_methods, const_generics, fundamental, iter_map_while, diff --git a/common/src/recipe.rs b/common/src/recipe.rs index 477a7ff659..b9fee6e6c2 100644 --- a/common/src/recipe.rs +++ b/common/src/recipe.rs @@ -140,7 +140,7 @@ impl assets::Compound for RecipeBook { .map(load_recipe_input) .collect::>()?; let output = load_item_def(output)?; - Ok((name.clone(), Recipe { inputs, output })) + Ok((name.clone(), Recipe { output, inputs })) }) .collect::>()?; diff --git a/common/src/region.rs b/common/src/region.rs index c2b5313491..1233ca5298 100644 --- a/common/src/region.rs +++ b/common/src/region.rs @@ -235,12 +235,10 @@ impl RegionMap { return Some(key); } else { // Check neighbors - for o in region.neighbors.iter() { - if let Some(idx) = o { - let (key, region) = self.regions.get_index(*idx).unwrap(); - if region.entities().contains(id) { - return Some(*key); - } + for idx in region.neighbors.iter().flatten() { + let (key, region) = self.regions.get_index(*idx).unwrap(); + if region.entities().contains(id) { + return Some(*key); } } } diff --git a/common/src/typed.rs b/common/src/typed.rs index e3613363f4..669b67238c 100644 --- a/common/src/typed.rs +++ b/common/src/typed.rs @@ -45,16 +45,16 @@ pub trait SynthTyped { /// variable, but this way we don't have to implement variable lookup and it /// doesn't serialize with variables). #[fundamental] -#[serde(transparent)] #[derive(Deserialize, Serialize)] +#[serde(transparent)] pub struct WeakHead { pub red: Reduction, #[serde(skip)] pub ty: PhantomData, } -#[serde(transparent)] #[derive(Deserialize, Serialize)] +#[serde(transparent)] pub struct Pure(pub T); impl<'a, Context: SubContext, T, S> Typed for &'a Pure { @@ -190,15 +190,15 @@ impl SynthTyped for WeakHead, Tar /// lift at some point; struct variants are not yet supported, and neither /// attributes on fields. #[fundamental] -#[serde(transparent)] #[derive(Deserialize, Serialize)] +#[serde(transparent)] pub struct ElimCase { pub cases: Cases, } #[fundamental] -#[serde(transparent)] #[derive(Deserialize, Serialize)] +#[serde(transparent)] pub struct ElimProj { pub proj: Proj, } diff --git a/common/src/uid.rs b/common/src/uid.rs index 1899a06299..83b8ec9b4d 100644 --- a/common/src/uid.rs +++ b/common/src/uid.rs @@ -12,8 +12,8 @@ use std::{fmt, u64}; #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] pub struct Uid(pub u64); -impl Into for Uid { - fn into(self) -> u64 { self.0 } +impl From for u64 { + fn from(uid: Uid) -> u64 { uid.0 } } impl From for Uid { diff --git a/common/src/util/dir.rs b/common/src/util/dir.rs index 70ca92ad37..bf1460fc4f 100644 --- a/common/src/util/dir.rs +++ b/common/src/util/dir.rs @@ -37,8 +37,9 @@ impl From for Dir { } } } -impl Into for Dir { - fn into(self) -> SerdeDir { SerdeDir(*self) } + +impl From for SerdeDir { + fn from(other: Dir) -> SerdeDir { SerdeDir(*other) } } /*pub enum TryFromVec3Error { ContainsNans, diff --git a/common/src/volumes/vol_grid_2d.rs b/common/src/volumes/vol_grid_2d.rs index 03ecec38af..4c9aa179a5 100644 --- a/common/src/volumes/vol_grid_2d.rs +++ b/common/src/volumes/vol_grid_2d.rs @@ -124,10 +124,7 @@ impl VolGrid2d { } pub fn get_key(&self, key: Vec2) -> Option<&V> { - match self.chunks.get(&key) { - Some(arc_chunk) => Some(arc_chunk.as_ref()), - None => None, - } + self.chunks.get(&key).map(|arc_chunk| arc_chunk.as_ref()) } pub fn get_key_arc(&self, key: Vec2) -> Option<&Arc> { self.chunks.get(&key) } diff --git a/common/src/volumes/vol_grid_3d.rs b/common/src/volumes/vol_grid_3d.rs index a56f7e713b..30446600ff 100644 --- a/common/src/volumes/vol_grid_3d.rs +++ b/common/src/volumes/vol_grid_3d.rs @@ -123,10 +123,7 @@ impl VolGrid3d { } pub fn get_key(&self, key: Vec3) -> Option<&V> { - match self.chunks.get(&key) { - Some(arc_chunk) => Some(arc_chunk.as_ref()), - None => None, - } + self.chunks.get(&key).map(|arc_chunk| arc_chunk.as_ref()) } pub fn get_key_arc(&self, key: Vec3) -> Option<&Arc> { self.chunks.get(&key) } diff --git a/network/src/api.rs b/network/src/api.rs index 0d97725a3a..f8ab01602c 100644 --- a/network/src/api.rs +++ b/network/src/api.rs @@ -1050,7 +1050,7 @@ where f(data); break; }, - Err(TryRecvError::Closed) => panic!(CHANNEL_ERR), + Err(TryRecvError::Closed) => panic!("{}", CHANNEL_ERR), Err(TryRecvError::Empty) => { trace!("activly sleeping"); cnt += 1; diff --git a/rust-toolchain b/rust-toolchain index a2b82fb1f4..86899ee56c 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2021-01-01 +nightly-2021-03-22 diff --git a/server/src/lib.rs b/server/src/lib.rs index b2741aefd4..e4ca587d56 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -6,8 +6,7 @@ bool_to_option, drain_filter, option_unwrap_none, - option_zip, - str_split_once + option_zip )] #![cfg_attr(not(feature = "worldgen"), feature(const_panic))] diff --git a/server/src/metrics.rs b/server/src/metrics.rs index 2af96a5e46..8e9a0ffe0f 100644 --- a/server/src/metrics.rs +++ b/server/src/metrics.rs @@ -125,18 +125,18 @@ impl EcsSystemMetrics { &["system"], )?; - registry.register(Box::new(system_length_hist.clone()))?; - registry.register(Box::new(system_length_count.clone()))?; registry.register(Box::new(system_start_time.clone()))?; registry.register(Box::new(system_length_time.clone()))?; registry.register(Box::new(system_thread_avg.clone()))?; + registry.register(Box::new(system_length_hist.clone()))?; + registry.register(Box::new(system_length_count.clone()))?; Ok(Self { - system_length_hist, - system_length_count, system_start_time, system_length_time, system_thread_avg, + system_length_hist, + system_length_count, }) } } diff --git a/server/src/persistence/character_loader.rs b/server/src/persistence/character_loader.rs index a43ceb8ed4..0d965acbf6 100644 --- a/server/src/persistence/character_loader.rs +++ b/server/src/persistence/character_loader.rs @@ -162,8 +162,8 @@ impl CharacterLoader { .unwrap(); Ok(Self { - update_tx, update_rx, + update_tx, }) } diff --git a/server/src/persistence/models.rs b/server/src/persistence/models.rs index ce73a5e146..4ea1bae951 100644 --- a/server/src/persistence/models.rs +++ b/server/src/persistence/models.rs @@ -18,8 +18,8 @@ pub struct NewCharacter<'a> { } #[derive(Identifiable, Queryable, Debug)] -#[primary_key(character_id)] #[table_name = "character"] +#[primary_key(character_id)] pub struct Character { pub character_id: i64, pub player_uuid: String, @@ -27,9 +27,9 @@ pub struct Character { pub waypoint: Option, } -#[primary_key(item_id)] -#[table_name = "item"] #[derive(Debug, Insertable, Queryable, AsChangeset)] +#[table_name = "item"] +#[primary_key(item_id)] pub struct Item { pub item_id: i64, pub parent_container_item_id: i64, diff --git a/voxygen/src/audio/channel.rs b/voxygen/src/audio/channel.rs index 7400c32538..6d325d72d1 100644 --- a/voxygen/src/audio/channel.rs +++ b/voxygen/src/audio/channel.rs @@ -171,12 +171,12 @@ impl AmbientChannel { pub fn new(stream: &OutputStreamHandle, tag: AmbientChannelTag) -> Self { let new_sink = Sink::try_new(stream); match new_sink { - Ok(sink) => Self { sink, tag }, + Ok(sink) => Self { tag, sink }, Err(_) => { warn!("Failed to create rodio sink. May not play wind sounds."); Self { - sink: Sink::new_idle().0, tag, + sink: Sink::new_idle().0, } }, } diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index b8dc721085..cb02ad6b6f 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -735,7 +735,7 @@ pub struct Hud { force_chat_cursor: Option, tab_complete: Option, pulse: f32, - velocity: f32, + _velocity: f32, slot_manager: slots::SlotManager, hotbar: hotbar::State, events: Vec, @@ -844,7 +844,7 @@ impl Hud { force_chat_cursor: None, tab_complete: None, pulse: 0.0, - velocity: 0.0, + _velocity: 0.0, slot_manager, hotbar: hotbar_state, events: Vec::new(), @@ -1791,7 +1791,7 @@ impl Hud { // Display debug window. if let Some(debug_info) = debug_info { - self.velocity = match debug_info.velocity { + self._velocity = match debug_info.velocity { Some(velocity) => velocity.0.magnitude(), None => 0.0, }; diff --git a/voxygen/src/i18n.rs b/voxygen/src/i18n.rs index 00defb3236..5ae3ff844f 100644 --- a/voxygen/src/i18n.rs +++ b/voxygen/src/i18n.rs @@ -259,15 +259,13 @@ impl assets::Compound for LocalizationList { let mut languages = vec![]; let i18n_root = assets::path_of(specifier, ""); - for i18n_directory in std::fs::read_dir(&i18n_root)? { - if let Ok(i18n_entry) = i18n_directory { - if let Some(i18n_key) = i18n_entry.file_name().to_str() { - // load the root file of all the subdirectories - if let Ok(localization) = cache.load::( - &[specifier, ".", i18n_key, ".", LANG_MANIFEST_FILE].concat(), - ) { - languages.push(localization.read().metadata.clone()); - } + for i18n_entry in (std::fs::read_dir(&i18n_root)?).flatten() { + if let Some(i18n_key) = i18n_entry.file_name().to_str() { + // load the root file of all the subdirectories + if let Ok(localization) = cache.load::( + &[specifier, ".", i18n_key, ".", LANG_MANIFEST_FILE].concat(), + ) { + languages.push(localization.read().metadata.clone()); } } } @@ -418,7 +416,7 @@ mod tests { { Ok(true) => Some(e.final_commit_id()), Ok(false) => Some(existing_commit), - Err(err) => panic!(err), + Err(err) => panic!("{}", err), } }, None => Some(e.final_commit_id()), @@ -439,28 +437,26 @@ mod tests { let root_dir = std::env::current_dir() .map(|p| p.parent().expect("").to_owned()) .unwrap(); - for i18n_file in root_dir.join(&dir).read_dir().unwrap() { - if let Ok(i18n_file) = i18n_file { - if let Ok(file_type) = i18n_file.file_type() { - if file_type.is_file() { - let full_path = i18n_file.path(); - let path = full_path.strip_prefix(&root_dir).unwrap(); - println!("-> {:?}", i18n_file.file_name()); - let i18n_blob = read_file_from_path(&repo, &head_ref, &path); - let i18n: LocalizationFragment = match from_bytes(i18n_blob.content()) { - Ok(v) => v, - Err(e) => { - eprintln!( - "Could not parse {} RON file, skipping: {}", - i18n_file.path().to_string_lossy(), - e - ); - continue; - }, - }; - i18n_key_versions - .extend(generate_key_version(&repo, &i18n, &path, &i18n_blob)); - } + //TODO: review unwraps in this file + for i18n_file in root_dir.join(&dir).read_dir().unwrap().flatten() { + if let Ok(file_type) = i18n_file.file_type() { + if file_type.is_file() { + let full_path = i18n_file.path(); + let path = full_path.strip_prefix(&root_dir).unwrap(); + println!("-> {:?}", i18n_file.file_name()); + let i18n_blob = read_file_from_path(&repo, &head_ref, &path); + let i18n: LocalizationFragment = match from_bytes(i18n_blob.content()) { + Ok(v) => v, + Err(e) => { + eprintln!( + "Could not parse {} RON file, skipping: {}", + i18n_file.path().to_string_lossy(), + e + ); + continue; + }, + }; + i18n_key_versions.extend(generate_key_version(&repo, &i18n, &path, &i18n_blob)); } } } @@ -471,29 +467,27 @@ mod tests { .map(|p| p.parent().expect("").to_owned()) .unwrap(); // Walk through each file in the directory - for i18n_file in root_dir.join(&directory_path).read_dir().unwrap() { - if let Ok(i18n_file) = i18n_file { - if let Ok(file_type) = i18n_file.file_type() { - // Skip folders and the manifest file (which does not contain the same struct we - // want to load) - if file_type.is_file() - && i18n_file.file_name().to_string_lossy() - != (LANG_MANIFEST_FILE.to_string() + ".ron") - { - let full_path = i18n_file.path(); - println!("-> {:?}", full_path.strip_prefix(&root_dir).unwrap()); - let f = fs::File::open(&full_path).expect("Failed opening file"); - let _: LocalizationFragment = match from_reader(f) { - Ok(v) => v, - Err(e) => { - panic!( - "Could not parse {} RON file, error: {}", - full_path.to_string_lossy(), - e - ); - }, - }; - } + for i18n_file in root_dir.join(&directory_path).read_dir().unwrap().flatten() { + if let Ok(file_type) = i18n_file.file_type() { + // Skip folders and the manifest file (which does not contain the same struct we + // want to load) + if file_type.is_file() + && i18n_file.file_name().to_string_lossy() + != (LANG_MANIFEST_FILE.to_string() + ".ron") + { + let full_path = i18n_file.path(); + println!("-> {:?}", full_path.strip_prefix(&root_dir).unwrap()); + let f = fs::File::open(&full_path).expect("Failed opening file"); + let _: LocalizationFragment = match from_reader(f) { + Ok(v) => v, + Err(e) => { + panic!( + "Could not parse {} RON file, error: {}", + full_path.to_string_lossy(), + e + ); + }, + }; } } } diff --git a/voxygen/src/render/pipelines/particle.rs b/voxygen/src/render/pipelines/particle.rs index 69c9900584..d798bde320 100644 --- a/voxygen/src/render/pipelines/particle.rs +++ b/voxygen/src/render/pipelines/particle.rs @@ -77,7 +77,7 @@ gfx_defines! { } impl Vertex { - #[allow(clippy::collapsible_if)] + #[allow(clippy::collapsible_else_if)] pub fn new(pos: Vec3, norm: Vec3) -> Self { let norm_bits = if norm.x != 0.0 { if norm.x < 0.0 { 0 } else { 1 } diff --git a/voxygen/src/render/pipelines/sprite.rs b/voxygen/src/render/pipelines/sprite.rs index bd95f84b21..21a8157585 100644 --- a/voxygen/src/render/pipelines/sprite.rs +++ b/voxygen/src/render/pipelines/sprite.rs @@ -87,7 +87,7 @@ impl fmt::Display for Vertex { impl Vertex { // NOTE: Limit to 16 (x) × 16 (y) × 32 (z). - #[allow(clippy::collapsible_if)] + #[allow(clippy::collapsible_else_if)] pub fn new( atlas_pos: Vec2, pos: Vec3, diff --git a/voxygen/src/render/renderer.rs b/voxygen/src/render/renderer.rs index 6856dbbb4b..d83048baa7 100644 --- a/voxygen/src/render/renderer.rs +++ b/voxygen/src/render/renderer.rs @@ -272,6 +272,7 @@ pub struct Renderer { lod_terrain_pipeline: GfxPipeline>, clouds_pipeline: GfxPipeline>, postprocess_pipeline: GfxPipeline>, + #[allow(dead_code)] //TODO: remove ? player_shadow_pipeline: GfxPipeline>, shaders: AssetHandle, @@ -358,16 +359,16 @@ impl Renderer { directed_sampler, ) = shadow_views; Some(ShadowMapRenderer { + directed_depth_stencil_view, + directed_res, + directed_sampler, + // point_encoder: factory.create_command_buffer().into(), // directed_encoder: factory.create_command_buffer().into(), point_depth_stencil_view, point_res, point_sampler, - directed_depth_stencil_view, - directed_res, - directed_sampler, - point_pipeline, terrain_directed_pipeline, figure_directed_pipeline, diff --git a/voxygen/src/scene/terrain/watcher.rs b/voxygen/src/scene/terrain/watcher.rs index 202d7f284a..74d2fda778 100644 --- a/voxygen/src/scene/terrain/watcher.rs +++ b/voxygen/src/scene/terrain/watcher.rs @@ -129,14 +129,14 @@ impl BlocksOfInterest { reeds, fireflies, flowers, - interactables, - lights, fire_bowls, snow, cricket1, cricket2, cricket3, frogs, + interactables, + lights, } } } diff --git a/voxygen/src/ui/ice/mod.rs b/voxygen/src/ui/ice/mod.rs index c605f37bc3..ea90a6048a 100644 --- a/voxygen/src/ui/ice/mod.rs +++ b/voxygen/src/ui/ice/mod.rs @@ -184,6 +184,7 @@ impl IcedUi { let messages = { span!(_guard, "update user_interface"); let mut messages = Vec::new(); + #[allow(clippy::manual_map)] let _event_status_list = user_interface.update( &self.events, cursor_position, diff --git a/voxygen/src/ui/ice/widget/mouse_detector.rs b/voxygen/src/ui/ice/widget/mouse_detector.rs index 575b779787..a93df67ae5 100644 --- a/voxygen/src/ui/ice/widget/mouse_detector.rs +++ b/voxygen/src/ui/ice/widget/mouse_detector.rs @@ -22,9 +22,9 @@ pub struct MouseDetector<'a> { impl<'a> MouseDetector<'a> { pub fn new(state: &'a mut State, width: Length, height: Length) -> Self { Self { - state, width, height, + state, } } } diff --git a/voxygen/src/ui/widgets/image_slider.rs b/voxygen/src/ui/widgets/image_slider.rs index fc9ab05938..dc74840282 100644 --- a/voxygen/src/ui/widgets/image_slider.rs +++ b/voxygen/src/ui/widgets/image_slider.rs @@ -45,7 +45,9 @@ pub struct ImageSlider { struct Track { image_id: image::Id, color: Option, + #[allow(dead_code)] src_rect: Option, + #[allow(dead_code)] breadth: Option, // Padding on the ends of the track constraining the slider to a smaller area. padding: (f32, f32), @@ -56,6 +58,7 @@ struct Slider { hover_image_id: Option, press_image_id: Option, color: Option, + #[allow(dead_code)] src_rect: Option, length: Option, } diff --git a/voxygen/src/window.rs b/voxygen/src/window.rs index 8751865867..93db970855 100644 --- a/voxygen/src/window.rs +++ b/voxygen/src/window.rs @@ -1391,13 +1391,9 @@ impl Window { *remapping = None; None }, - None => { - if let Some(game_inputs) = controls.get_associated_game_inputs(&key_mouse) { - Some(game_inputs.iter()) - } else { - None - } - }, + None => controls + .get_associated_game_inputs(&key_mouse) + .map(|game_inputs| game_inputs.iter()), } } diff --git a/world/src/lib.rs b/world/src/lib.rs index 078caeffcf..749ae305c4 100644 --- a/world/src/lib.rs +++ b/world/src/lib.rs @@ -13,7 +13,6 @@ const_panic, label_break_value, or_patterns, - array_value_iter, array_map )] diff --git a/world/src/sim/mod.rs b/world/src/sim/mod.rs index df95fa4ee2..7b064c02db 100644 --- a/world/src/sim/mod.rs +++ b/world/src/sim/mod.rs @@ -358,7 +358,8 @@ pub struct WorldSim { /// post-erosion warping, cliffs, and other things like that). pub max_height: f32, pub(crate) chunks: Vec, - pub(crate) locations: Vec, + //TODO: remove or use this property + pub(crate) _locations: Vec, pub(crate) gen_ctx: GenCtx, pub rng: ChaChaRng, @@ -1397,7 +1398,7 @@ impl WorldSim { map_size_lg, max_height: maxh as f32, chunks, - locations: Vec::new(), + _locations: Vec::new(), gen_ctx, rng, }; @@ -1718,7 +1719,7 @@ impl WorldSim { } self.rng = rng; - self.locations = locations; + self._locations = locations; } pub fn get(&self, chunk_pos: Vec2) -> Option<&SimChunk> { diff --git a/world/src/site/dungeon/mod.rs b/world/src/site/dungeon/mod.rs index 34430cdd3a..e50fc2037d 100644 --- a/world/src/site/dungeon/mod.rs +++ b/world/src/site/dungeon/mod.rs @@ -1170,7 +1170,7 @@ impl Floor { } // Find orientation of a position relative to another position - #[allow(clippy::collapsible_if)] + #[allow(clippy::collapsible_else_if)] fn relative_ori(pos1: Vec2, pos2: Vec2) -> u8 { if (pos1.x - pos2.x).abs() < (pos1.y - pos2.y).abs() { if pos1.y > pos2.y { 4 } else { 8 } diff --git a/world/src/site2/mod.rs b/world/src/site2/mod.rs index f2a36ebdeb..6a65ebc154 100644 --- a/world/src/site2/mod.rs +++ b/world/src/site2/mod.rs @@ -740,10 +740,10 @@ fn wpos_is_hazard(land: &Land, wpos: Vec2) -> Option { .map_or(true, |c| c.river.near_water()) { Some(HazardKind::Water) - } else if let Some(gradient) = Some(land.get_gradient_approx(wpos)).filter(|g| *g > 0.8) { - Some(HazardKind::Hill { gradient }) } else { - None + Some(land.get_gradient_approx(wpos)) + .filter(|g| *g > 0.8) + .map(|gradient| HazardKind::Hill { gradient }) } }