Skip to content

Commit

Permalink
Formatting applied
Browse files Browse the repository at this point in the history
  • Loading branch information
AntunTu committed Sep 24, 2024
1 parent 389bc26 commit d1c6d4b
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/analysis/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use std::{
};

use super::namespaces;
use crate::{library::Library, nameutil::crate_name, version::Version};
use crate::nameutil::mangle_crate;
use crate::{library::Library, nameutil::crate_name, version::Version};

fn is_first_char_up(s: &str) -> bool {
s.chars().next().unwrap().is_uppercase()
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/rust_type.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::{borrow::Borrow, result};

use super::conversion_type::ConversionType;
use crate::nameutil::escape_digit;
use crate::{
analysis::{record_type::RecordType, ref_mode::RefMode, try_from_glib::TryFromGlib},
config::functions::{CallbackParameter, CallbackParameters},
Expand All @@ -9,7 +10,6 @@ use crate::{
nameutil::{is_gstring, use_glib_type},
traits::*,
};
use crate::nameutil::escape_digit;

#[derive(Clone, Debug, PartialEq, Eq)]
pub enum TypeError {
Expand Down
2 changes: 1 addition & 1 deletion src/codegen/bound.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use crate::nameutil::escape_digit;
use crate::{
analysis::{
bounds::{Bound, BoundType},
ref_mode::RefMode,
},
library::Nullable,
};
use crate::nameutil::escape_digit;

impl Bound {
/// Returns the type parameter reference.
Expand Down
2 changes: 1 addition & 1 deletion src/codegen/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ fn generate_enum(
}
doc_alias(w, &enum_.c_type, "", 0)?;

writeln!(w, "{} enum {} {{", analysis.visibility, &enum_name )?;
writeln!(w, "{} enum {} {{", analysis.visibility, &enum_name)?;
for member in &members {
cfg_deprecated(
w,
Expand Down
7 changes: 4 additions & 3 deletions src/codegen/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::{
};

use super::{function, general::allow_deprecated, trait_impls};
use crate::nameutil::flag_name;
use crate::{
analysis::flags::Info,
codegen::{
Expand All @@ -21,7 +22,6 @@ use crate::{
nameutil::{bitfield_member_name, use_glib_type},
traits::*,
};
use crate::nameutil::flag_name;

pub fn generate(env: &Env, root_path: &Path, mod_rs: &mut Vec<String>) {
if !env
Expand Down Expand Up @@ -60,7 +60,7 @@ pub fn generate(env: &Env, root_path: &Path, mod_rs: &mut Vec<String>) {
.map(|_| "#[allow(deprecated)]\n")
.unwrap_or(""),
flags_analysis.visibility.export_visibility(),
flag_name( &flags.name )
flag_name(&flags.name)
));
generate_flags(env, w, flags, config, flags_analysis)?;
}
Expand Down Expand Up @@ -103,7 +103,8 @@ fn generate_flags(
writeln!(
w,
" {} struct {}: u32 {{",
analysis.visibility, flag_name(&flags.name)
analysis.visibility,
flag_name(&flags.name)
)?;
for member in &flags.members {
let member_config = config.members.matched(&member.name);
Expand Down
3 changes: 1 addition & 2 deletions src/nameutil.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,8 @@ pub fn module_name(name: &str) -> String {
pub fn mangle_crate(name: &str) -> String {
let parts: Vec<_> = name.split("::").collect();
let name = if let Some(name) = parts.iter().last() {

let new_name = if name.starts_with(char::is_numeric) {
format!("_{name}")
format!("_{name}")
} else {
name.to_string()
};
Expand Down

0 comments on commit d1c6d4b

Please sign in to comment.