mirror of
https://github.com/gleam-lang/gleam.git
synced 2025-12-23 09:47:08 +00:00
Apply clippy 0.1.73 suggestions
This commit is contained in:
parent
bd296729c1
commit
adeeb81bec
6 changed files with 12 additions and 19 deletions
|
|
@ -776,7 +776,6 @@ fn provide_package(
|
|||
let mut requirements = HashMap::new();
|
||||
parents.push(package_name);
|
||||
for (name, requirement) in config.dependencies.into_iter() {
|
||||
let name = name;
|
||||
let version = match requirement {
|
||||
Requirement::Hex { version } => version,
|
||||
Requirement::Path { path } => {
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ pub fn infer_module<A>(
|
|||
package,
|
||||
direct_dependencies,
|
||||
warnings,
|
||||
&mut env,
|
||||
&env,
|
||||
)?;
|
||||
typed_statements.push(statement);
|
||||
}
|
||||
|
|
@ -934,7 +934,7 @@ fn record_imported_items_for_use_detection<A>(
|
|||
current_package: &str,
|
||||
direct_dependencies: &HashMap<SmolStr, A>,
|
||||
warnings: &TypeWarningEmitter,
|
||||
environment: &mut Environment<'_>,
|
||||
environment: &Environment<'_>,
|
||||
) -> Result<TypedDefinition, Error> {
|
||||
let Import {
|
||||
documentation,
|
||||
|
|
|
|||
|
|
@ -1208,7 +1208,7 @@ fn module_fn_with_args<'a>(
|
|||
module: &'a str,
|
||||
name: &'a str,
|
||||
args: Vec<Document<'a>>,
|
||||
env: &mut Env<'a>,
|
||||
env: &Env<'a>,
|
||||
) -> Document<'a> {
|
||||
let args = wrap_args(args);
|
||||
if module == env.module {
|
||||
|
|
@ -1397,14 +1397,14 @@ fn needs_begin_end_wrapping(expression: &TypedExpr) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
fn todo<'a>(message: &'a Option<SmolStr>, location: SrcSpan, env: &mut Env<'a>) -> Document<'a> {
|
||||
fn todo<'a>(message: &'a Option<SmolStr>, location: SrcSpan, env: &Env<'a>) -> Document<'a> {
|
||||
let message = message
|
||||
.as_deref()
|
||||
.unwrap_or("This has not yet been implemented");
|
||||
erlang_error("todo", message, location, vec![], env)
|
||||
}
|
||||
|
||||
fn panic<'a>(location: SrcSpan, message: Option<&'a str>, env: &mut Env<'a>) -> Document<'a> {
|
||||
fn panic<'a>(location: SrcSpan, message: Option<&'a str>, env: &Env<'a>) -> Document<'a> {
|
||||
let message = message.unwrap_or("panic expression evaluated");
|
||||
erlang_error("panic", message, location, vec![], env)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -630,10 +630,7 @@ impl<'module> Generator<'module> {
|
|||
// We can remove this when we get exhaustiveness checking.
|
||||
doc = doc
|
||||
.append(" else {")
|
||||
.append(
|
||||
docvec!(line(), self.case_no_match(location, subjects.into_iter())?)
|
||||
.nest(INDENT),
|
||||
)
|
||||
.append(docvec!(line(), self.case_no_match(location, subjects)?).nest(INDENT))
|
||||
.append(line())
|
||||
.append("}")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,10 +19,7 @@ impl Feedback {
|
|||
}
|
||||
|
||||
pub fn append_diagnostic(&mut self, path: Utf8PathBuf, diagnostic: Diagnostic) {
|
||||
self.diagnostics
|
||||
.entry(path)
|
||||
.or_insert_with(Vec::new)
|
||||
.push(diagnostic);
|
||||
self.diagnostics.entry(path).or_default().push(diagnostic);
|
||||
}
|
||||
|
||||
fn append_message(&mut self, diagnostic: Diagnostic) {
|
||||
|
|
|
|||
|
|
@ -49,19 +49,19 @@ impl Default for CompileOptions {
|
|||
/// `target` language.
|
||||
pub fn compile_(options: CompileOptions) -> Result<HashMap<String, String>, String> {
|
||||
let paths = ProjectPaths::at_filesystem_root();
|
||||
let mut wfs = WasmFileSystem::new();
|
||||
let wfs = WasmFileSystem::new();
|
||||
|
||||
for (path, source) in options.source_files.iter() {
|
||||
write_source_file(source, path, &mut wfs);
|
||||
write_source_file(source, path, &wfs);
|
||||
}
|
||||
|
||||
let _package =
|
||||
compile_project(&mut wfs, options.target, &options).map_err(|e| e.pretty_string())?;
|
||||
compile_project(&wfs, options.target, &options).map_err(|e| e.pretty_string())?;
|
||||
|
||||
Ok(gather_compiled_files(&paths, &wfs, options.target).unwrap())
|
||||
}
|
||||
|
||||
fn write_source_file<P: AsRef<Utf8Path>>(source: &str, path: P, wfs: &mut WasmFileSystem) {
|
||||
fn write_source_file<P: AsRef<Utf8Path>>(source: &str, path: P, wfs: &WasmFileSystem) {
|
||||
wfs.write(path.as_ref(), source)
|
||||
.expect("should always succeed with the virtual file system");
|
||||
}
|
||||
|
|
@ -86,7 +86,7 @@ fn manifest_from_name(name: &str) -> ManifestPackage {
|
|||
}
|
||||
|
||||
fn compile_project(
|
||||
wfs: &mut WasmFileSystem,
|
||||
wfs: &WasmFileSystem,
|
||||
target: Target,
|
||||
compile_options: &CompileOptions,
|
||||
) -> Result<Built, Error> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue