style: split (most) string literals over 100-column line width limit

This commit is contained in:
Erich Gubler 2024-10-01 15:02:51 -04:00
parent 9f275f7655
commit 6e528aaf24
12 changed files with 89 additions and 30 deletions

View File

@ -14,7 +14,10 @@ use thiserror::Error;
pub enum PipelineConstantError {
#[error("Missing value for pipeline-overridable constant with identifier string: '{0}'")]
MissingValue(String),
#[error("Source f64 value needs to be finite (NaNs and Inifinites are not allowed) for number destinations")]
#[error(
"Source f64 value needs to be finite ({}) for number destinations",
"NaNs and Inifinites are not allowed"
)]
SrcNeedsToBeFinite,
#[error("Source f64 value doesn't fit in destination")]
DstRangeTooSmall,

View File

@ -630,7 +630,8 @@ impl<'a> Context<'a> {
frontend.errors.push(Error {
kind: ErrorKind::SemanticError(
format!(
"Cannot apply operation to {left_inner:?} and {right_inner:?}"
"Cannot apply operation to {:?} and {:?}",
left_inner, right_inner
)
.into(),
),
@ -828,7 +829,8 @@ impl<'a> Context<'a> {
frontend.errors.push(Error {
kind: ErrorKind::SemanticError(
format!(
"Cannot apply operation to {left_inner:?} and {right_inner:?}"
"Cannot apply operation to {:?} and {:?}",
left_inner, right_inner
)
.into(),
),
@ -908,7 +910,8 @@ impl<'a> Context<'a> {
frontend.errors.push(Error {
kind: ErrorKind::SemanticError(
format!(
"Cannot apply operation to {left_inner:?} and {right_inner:?}"
"Cannot apply operation to {:?} and {:?}",
left_inner, right_inner
)
.into(),
),

View File

@ -634,7 +634,8 @@ impl Frontend {
self.errors.push(Error {
kind: ErrorKind::SemanticError(
format!(
"'{name}': image needs {overload_access:?} access but only {call_access:?} was provided"
"'{}': image needs {:?} access but only {:?} was provided",
name, overload_access, call_access
)
.into(),
),

View File

@ -38,7 +38,13 @@ impl<'source> ParsingContext<'source> {
TokenValue::FloatConstant(float) => {
if float.width != 32 {
frontend.errors.push(Error {
kind: ErrorKind::SemanticError("Unsupported floating-point value (expected single-precision floating-point number)".into()),
kind: ErrorKind::SemanticError(
concat!(
"Unsupported floating-point value ",
"(expected single-precision floating-point number)"
)
.into(),
),
meta: token.meta,
});
}

View File

@ -294,14 +294,17 @@ impl Frontend {
.any(|i| components[i..].contains(&components[i - 1]));
if not_unique {
self.errors.push(Error {
kind:
ErrorKind::SemanticError(
format!(
"swizzle cannot have duplicate components in left-hand-side expression for \"{name:?}\""
)
.into(),
),
meta ,
kind: ErrorKind::SemanticError(
format!(
concat!(
"swizzle cannot have duplicate components in ",
"left-hand-side expression for \"{:?}\""
),
name
)
.into(),
),
meta,
})
}
}

View File

@ -47,7 +47,13 @@ pub enum Error {
UnsupportedBinaryOperator(spirv::Word),
#[error("Naga supports OpTypeRuntimeArray in the StorageBuffer storage class only")]
UnsupportedRuntimeArrayStorageClass,
#[error("unsupported matrix stride {stride} for a {columns}x{rows} matrix with scalar width={width}")]
#[error(
"unsupported matrix stride {} for a {}x{} matrix with scalar width={}",
stride,
columns,
rows,
width
)]
UnsupportedMatrixStride {
stride: u32,
columns: u8,

View File

@ -124,7 +124,12 @@ impl AccelerationStructureInstance {
&mut self,
shader_binding_table_record_offset: u32,
) {
debug_assert!(shader_binding_table_record_offset <= Self::MAX_U24, "shader_binding_table_record_offset uses more than 24 bits! {shader_binding_table_record_offset} > {}", Self::MAX_U24);
debug_assert!(
shader_binding_table_record_offset <= Self::MAX_U24,
"shader_binding_table_record_offset uses more than 24 bits! {} > {}",
shader_binding_table_record_offset,
Self::MAX_U24
);
self.shader_binding_table_record_offset_and_flags = (shader_binding_table_record_offset
& Self::LOW_24_MASK)
| (self.shader_binding_table_record_offset_and_flags & !Self::LOW_24_MASK)
@ -151,7 +156,9 @@ impl AccelerationStructureInstance {
);
debug_assert!(
shader_binding_table_record_offset <= Self::MAX_U24,
"shader_binding_table_record_offset uses more than 24 bits! {shader_binding_table_record_offset} > {}", Self::MAX_U24
"shader_binding_table_record_offset uses more than 24 bits! {} > {}",
shader_binding_table_record_offset,
Self::MAX_U24
);
AccelerationStructureInstance {
transform: Self::affine_to_rows(transform),

View File

@ -74,7 +74,8 @@ impl RenderDoc {
Err(e) => {
return RenderDoc::NotAvailable {
reason: format!(
"Unable to get RENDERDOC_GetAPI from renderdoc library '{renderdoc_filename}': {e:?}"
"Unable to get RENDERDOC_GetAPI from renderdoc library '{}': {e:?}",
renderdoc_filename
),
}
}
@ -89,7 +90,8 @@ impl RenderDoc {
},
return_value => RenderDoc::NotAvailable {
reason: format!(
"Unable to get API from renderdoc library '{renderdoc_filename}': {return_value}"
"Unable to get API from renderdoc library '{}': {}",
renderdoc_filename, return_value
),
},
}

View File

@ -457,11 +457,24 @@ impl Texture {
};
log::error!(
"wgpu-hal heuristics assumed that the view dimension will be equal to `{got}` rather than `{view_dimension:?}`.\n{}\n{}\n{}\n{}",
"`D2` textures with `depth_or_array_layers == 1` are assumed to have view dimension `D2`",
"`D2` textures with `depth_or_array_layers > 1` are assumed to have view dimension `D2Array`",
"`D2` textures with `depth_or_array_layers == 6` are assumed to have view dimension `Cube`",
"`D2` textures with `depth_or_array_layers > 6 && depth_or_array_layers % 6 == 0` are assumed to have view dimension `CubeArray`",
concat!(
"wgpu-hal heuristics assumed that ",
"the view dimension will be equal to `{}` rather than `{:?}`.\n",
"`D2` textures with ",
"`depth_or_array_layers == 1` ",
"are assumed to have view dimension `D2`\n",
"`D2` textures with ",
"`depth_or_array_layers > 1` ",
"are assumed to have view dimension `D2Array`\n",
"`D2` textures with ",
"`depth_or_array_layers == 6` ",
"are assumed to have view dimension `Cube`\n",
"`D2` textures with ",
"`depth_or_array_layers > 6 && depth_or_array_layers % 6 == 0` ",
"are assumed to have view dimension `CubeArray`\n",
),
got,
view_dimension,
);
}
}

View File

@ -64,9 +64,10 @@ impl Instance {
// “not supported” could include “insufficient GPU resources” or “the GPU process
// previously crashed”. So, we must return it as an `Err` since it could occur
// for circumstances outside the application author's control.
return Err(crate::InstanceError::new(String::from(
"canvas.getContext() returned null; webgl2 not available or canvas already in use"
)));
return Err(crate::InstanceError::new(String::from(concat!(
"canvas.getContext() returned null; ",
"webgl2 not available or canvas already in use"
))));
}
Err(js_error) => {
// <https://html.spec.whatwg.org/multipage/canvas.html#dom-canvas-getcontext>

View File

@ -745,7 +745,12 @@ impl crate::Instance for super::Instance {
Ok(sdk_ver) => sdk_ver,
Err(err) => {
log::error!(
"Couldn't parse Android's ro.build.version.sdk system property ({val}): {err}"
concat!(
"Couldn't parse Android's ",
"ro.build.version.sdk system property ({}): {}",
),
val,
err,
);
0
}
@ -931,7 +936,10 @@ impl crate::Instance for super::Instance {
if version < (21, 2) {
// See https://gitlab.freedesktop.org/mesa/mesa/-/issues/4688
log::warn!(
"Disabling presentation on '{}' (id {:?}) due to NV Optimus and Intel Mesa < v21.2",
concat!(
"Disabling presentation on '{}' (id {:?}) ",
"due to NV Optimus and Intel Mesa < v21.2"
),
exposed.info.name,
exposed.adapter.raw
);

View File

@ -418,7 +418,13 @@ impl Surface {
swapchain.next_present_time = Some(present_timing);
} else {
// Ideally we'd use something like `device.required_features` here, but that's in `wgpu-core`, which we are a dependency of
panic!("Tried to set display timing properties without the corresponding feature ({features:?}) enabled.");
panic!(
concat!(
"Tried to set display timing properties ",
"without the corresponding feature ({:?}) enabled."
),
features
);
}
}
}